2024-09-27 17:46:01 发布
网友
如何使用matplotlib、searborn、Plotly或任何其他框架绘制下图,显示与平均值的差异
我发现有些人把这个图叫做^{}。使用seaborn,可以使用如下代码:
import seaborn as sns import matplotlib.pyplot as plt sns.set(style="white", context="talk") f, ax1 = plt.subplots(figsize=(7, 5), sharex=True) mean = df.mean() y2 = mean - df["your column"] sns.barplot(x=dfCopy.index, y=y2, palette="deep", ax=ax1) ax1.axhline(0, color="k", clip_on=False) ax1.set_ylabel("Diverging") # Finalize the plot sns.despine(bottom=True) plt.setp(f.axes, yticks=[]) plt.tight_layout(h_pad=2)
我发现有些人把这个图叫做^{} 。使用seaborn,可以使用如下代码:
相关问题 更多 >
编程相关推荐