capsize on errorbars


Adjusting mew sorted it out. Somewhere along the line, I'd changed lines.markeredgewidth in my matplotlibrc to 0, so it wasn't drawing the lines.

Now I know the caps are drawn as a dashed marker, it meant that the lines around it weren't being drawn (or rather they were, but with zero width). With mew>0, if I change capsize, the width of the cap now adjusts accordingly.

Many thanks.



From: ben.v.root@…287… [mailto:ben.v.root@…287…] On Behalf Of Benjamin Root
Sent: 08 November 2011 16:41
To: Blake, James
Subject: Re: [Matplotlib-users] capsize on errorbars

On Tue, Nov 8, 2011 at 9:57 AM, Blake, James <James.Blake@...3840...> 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 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


=== begin example code ===
import matplotlib.pyplot as plt
import numpy as np
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 =, Y, yerr=dY, ecolor='red', capsize=10)

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
This message may contain confidential information. If you are not the intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.


This email has been processed by SmoothZap -