1

I drew a custom error bar for my seaborn barplot because I need to use within-subject error bar. I used:

plt.errorbar([0, 1], [mean1, mean2], yerr = errBar_value,
             elinewidth = 3, ecolor = "k", capsize = 0.5)

Here is the result

enter image description here

How to increase the capsize? I tried different values of capsize but nothing is changed.

Many thanks

Jiajun

J_yang
  • 2,672
  • 8
  • 32
  • 61

2 Answers2

2

plt.errorbar([0, 1], [mean1, mean2], yerr = errBar_value,elinewidth = 3, ecolor = "k", capsize = 0.5,fmt=' ')

The fmt statement gets rid of the line. For me it works to put a larger value for capsize to increase its size. I am using python 3.6.1

DZurico
  • 637
  • 4
  • 11
  • thanks. strangely I tried capsize from 0.01 ~ 1000. But nothing change. I used 2.7. But the capsize on the seaborn.barplot totally worked. – J_yang Mar 03 '18 at 11:30
  • Just tried it with python 2.7. It works there as well (used capsize=10). My matplotlib is version 2.1.2 – DZurico Mar 03 '18 at 11:38
1

At the end, I did this:

(_, caps, _) = plt.errorbar([0, 1], [ncv['VisualOnly'].mean(), ncme['Mode Explorer'].mean()], yerr = errBar_vo,
             elinewidth = 3, ecolor = "k", fmt = ' ',capsize = 5)
for cap in caps:
    cap.set_color('k')
    cap.set_markeredgewidth(3)

setting the caps manually seems to solve the issue.

J_yang
  • 2,672
  • 8
  • 32
  • 61