Home > Software design >  catplot() in seaborn doesn't work with subplot()
catplot() in seaborn doesn't work with subplot()

Time:02-13

I cannot subplot catplot. Here is my code:

import seaborn as sns
import matplotlib.pyplot as plt

fig, axes = plt.subplots(1,2)
sns.catplot(x='species', y='sepal_length', data=df , kind='violin')
sns.catplot(x='species', y='sepal_width', data=df , kind='violin')

And here is the output: How can I fix it? Thank you.

enter image description here enter image description here enter image description here

CodePudding user response:

catplot creates its sns.catplot with long form dataframe

CodePudding user response:

Although this may be a promotion of my package, enter image description here

You can also align them vertically as follow.

(g1/g2).savefig()

enter image description here

The code above is executable in Google colab.

  • Related