Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: Incorrect error bar on log scale #21579

Closed
@fnareoh

Description

@fnareoh

Bug summary

Thank you for the amazing work!

The issue is different from #163, the behavior is that if you try to plot a zero point (without any error) on a logscale (y) graph the error bar of the previous point is not plotting correctly, see the example where mini0 error bar is incorrect (desired behavior in mini1):
https://imgur.com/a/lP75nwU

Code for reproduction

import matplotlib.pyplot as plt

fig = plt.figure()
ax = plt.axes()
ax.set_yscale("log")

ys =[7, 0]
ys2 =[1, 1]
errs =[5, 0]
xs = [0, 1]
ax.errorbar(xs, ys,fmt="o-", yerr=errs)
ax.errorbar(xs, ys2,fmt="o-")
fig.savefig('mini0.png')
fig.clear()
ax = plt.axes()
ax.set_yscale("log")
ys =[7, 1]
ax.errorbar(xs, ys,fmt="o-", yerr=errs)
ax.errorbar(xs, ys2,fmt="o-")
fig.savefig('mini1.png')

Actual outcome

mini0

mini1

Expected outcome

I expected the errorbar in mini0 for the first point to be as in mini1, not going to 0. As in my use case not plotting the point at 0 in logscale made sense I didn't expected it to impact the previous point error bar.

Operating system

No response

Matplotlib Version

3.4.3

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Other libraries

No response

Installation

No response

Conda channel

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions