import pandas as pd
from lets_plot import *
LetsPlot.setup_html()
mpg_df = pd.read_csv ("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg.csv")
mpg_df
p = ggplot(mpg_df, aes("cty","hwy", color='drv')) + \
geom_point(tooltips=layer_tooltips().line('@manufacturer @model'))
p2 = p + facet_grid(y="drv")
w, h = 600, 400
def themeWithFlavor(plot, theme, title):
bunch = GGBunch()
bunch.add_plot(plot + theme + ggtitle(title), 0, 0, w, h)
bunch.add_plot(plot + theme + flavor_darcula()+ ggtitle("darcula"), w, 0, w, h)
bunch.add_plot(plot + theme + flavor_solarized_light()+ ggtitle("solarized_light"), 0, h, w, h)
bunch.add_plot(plot + theme + flavor_solarized_dark()+ ggtitle("solarized_dark"), w, h, w, h)
bunch.add_plot(plot + theme + flavor_high_contrast_light()+ ggtitle("high_contrast_light"), 0, h*2, w, h)
bunch.add_plot(plot + theme + flavor_high_contrast_dark()+ ggtitle("high_contrast_dark"), w, h*2, w, h)
bunch.show()
themeWithFlavor(p, theme_minimal2(), "minimal2")
themeWithFlavor(p2, theme_minimal2(), "minimal2 + facet_grid")
themeWithFlavor(p, theme_minimal(), "minimal")
themeWithFlavor(p2, theme_minimal(), "minimal + facet_grid")
themeWithFlavor(p, theme_classic(), "classic")
themeWithFlavor(p2, theme_classic(), "classic + facet_grid")
themeWithFlavor(p, theme_light(), "light")
themeWithFlavor(p2, theme_light(), "light + facet_grid")
themeWithFlavor(p, theme_grey(), "grey")
themeWithFlavor(p2, theme_grey(), "grey + facet_grid")
themeWithFlavor(p, theme_none(), "none")
themeWithFlavor(p2, theme_none(), "none + facet_grid")
themeWithFlavor(p, theme_bw(), "bw")
themeWithFlavor(p2, theme_bw(), "bw + facet_grid")