ggtb(): size_zoomin and size_basis Parameters for Geometry Scaling¶
size_zoomin parameter¶
The size_zoomin parameter accepts an integer value:
0— zoom in disabled (default)-1— unlimited zoom in- Any other positive number — maximum zoom-in limit. For example,
2means the geometry can be scaled up to 2×.
size_basis parameter¶
The size_basis parameter accepts a string value: x, y, min, or max (default: max).
It defines which axis is used to calculate the scaling factor.
xandyspecify the corresponding axis.minuses the smaller scaling factor.maxuses the larger scaling factor.
In [1]:
from lets_plot import *
import pandas as pd
LetsPlot.setup_html()
Enable 'Unlimited' Zoom¶
In [2]:
ggplot() + geom_point(x=0, y=0, size=10) + ggtb(
size_zoomin=-1 # <-- Point size can grow without limits.
)
Out[2]:
Limit Maximum Zoom to 3× Original Size¶
In [3]:
mpg = pd.read_csv('https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg2.csv')
In [4]:
p = (
ggplot(mpg,
aes('engine horsepower', 'miles per gallon',
color=as_discrete('origin of car',order=-1)))
+ theme_grey() + ggtitle('Efficiency vs Engine Horsepower')
)
In [5]:
p + geom_jitter(seed=42) + ggtb(
size_zoomin=3 # <-- Point size can grow to 3x of the original size max.
)
Out[5]: