On Tue, Nov 8, 2011 at 9:57 AM, Blake, James <james.bl...@nuth.nhs.uk>wrote:

> Dear MPL gurus,
>
> I've probably failed to RTFM properly.
>
> I'm trying to produce error bars with horizontal lines at the top of the
> vertical error bars to cap them. I've tried adjusting capsize on both
> plt.bar and plt.errorbar, but have not had any success. I think I had
> this working previously with 1.0.1, but can't remember for definite.
>
> Matplotlib: 1.1.0
> Python version: 2.7.2
> IPython: 0.11
> Windows XP 32 bit
>
> Many thanks for any pointers, and apologies if I have missed an obvious
> setting.
>
> James
>
>
>
> === begin example code ===
> import matplotlib.pyplot as plt
> import numpy as np
> plt.ion()
> X = np.array([.5,1.5,2.5,3.5])
> Y  = np.array([1,2,3,4])
> dY = np.array([.1,.2,.3,.4])
> f = plt.figure()
> ax = f.add_subplot(111)
> A = plt.bar(X, Y, yerr=dY, ecolor='red', capsize=10)
> A[0].set_facecolor('black')
> A[1].set_facecolor('gray')
> A[2].set_facecolor('black')
> A[3].set_facecolor('gray')
> ax.set_xlim([0.,4.8])
> plt.show()
>

Are you trying to widen the cap, or make it thicker?  I forget which does
which, but in my plots, I use "capsize" for one of them and "mew"
(markeredgewidth) for the other.  If I remember correctly, the errorbar
caps are actually a dash marker turned on its side.  If that is the case,
then adjusting "mew" would adjust the thickness.

Ben Root
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to