| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| 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.
Sorry, something went wrong.
|
It appears that math_to_image doesn't accept a colour like the deprecated methods do? |
Sorry, something went wrong.
|
You could wrap the call to math_to_image in a rc_context({"text.color": ...}): block. Do you want me to document that? |
Sorry, something went wrong.
|
Yes, that should go in the deprecation note, maybe as a longer example. |
Sorry, something went wrong.
|
done |
Sorry, something went wrong.
`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.
| 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?
Sorry, something went wrong.
There was a problem hiding this comment.
👍
Why not use math_to_image in both of the examples?
Sorry, something went wrong.
|
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! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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.
PR Summary
PR Checklist