October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk2 min

How to Plot Asymmetric Error Bars in Matplotlib

Use a two-row array for asymmetric Matplotlib error bars: lower distances in row one, upper distances in row two. Apply it with xerr or yerr.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Pass separate lower and upper error distances to Matplotlib’s errorbar function as a two-row array: the first row is the lower distance, and the second is the upper. Use yerr for vertical bars or xerr for horizontal bars; all distances must be nonnegative.

Pass separate lower and upper errors

For N data points, the asymmetric input has shape (2, N). Each column corresponds to one point. Its first row gives the distance below the point and its second row gives the distance above it. These are distances from the central value, not signed endpoint offsets.

import numpy as np
import matplotlib.pyplot as plt

x = np.array([1, 2, 3])
y = np.array([2.0, 3.5, 2.8])
lower = np.array([0.2, 0.4, 0.1])
upper = np.array([0.5, 0.3, 0.6])

fig, ax = plt.subplots()
ax.errorbar(x, y, yerr=np.vstack([lower, upper]), fmt='o', capsize=4)
plt.show()

Here, the first point’s vertical bar extends from y[0] - 0.2 to y[0] + 0.5. The second point uses its own lower and upper distances, and so on. The Matplotlib 3.11.0 errorbar API reference documents this two-row format and the lower-then-upper row order.

Choose vertical or horizontal error bars

Use yerr when uncertainty extends vertically around each y value. Use xerr when it extends horizontally around each x value. In either case, supply lower and upper distances in the same row order.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A one-dimensional array with one value per point represents symmetric errors that can vary from point to point. Use the two-row (2, N) form when the lower and upper distances differ. Matplotlib’s official asymmetric error-bar example demonstrates building the two rows from lower and upper arrays.

Keep error inputs nonnegative

Error-bar inputs are sizes, so each value must be greater than or equal to zero. Do not encode a lower endpoint by putting a negative number in the first row. For a central value v, provide the positive distance from v down to the lower endpoint and the positive distance from v up to the upper endpoint.

Control what the plot displays

  • fmt='none' draws error bars without data markers or a connecting line.
  • ecolor sets the error-bar color; if omitted, the bars use the data-line color.
  • capsize sets the cap length in points.
  • errorevery can show bars only at selected data points when drawing every bar would clutter the plot.

For one-sided limits, the API provides lolims, uplims, xlolims, and xuplims. If an axis is inverted, set its limits before calling errorbar, as directed by the API reference.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What the plot does—and does not—say

errorbar renders the error sizes you provide; it does not decide whether they represent a confidence interval, standard error, measurement bound, or another quantity. Choose and describe the uncertainty calculation separately so readers can interpret the bars correctly.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.