I'm trying to plot an errorbar
graph where each error bar may be either, say, red or green depending on whether the statistics used to compute the bar are significant.
I tried using an array of colors as an input to the c
parameter, but that didn't work.
Does anyone know how to do that?
Here is the code that I have so far:
yerrs = np.array([quantiles[:,2],quantiles[:,3]])
print yerrs.shape
colors = ['r', 'b'] * (yerrs.shape[1]/2)
fig, axes = plt.subplots(nrows=2, sharex=True, sharey=True)
axes[0].errorbar(quantiles[:,0],quantiles[:,1], yerr=yerrs, c=colors)
axes[0].axhline(0, color='black')
axes[0].axvline(0, color='black')
axes[0].set_title('Fitted dist')
I then get the error:
ValueError: to_rgba: Invalid rgba arg "['r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b', 'r', 'b']"
could not convert string to float: r