Download notebook (.ipynb)

All Predefined Themes#

import pandas as pd

from lets_plot import *
LetsPlot.setup_html()
df = pd.read_csv("https://raw.githubusercontent.com/JetBrains/lets-plot-kotlin/master/docs/examples/data/mpg.csv")
print(df.shape)
df.head()
(234, 12)
Unnamed: 0 manufacturer model displ year cyl trans drv cty hwy fl class
0 1 audi a4 1.8 1999 4 auto(l5) f 18 29 p compact
1 2 audi a4 1.8 1999 4 manual(m5) f 21 29 p compact
2 3 audi a4 2.0 2008 4 manual(m6) f 20 31 p compact
3 4 audi a4 2.0 2008 4 auto(av) f 21 30 p compact
4 5 audi a4 2.8 1999 6 auto(l5) f 16 26 p compact
p = ggplot(df, aes("cty", "hwy", color="drv")) + geom_point()
gggrid([
    p + ggtitle("theme_minimal2() - the default"),
    p + theme_void() + ggtitle("theme_void()"),
    p + theme_grey() + ggtitle("theme_grey()"),
    p + theme_bw() + ggtitle("theme_bw()"),
    p + theme_light() + ggtitle("theme_light()"),
    p + theme_classic() + ggtitle("theme_classic()"),
    p + theme_minimal() + ggtitle("theme_minimal()"),
], ncol=3)
pf = p + facet_grid(x="drv")
gggrid([
    pf + ggtitle("theme_minimal2() - the default"),
    pf + theme_void() + ggtitle("theme_void()"),
    pf + theme_grey() + ggtitle("theme_grey()"),
    pf + theme_bw() + ggtitle("theme_bw()"),
    pf + theme_light() + ggtitle("theme_light()"),
    pf + theme_classic() + ggtitle("theme_classic()"),
    pf + theme_minimal() + ggtitle("theme_minimal()"),
], ncol=1)
# You can also use theme_gray(), which is an alias for theme_grey():

gggrid([
    p + theme_grey() + ggtitle("theme_grey()"),
    p + theme_gray() + ggtitle("theme_gray()"),
])