python + matplotlib: how can I change the bar's line width for a single bar?

matplotlib, python, python-2.7

Solution

I ended up doing it like this:

ax.axvspan(X1,
           X1+wi,
           ymax=Y2,
           facecolor='none',
           edgecolor='black',
           linewidth=2)

…where

X1 = bar_handles[startBlock].get_x()
wi = bar_handles[startBlock].get_width()
Y2 = ax.transLimits.transform((0,bar_handles[startBlock].get_height()))[1]

This produces an edge over my bar — including all the elements within — without the horizontal like between the elements.

Problem

I have a bar plot consisting in 3 stacked series and 5 bars. I want to highlight one single bar (all 3 stacked elements) by changing the width of the line. I'm drawing the bars with the following command: ``` mybar = ax.bar(x,Y[:,i],bottom=x,color=colors[i],edgecolor='none',width=wi,linewidth = 0) bar_handles = np.append(bar_handles,mybar) ``` I have handle for the bar I want to change stored in the array `bar_handles`, is there a way to change a bar's `edgecolor` and `linewidth` property after it has been drawn?

Original source