#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd from lets_plot import * LetsPlot.setup_html() # In[2]: mpg_df = pd.read_csv ("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg.csv") mpg_df # In[3]: p = ggplot(mpg_df, aes("cty","hwy", color='drv')) + \ geom_point(tooltips=layer_tooltips().line('@manufacturer @model')) # In[4]: p2 = p + facet_grid(y="drv") # In[5]: 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() # In[6]: themeWithFlavor(p, theme_minimal2(), "minimal2") # In[7]: themeWithFlavor(p2, theme_minimal2(), "minimal2 + facet_grid") # In[8]: themeWithFlavor(p, theme_minimal(), "minimal") # In[9]: themeWithFlavor(p2, theme_minimal(), "minimal + facet_grid") # In[10]: themeWithFlavor(p, theme_classic(), "classic") # In[11]: themeWithFlavor(p2, theme_classic(), "classic + facet_grid") # In[12]: themeWithFlavor(p, theme_light(), "light") # In[13]: themeWithFlavor(p2, theme_light(), "light + facet_grid") # In[14]: themeWithFlavor(p, theme_grey(), "grey") # In[15]: themeWithFlavor(p2, theme_grey(), "grey + facet_grid") # In[16]: themeWithFlavor(p, theme_void(), "void") # In[17]: themeWithFlavor(p2, theme_void(), "void + facet_grid") # In[18]: themeWithFlavor(p, theme_none(), "none") # In[19]: themeWithFlavor(p2, theme_none(), "none + facet_grid") # In[20]: themeWithFlavor(p, theme_bw(), "bw") # In[21]: themeWithFlavor(p2, theme_bw(), "bw + facet_grid")