我創建了一個包括xerr的barh圖。對于錯誤條的上限,我希望是圓邊。我試圖在error_kw中設定capstyle,但沒有成功。
bars = ax. barh(range(3), [1,2,3] 。
xerr=[0.5,0.4,0.3] 。
align='center', color='銀色', height=0.5,
capsize=12, error_kw={'elinewidth':1, 'solid_capstyle':'round'})
我還試圖在之后訪問Line2D物件來改變capstyle,這也沒有成功。
bars.errorbar.lines[1] [0].set_solid_capstyle('round')
誰能給我一個提示,我在這里做錯了什么嗎?
uj5u.com熱心網友回復:
我現在找到了問題所在,我必須訪問cap的私有屬性。而不是方法
cap.set_solid_capstyle('round')
我必須訪問私有屬性:
cap._marker._capstyle = "round"。
感謝您的評論 @tmdavison
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/329073.html
標籤:
