lets-plot
lets-plot copied to clipboard
More flexible ggsize()
Sometimes I only need to restrict the width of my plot. But I can only specify either both parameters or none, but cannot just change one of them. Here is one case example:
import pandas as pd
from lets_plot import *
LetsPlot.setup_html()
df = pd.read_csv('https://raw.githubusercontent.com/HIL-HK/lets-plot-examples/master/data/mpg.csv')
ggplot(df.sort_values(by=['cyl', 'year'])) + \
geom_point(aes(x='cty', y='hwy')) + \
facet_grid(x='year', y='cyl') + \
ggsize(600, 800) # Better: ggsize(width=600)