The Wayback Machine - https://web.archive.org/web/20250611222233/https://github.com/matplotlib/matplotlib/issues/21101
Skip to content

[Bug]: Errorbars separated from markers with negative errors #21101

Closed
@nbrunett

Description

@nbrunett

Bug summary

If unique upper and lower errors are specified, and one of them is negative, then the errorbar will appear separate from the marker. It looks like this was mentioned ages ago in #2717 but I could not find a follow up to that issue.

Code for reproduction

import matplotlib.pyplot as plt

# 1
plt.errorbar([0], [0], yerr=[[-0.5], [1]], marker="o")

# 2
plt.errorbar([0], [0], xerr=[[-0.5], [1]], marker="o")

# 3
plt.errorbar([0], [0], xerr=[[-0.5], [1]], yerr=[[-0.5], [1]], marker="o")

Actual outcome

1

image

2

image

3

image

Expected outcome

I understand the documentation states that the error inputs should be positive values, but I would expect some error like ValueError when there is a negative value provided, rather than it trying to make the plot. I would prefer an error being thrown and the plot not being made.

Operating system

CentOS Linux release 7.9.2009 (Core)

Matplotlib Version

3.4.3

Matplotlib Backend

module://matplotlib_inline.backend_inline

Python version

3.9.6

Jupyter version

3.1.9

Other libraries

No response

Installation

conda

Conda channel

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good first issueOpen a pull request against these issues if there are no active ones!

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions