seaborn.objects.Plot.theme
seaborn.set_theme()
p = (
so.Plot(anscombe, "x", "y", color="dataset")
.facet("dataset", wrap=2)
.add(so.Line(), so.PolyFit(order=1))
.add(so.Dot())
)
p
Pass a dictionary of rc parameters to change the appearance of the plot:
p.theme({"axes.facecolor": "w", "axes.edgecolor": "slategray"})
Many (though not all) mark properties will reflect theme parameters by default:
p.theme({"lines.linewidth": 4})
Apply seaborn styles by passing in the output of the style functions:
from seaborn import axes_style
p.theme(axes_style("ticks"))
Or apply styles that ship with matplotlib:
from matplotlib import style
p.theme(style.library["fivethirtyeight"])
Multiple parameter dictionaries should be passed to the same function call. On Python 3.9+, you can use dictionary union syntax for this:
from seaborn import plotting_context
p.theme(axes_style("whitegrid") | plotting_context("talk"))
The default theme for all Plot instances can be changed using the Plot.config attribute:
so.Plot.config.theme.update(axes_style("white"))
p