Deprecate MathTextParser("bitmap") and associated APIs.#18591
Deprecate MathTextParser("bitmap") and associated APIs.#18591tacaswell merged 1 commit intomatplotlib:masterfrom
Conversation
| self._mathtext_parser = mathtext.MathTextParser('bitmap') | ||
| img, _ = self._mathtext_parser.parse(lev, dpi=72, | ||
| prop=self.labelFontProps) | ||
| self._mathtext_parser = mathtext.MathTextParser('agg') |
There was a problem hiding this comment.
this specific use is going away via #16171.
8e370a2 to
0bc633b
Compare
|
It appears that |
|
You could wrap the call to |
|
Yes, that should go in the deprecation note, maybe as a longer example. |
|
done |
0bc633b to
ef15c5a
Compare
`MathTextParser("bitmap")` is rather low-level APIs to convert text
strings to images. Instead, one can use a much more generic method,
namely directly drawing to a new Figure() and saving with
`bbox_inches="tight"`. Alternatively, if one really wants a single
function call, there's still `mathtext.math_to_image`.
Also fix the wx example to use light text colors when so directed by the
system theme.
ef15c5a to
5ce4ff2
Compare
| from matplotlib.transforms import IdentityTransform | ||
|
|
||
|
|
||
| def text_to_rgba(s, *, dpi, **kwargs): |
There was a problem hiding this comment.
Why not use math_to_image here?
tacaswell
left a comment
There was a problem hiding this comment.
👍
Why not use math_to_image in both of the examples?
|
Because it's a super-specialized API which I don't think is particularly interesting to demonstrate (or even to expose), whereas drawing on a figure and saving with tight bbox works for basically anything you may want to draw -- including text, but not only that! |
MathTextParser("bitmap")is rather low-level APIs to convert textstrings to images. Instead, one can use a much more generic method,
namely directly drawing to a new Figure() and saving with
bbox_inches="tight". Alternatively, if one really wants a singlefunction call, there's still
mathtext.math_to_image.Also fix the wx example to use light text colors when so directed by the
system theme.
PR Summary
PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsandpydocstyle<4and runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).