我做了一个DataFrame,如下
我想把它绘制成像这样的countplot。
其中色调是我的数据框架的一列。
不太清楚你的表是什么格式,如果你使用下面这样的pd.crosstab,你可以很容易地调用plot.bar()来给出你想要的图。
import seaborn as sns tab = pd.crosstab(np.random.choice(["very useful","somewhat useful","not useful"],1000), np.random.choice(["test","kaggle"],1000)) tab.plot.barh()