【发布时间】:2015-11-23 17:41:06
【问题描述】:
使用 Seaborn 0.6.0,我试图在 violinplot 上覆盖 pointplot。我的问题是violinplot 的单个观察中的“棒”被绘制在pointplot 的标记之上,如下所示。
import seaborn as sns
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, figsize=[12,8])
sns.violinplot(x="day", y="total_bill", hue="smoker", data=tips,
split=True, inner='stick', ax=ax, palette=['white']*2)
sns.pointplot(x="day", y='total_bill', hue="smoker",
data=tips, dodge=0.3, ax=ax, join=False)
仔细看这个图,绿色的误差线显示在小提琴棒的上方(看看星期六),但蓝色的误差线和蓝色和绿色的点绘制在小提琴棒的下方。
我尝试将zorder 的不同组合传递给这两个函数,但这并没有改善情节的外观。我可以做些什么来让点图中的所有元素出现在 violoinplot 的所有元素之上?
【问题讨论】:
标签: python matplotlib seaborn z-order