1
我想喜歡這裏discribed改變均值的顏色小提琴情節:Matplotlib differentiate between mean and median with colour or shape改變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_
謝謝!