【发布时间】:2020-04-20 18:03:59
【问题描述】:
我正在尝试在我的 seaborn boxplot 上实现垂直线来分隔每一列,到目前为止,我似乎只能添加贯穿中间的主要线 ax.xaxis.grid(True, which='major')。这是我的代码和我想要实现的图像。谢谢!
# Custom palette
my_pal = {"Year A": "#e42628", "Year B": "#377db6"}
plt.figure(figsize=(16, 10))
sns.axes_style("whitegrid")
ax = sns.boxplot(x='variable', y="value", hue="Condition", showmeans=True, data=df, palette=my_pal, meanprops={"marker":"s","markerfacecolor":"white", "markeredgecolor":"black"})
plt.ylabel("Temperature (\xb0C)")
#ax.axvline(linewidth=2, color='r')
ax.xaxis.grid(True, which='major')
【问题讨论】:
标签: python-3.x matplotlib seaborn