import numpy as np
from lets_plot import *
LetsPlot.setup_html()
data = {'x':[1,3,5], 'y':[0,0,0], 'z': [1,2,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')
# as previous, but with size = 2
ggplot(data) + geom_point(aes(x='x', y='y'), size = 2, size_unit='x')
# size = 0.4 , size_unit = 'y'
ggplot(data) + geom_point(aes(x='x', y='y'), size = 0.4, size_unit='y')
#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()
#as previous example, but without scale_size_identity
ggplot(data) + geom_point(aes(x='x', y='y', size='z', color='z'), size_unit='x')
# 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')
# 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)