Returning to the Theme Defaults with flavor_standard()

Use flavor_standard() to override other flavors or to make defaults explicit.

In [1]:
import pandas as pd
from lets_plot import *

LetsPlot.setup_html()
In [2]:
# A reusable style layer for consistent plots across the project.

my_theme = (
    theme_classic() +
    theme(
        axis_title=element_text(size=13),
        axis_text=element_text(size=15),
        legend_position="left",
        axis_ticks_length=7,
        panel_grid_major=element_line(color="spring_green"),
        panel_grid_minor=element_blank()
    ) + flavor_darcula()
)

LetsPlot.set_theme(my_theme)
In [3]:
mpg_df = pd.read_csv ("https://raw.githubusercontent.com/JetBrains/lets-plot-docs/master/data/mpg.csv")
In [4]:
# A base plot with the common project style

p = ggplot(mpg_df, aes("cty","hwy", color='drv')) + \
    geom_point(tooltips=layer_tooltips().line('@manufacturer @model')) + \
    ggtitle("Fuel Economy: City and Highway Mileage by Drive Type")
p
Out[4]:
In [5]:
# To restore the theme defaults without affecting other settings, apply flavor_standard(). 
# This can be useful, for example, when exporting the plot for printing.

fullpath_png = ggsave(p+flavor_standard(), "plot.png", scale=1)

from IPython.display import Image
Image(filename=fullpath_png)
Out[5]:
No description has been provided for this image