import matplotlib.pyplot as plt
fig = plt.figure()
axi = fig.add_subplot(2, 2, 1)
axi = fig.add_subplot(2, 2, 2)
axi = fig.add_subplot(2, 2, 3)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200826103219577.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0pvYW5uYU1hbw==,size_16,color_FFFFFF,t_70#pic_center)
plt.plot(randn(50).cumsum(), 'k--')
text.groupby(['Sex','Survived'])['Survived'].count().unstack().plot(kind='bar',stacked='True')
plt.title('survived_count')
plt.ylabel('count')
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200826103806499.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0pvYW5uYU1hbw==,size_16,color_FFFFFF,t_70#pic_center)
fare_sur1 = text.groupby(['Fare'])['Survived'].value_counts()
fare_sur1
fig = plt.figure(figsize=(20, 18))
fare_sur1.plot(grid=True)
plt.legend()
plt.show()
pclass_sur = text.groupby(['Pclass'])['Survived'].value_counts()
pclass_sur
import seaborn as sns
sns.countplot(x="Pclass", hue="Survived", data=text)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200826103933500.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0pvYW5uYU1hbw==,size_16,color_FFFFFF,t_70#pic_center)
text.Age[text.Pclass == 1].plot(kind='kde')
text.Age[text.Pclass == 2].plot(kind='kde')
text.Age[text.Pclass == 3].plot(kind='kde')
plt.xlabel("age")
plt.legend((1,2,3),loc="best")
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200826104011320.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0pvYW5uYU1hbw==,size_16,color_FFFFFF,t_70#pic_center)