0
f, ax=plt.subplots(1,2, figsize=(10,6))

sns.barplot('Parch','Survived', data=data, ax=ax[0])
ax[0].set_title('Parch vs Survived')

sns.factorplot('Parch','Survived', data=data, ax=ax[1])
ax[1].set_title('Parch vs Survived')

plt.show()

As a result, the frist_plot goes well but the second plotting is separated and drops down.I add the result_image for illustration: enter image description here

Why is the second sns.plot separated to down, and what do I have to do?

Mr. T
  • 11,960
  • 10
  • 32
  • 54
younseong
  • 11
  • 2
  • Hi and welcome to stackoverflow, make sure to create a title for the question that responds to your problem. In your case it would be: `sns creates an empty graph when using barplot and factorplot in plt.subplots`. – Jonas Palačionis Jan 07 '21 at 11:05

1 Answers1

0

You can use this:

f, ax=plt.subplots(1,2, figsize=(10,6))
sns.barplot('parch','survived', data=data, ax=ax[0])
sns.factorplot('parch','survived', data=data, ax=ax[1])
plt.close(2)
plt.close(3)

Here you can find more information on why this is happening.

Jonas Palačionis
  • 4,591
  • 4
  • 22
  • 55
  • OMG, you know I'm in titanic_Kaggle!! Thank U so much and I solved it in VScode. but kaggle jupyter is still. I think kaggle jupyter is dumb – younseong Jan 07 '21 at 11:36