from plotnine import *
from plotnine.data import penguins
= (
p ="flipper_length_mm", y="body_mass_g", color="species"))
ggplot(penguins, aes(x+ geom_point()
+ scale_x_continuous(breaks=range(150, 250, 30))
+ facet_wrap("~species")
+ labs(subtitle="I am a subtitle")
)
Premade themes
Premade themes begin with theme_*()
. For convenience, this page displays 10 premade themes that come with plotnine
. By default, plotnine
uses theme_gray()
.
Setup
BW
+ theme_bw() + labs(title="theme_bw()") p
Classical
+ theme_classic() + labs(title="theme_classic()") p
Gray
+ theme_gray() + labs(title="theme_gray()") p
Light/Dark
+ theme_light() + labs(title="theme_light()")
p + theme_dark() + labs(title="theme_dark()") p
Matplotlib
+ theme_matplotlib() + labs(title="theme_matplotlib()") p
Minimal
+ theme_minimal() + labs(title="theme_minimal()") p
Seaborn
+ theme_seaborn() + labs(title="theme_seaborn()") p
Tufte
+ theme_tufte() + labs(title="theme_tufte()") p
538
+ theme_538() + labs(title="theme_538()") p