Home > Software design >  How to make horizontal error bars instead of vertical in matplotlib
How to make horizontal error bars instead of vertical in matplotlib

Time:03-04

I have created error bars via matplotlib, however, I want them to be horizontally instead of vertically.

ax.errorbar(x, y, deviation, fmt='bo')

CodePudding user response:

Try to provide xerr attribute matplotlib.pyplot.errorbar(x, y, xerr)

xerr: Define the horizontal error bar sizes.

xerr, yerr : float or array-like, shape(N,) or shape(2, N), optional

The errorbar sizes:

  • scalar: Symmetric /- values for all data points.
  • shape(N,): Symmetric /-values for each data point.
  • shape(2, N): Separate - and values for each bar. First row contains the
  • lower errors, the second row contains the upper errors.
  • None: No errorbar.
  • Related