import numpy as np
from lets_plot import *
LetsPlot.setup_html()
set_theme()
¶LetsPlot.set_theme(theme_bw()
+ flavor_darcula()
+ theme(panel_background=element_rect(fill='yellow')))
data = {'name': ['pen', 'brush', 'paper'],
'slice': [1, 3, 3]}
ggplot(data) + \
geom_pie(aes(fill='name', slice='slice'),
stat='identity', color='pen',
tooltips='none', labels=layer_labels().line('@name')) + \
scale_fill_manual(['pen', 'brush', 'paper'])
LetsPlot.set_theme(theme(panel_background=element_rect(fill='yellow'))
+ theme_bw()
+ flavor_darcula())
data = {'name': ['pen', 'brush', 'paper'],
'slice': [1, 3, 3]}
ggplot(data) + \
geom_pie(aes(fill='name', slice='slice'),
stat='identity', color='pen',
tooltips='none', labels=layer_labels().line('@name')) + \
scale_fill_manual(['pen', 'brush', 'paper'])
The previous flavors are overwritten by the last flavor.
LetsPlot.set_theme(theme(panel_background=element_rect(fill='yellow'))
+ theme_bw()
+ flavor_darcula()
+ flavor_high_contrast_light())
data = {'name': ['pen', 'brush', 'paper'],
'slice': [1, 3, 3]}
ggplot(data) + \
geom_pie(aes(fill='name', slice='slice'),
stat='identity', color='pen',
tooltips='none', labels=layer_labels().line('@name')) + \
scale_fill_manual(['pen', 'brush', 'paper'])
data = {'name': ['pen', 'brush', 'paper'],
'slice': [1, 3, 3]}
ggplot(data) + \
geom_pie(aes(fill='name', slice='slice'),
stat='identity', color='pen',
tooltips='none', labels=layer_labels().line('@name')) + \
scale_fill_manual(['pen', 'brush', 'paper']) +\
theme(panel_background=element_rect(fill='yellow')) +\
theme_classic() +\
flavor_darcula() +\
flavor_high_contrast_light()
gggrid()
and GGbunch()
¶LetsPlot.set_theme(theme_bw()
+ flavor_darcula()
+ theme(panel_background=element_rect(fill='yellow')))
np.random.seed(42)
n = 100
x = np.arange(n)
y = np.random.normal(size=n)
w, h = 200, 150
p = ggplot({'x': x, 'y': y}, aes(x='x', y='y')) + ggsize(w, h)
plot_list=[
gggrid([p+geom_point(), p+geom_histogram(bins=3)]),
p+geom_line()
]
gggrid(plot_list, ncol=1) + ggsize(400, 300)
p = ggplot({'x': x, 'y': y}, aes(x='x', y='y')) + ggsize(w, h)
bunch = GGBunch()
bunch.add_plot(p + geom_point(), 0, 0)
bunch.add_plot(p + geom_histogram(bins=3), w, 0)
bunch.add_plot(p + geom_line(), 0, h, 2*w, h)
bunch.show()
LetsPlot.set_theme(theme(panel_background=element_rect(fill='yellow'))
+ theme_bw()
+ flavor_darcula()
+ flavor_high_contrast_light()
+ geom_point())
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[14], line 1 ----> 1 LetsPlot.set_theme(theme(panel_background=element_rect(fill='yellow')) 2 + theme_bw() 3 + flavor_darcula() 4 + flavor_high_contrast_light() 5 + geom_point()) File ~\AppData\Roaming\Python\Python310\site-packages\lets_plot\__init__.py:175, in LetsPlot.set_theme(cls, theme) 165 """ 166 Set up global theme. 167 (...) 172 173 """ 174 if theme.kind != 'theme' and not (theme.kind == 'feature-list' and all(f.kind == 'theme' for f in theme)): --> 175 raise ValueError("Only `theme(...)`, `theme_xxx()`, `flavor_xxx()`, or a sum of them are supported") 177 _set_global_theme(theme) ValueError: Only `theme(...)`, `theme_xxx()`, `flavor_xxx()`, or a sum of them are supported