首页 > 解决方案 > seaborn barplot 的 pyplot 等价物是什么?

问题描述

我想转换这个条形图:

sns.barplot(x='Pclass', y='Survived', data=train_df)

使用 Pandas 数据框或 pyplot 的内置绘图功能如何将这个 seaborn 条形图转换为 pyplot 条形图?

标签: pythonpandasmatplotlibseaborn

解决方案


With pure pyplot (import matplotlib.pyplot as plt):

plt.bar(x='Pclass', height='Survived', data=train_df)

推荐阅读