Bug summary
I'm plotting some log-scale data with ax.errorbar. If I plot first and then call ax.set_[x/y]scale, autolimits work as expected. However, switching the order (first setting the scale, then plotting the errorbars) leads to incorrect autolimits.
Code for reproduction
import numpy as np
from matplotlib import pyplot as plt
x = 10 ** np.array([18, 18.1, 18.2, 18.3])
y = np.array([100, 80, 60, 30])
yerr = np.ones_like(y) * 10
fig, ax = plt.subplots()
ax.set_xscale("log")
ax.set_yscale("log")
ax.errorbar(x, y, yerr=yerr)
fig.savefig("test.png")
Actual outcome
Both x and y axes have lower limits at 1. Upper limits seem correct.
Expected outcome
If I call set_*scale after plotting, everything works as expected:
The same plot should be produced by the MRE script above.
Additional information
No response
Operating system
Ubuntu
Matplotlib Version
3.10.8, also occurred on 3.10.5
Matplotlib Backend
agg
Python version
3.13.7
Jupyter version
No response
Installation
pip
Bug summary
I'm plotting some log-scale data with
ax.errorbar. If I plot first and then callax.set_[x/y]scale, autolimits work as expected. However, switching the order (first setting the scale, then plotting the errorbars) leads to incorrect autolimits.Code for reproduction
Actual outcome
Both x and y axes have lower limits at 1. Upper limits seem correct.
Expected outcome
If I call
set_*scaleafter plotting, everything works as expected:The same plot should be produced by the MRE script above.
Additional information
No response
Operating system
Ubuntu
Matplotlib Version
3.10.8, also occurred on 3.10.5
Matplotlib Backend
agg
Python version
3.13.7
Jupyter version
No response
Installation
pip