Matplotlib barh capstyle ’round’ not working?

I created a barh plot including xerr. For the caps of the errorbars I would like round edges. I tried to set the capstyle in the error_kw, which didn’t work out.

bars = ax.barh(range(3), [1,2,3], 
        xerr=[0.5,0.4,0.3], 
        align='center', color='silver', height=0.5,
        capsize=12, error_kw={'elinewidth':1, 'solid_capstyle':'round'})

I also tried to access the Line2D objects afterwards to change the capstyle, which also didn’t work out.

bars.errorbar.lines[1][0].set_solid_capstyle('round')

Can someone please give me a hint what I’m doing wrong here?

Answer

I found the problem now, I had to access the private attribute of the cap. Instead of the method

cap.set_solid_capstyle('round')

I had to access the private attribute:

cap._marker._capstyle = "round"

Thanks for your comment anyway @tmdavison