doc/_docstrings/set_theme.ipynb
import seaborn as sns
import matplotlib.pyplot as plt
By default, seaborn plots will be made with the current values of the matplotlib rcParams:
sns.barplot(x=["A", "B", "C"], y=[1, 3, 2])
Calling this function with no arguments will activate seaborn's "default" theme:
sns.set_theme()
sns.barplot(x=["A", "B", "C"], y=[1, 3, 2])
Note that this will take effect for all matplotlib plots, including those not made using seaborn:
plt.bar(["A", "B", "C"], [1, 3, 2])
The seaborn theme is decomposed into several distinct sets of parameters that you can control independently:
sns.set_theme(style="whitegrid", palette="pastel")
sns.barplot(x=["A", "B", "C"], y=[1, 3, 2])
Pass None to preserve the current values for a given set of parameters:
sns.set_theme(style="white", palette=None)
sns.barplot(x=["A", "B", "C"], y=[1, 3, 2])
You can also override any seaborn parameters or define additional parameters that are part of the matplotlib rc system but not included in the seaborn themes:
custom_params = {"axes.spines.right": False, "axes.spines.top": False}
sns.set_theme(style="ticks", rc=custom_params)
sns.barplot(x=["A", "B", "C"], y=[1, 3, 2])