-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
savefig
has sideeffects
#6899
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
Comments
.... what? Impressive work tracking this down. |
😱 |
I was just getting ready to create an issue with test cases. I'm seeing savefig side effects with 2.0.0b4 Is this fix in that version? |
No, the issue is still open. It is a complex problem and I have not updated the ticket with my findings because fixing it reveals other bugs. In the current state it affects only automatic legend placement and the difference is about 0.3-0.5px, so it is not a major for the most of the user. |
In my investigation of image comparison fails with pytest and xdist plugin I have discovered strange behavior. By changing the extensions order of the image comparison tests you will receive different output (and of course test failures).
I made extensions shuffle like this and got these results. From the log you can see that mostly affected are legend tests on svg backend. So any baseline image from the tests with
legend
call is spoiled by pdf backend, except thelegend
+tightbox
.I tried to compare figure state before and after
savefig
call but run into issue #6870.Here is the way to reproduce the problem. You can compare output of the snippet with baseline images of
matplotlib.tests.test_legend.test_legend_auto1
test, if you want.This is the demonstration of the issue, where
savefig
with pdf backend has sideeffect on the nextsavefig
with svg backend:Same happens to pdf after svg.
By accident, while fixing issue #6870, it seems that I have fixed this too. Test above now passes but there are 505 SVG baseline images affected and need update. I will open PR for this soon.
The text was updated successfully, but these errors were encountered: