-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
latex_to_png: avoid deprecated matplotlib functions #12889
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick feedback - I don't feel qualified enough for approving this, but I hope it will help @Carreau with merging / reviewing it further:
Using the snippet provided in the original issue I created two PNGs, one from ipython:master
and one from jakevdp:mathtext
- I can confirm that this PR does indeed get rid of the deprecation messages
- The two files I get differ in the image size:
master
gives me 74x23, the code from this PR - 71x21. Not sure if it's important, might be something to look into.
Thanks for checking on this – I've seen this difference in image size as well. I suspect that's the difference between the I'm going to mark this as a draft for now and see if I can improve on that. |
The test failures are unrelated, are are regular on those tests; so feel free to ignore those, I'll probably end up marking them as knowfail. @jakevdp if you are a regular user of this feature and are happy with the result; we can trust you. Let us know if it should be backported on 7.x. |
Thanks! I'm not yet happy with the result, but I'm hoping to dig-in again shortly 😁 |
OK - I adjusted the dpi in the width/height calculation and I think this is ready to go. |
Thanks Jake, I've maker this as 8.0, if it become which I hope we can start to push forward and release in a coupl eof month, if this becomes too annoying we can still backport later. Thanks. |
Temporary workaround (from computationalmodelling/nbval#167): import warnings
from matplotlib import MatplotlibDeprecationWarning
warnings.filterwarnings('ignore', category=MatplotlibDeprecationWarning) |
…cy and fix check() What a mess in tests LOL! Related tickets: [1] computationalmodelling/nbval#162 [2] computationalmodelling/nbval#167 [3] ipython/ipython#12817 [4] ipython/ipython#12889 [5] ipython/ipykernel#591 [6] matplotlib/matplotlib#20046 git-svn-id: file:///srv/repos/svn-community/svn@994636 9fca08f4-af9d-4005-b8df-a31f2cc04f65
…cy and fix check() What a mess in tests LOL! Related tickets: [1] computationalmodelling/nbval#162 [2] computationalmodelling/nbval#167 [3] ipython/ipython#12817 [4] ipython/ipython#12889 [5] ipython/ipykernel#591 [6] matplotlib/matplotlib#20046 git-svn-id: file:///srv/repos/svn-community/svn@994636 9fca08f4-af9d-4005-b8df-a31f2cc04f65
Fixes #12882
The replacement function recommended by matplotlib,
mathtext.math_to_image
, does not provide sufficient control over the output (e.g. text color, transparent background, dpi), so this PR adds code that creates the image manually following the approach in that function.