我正在尝试改变小提琴图中平均值的颜色,如下所述:Matplotlib 用颜色或形状区分平均值和中位数
但我的小提琴情节是一个子情节,这不起作用。我有办法做到这一点吗?
这是我的代码:
fig, axes = plt.subplots(figsize = (16, 7), ncols = 2)
fig.suptitle('Distribution of Domain Lengths', size = 18)
axes[0].boxplot(human_pfam_domains['length'], showmeans = True)
axes[1].violinplot(human_pfam_domains['length'], showmeans = True, showmedians=True, vert=True, points= 500)
axes[1]['cmeans'].set_color('b')
和错误:
TypeError Traceback (most recent call last)
<ipython-input-62-22cdd9b07029> in <module>()
6 axes[1].violinplot(human_pfam_domains['length'], showmeans = True, showmedians=True, vert=True, points= 500)
7
----> 8 axes[1]['cmeans'].set_color('b')
TypeError: 'AxesSubplot' object has no attribute '__getitem_
谢谢!!