How To Add Vertical Gridlines In Seaborn Catplot With Multiple Column Plots
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 =
Solution 1:
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')
Solution 2:
You could also simply use:
sns.set_style("whitegrid")
It works with other sns plotting functions as well.
Post a Comment for "How To Add Vertical Gridlines In Seaborn Catplot With Multiple Column Plots"