matplotlib / matplotlib Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clf() and cla() throws warnings with shared loglog plots. #9970
Comments
fig.clf() will do a ax1.cla(). So the real culpit is ax1.cla(). So there are 2 problems here. 1) Why should fig.clf() clear axes as well. It should just clear the axes from the figure and not clear the axes itself. |
This bug is still present in Matplotlib 2.2 |
This bug still persists in Matplotlib 3.3 |
You are trying to plot 0 on a loglog plot so you get a warning. I am not sure what the bug is. |
Yes, but probably other than you think
Ingedients you need:
I suspect this has to do something with
Given that this only happens when you clear a non-shown figure (that also needs certain further properties), I'd be fine with closing as "won't fix". |
Actually the warning shows up even if the figure is shown (e.g. if you type @timhoffm's lines one after the other at an IPython prompt). AFAICT the root cause is that Also there's some funky asymmetry which makes if self._sharex is not None:
self.sharex(self._sharex)
else:
self.xaxis._set_scale('linear')
try:
self.set_xlim(0, 1)
except TypeError:
pass so things behave differently between the master axes (which has |
import warnings
warnings.filterwarnings("ignore", message="Attempted to set non-positive left xlim on a log-scaled axis.\nInvalid limit will be ignored.") Ignore the warning as above. |
It would be great to have this fixed! It's raising warnings in our test script which is like this:
|
Throws a warning:
UserWarning: Attempted to set non-positive xlimits for log-scale axis; invalid limits will be ignored.
'Attempted to set non-positive xlimits for log-scale axis;
ax1.cla() also throws a warning.
Matplotlib version
2.1.0,
python 3.6.3
ipython 6.1.0
The text was updated successfully, but these errors were encountered: