In [1]:
import numpy as np
from lets_plot import *

LetsPlot.setup_html()
In [2]:
data = {'x':[1,3,5], 'y':[0,0,0], 'z': [1,2,3]}
In [3]:
# size_unit forces visible size of point with Aes.size == 1 to be equal to the unit of given scale.
ggplot(data) + geom_point(aes(x='x', y='y'), size = 1, size_unit='x')
Out[3]:
In [4]:
# as previous, but with size = 2
ggplot(data) + geom_point(aes(x='x', y='y'), size = 2, size_unit='x')
Out[4]:
In [5]:
# size = 0.4 , size_unit = 'y'
ggplot(data) + geom_point(aes(x='x', y='y'), size = 0.4, size_unit='y')
Out[5]:
In [6]:
#with size and color mapped to z and scale_size_identity
ggplot(data) + geom_point(aes(x='x', y='y', size='z', color = 'z'), size_unit='x') + scale_size_identity()
Out[6]:
In [7]:
#as previous example, but without scale_size_identity
ggplot(data) + geom_point(aes(x='x', y='y', size='z', color='z'), size_unit='x')
Out[7]:
In [8]:
# size_unit for text fits 5 symbol string to given axis unit 
ggplot(data) + geom_text(aes(x='x', y='y', label='x'), size = 1, size_unit='x', label_format='.2f')
Out[8]:
In [9]:
# as previous, but size_unit = 'y' + angle = 90
ggplot(data) + geom_text(aes(x='x', y='y', label='x'), size = 1, size_unit='y', label_format='.2f', angle=90)
Out[9]:

size_unit min/max

size_unit='max' and Rubber Band Zoom in ggtb()

In [10]:
ggplot(data) + geom_point(aes(x='x', y='y'), size=.1, size_unit='max') + ggtb()
Out[10]:

size_unit='x' vs size_unit='max' when changing the aspect ratio of the plot in ggbunch()

In [11]:
data2 = {'name': ['a', 'b', 'c', 'd', 'b'], 'value': [40, 90, 10, 50, 20]}
In [12]:
ggbunch([
    ggplot(data2) + geom_pie(aes(fill='name', weight='value'), size=.5, size_unit='x'),
    ggplot(data2) + geom_pie(aes(fill='name', weight='value'), size=.5, size_unit='x')
], [
    (0,0.4,0.8,0.2),
    (0.8,0,0.2,1)
]) + ggsize(1000, 600)
Out[12]:
In [13]:
ggbunch([
    ggplot(data2) + geom_pie(aes(fill='name', weight='value'), size=.5, size_unit='max'),
    ggplot(data2) + geom_pie(aes(fill='name', weight='value'), size=.5, size_unit='max')
], [
    (0,0.4,0.8,0.2),
    (0.8,0,0.2,1)
]) + ggsize(1000, 600)
Out[13]:
In [ ]: