Reputation: 733
I want to plot a catplot using the following code.
import seaborn as sns
sns.set_theme(style="ticks")
exercise = sns.load_dataset("exercise")
sns.set_style({'axes.grid': True})
g = sns.catplot(x="time", y="pulse", hue="kind", data=exercise)
But this does not plot vertical gridlines. How can I add them?
Upvotes: 2
Views: 5074
Reputation: 31
You could also simply use:
sns.set_style("whitegrid")
It works with other sns plotting functions as well.
Upvotes: 3
Reputation: 40667
It looks like seaborn actively turns off vertical grid lines (see here).
You have to re-enable them on each axes created by catplot
:
sns.set_style("ticks")
exercise = sns.load_dataset("exercise")
g = sns.catplot(x="time", y="pulse", hue="kind", data=exercise)
for ax in g.axes.flat:
ax.grid(True, axis='both')
Upvotes: 7