| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I think I agree w. codecov that you should have an image test for this, but others may disagree. But otherwise looks good to me! |
Sorry, something went wrong.
|
I have added a test which doesn't rely on image comparison, I hope that's ok. |
Sorry, something went wrong.
There was a problem hiding this comment.
Subject to CI pass.
Sorry, something went wrong.
There was a problem hiding this comment.
Subject to CI
Sorry, something went wrong.
|
There is a difference between the use of tex for rendering fonts in a figure, which is controlled by the text.usetex rcParam, and the use of mathmode in tex, which, for the ScalarFormatter is controlled by ._usetex attribute. There is a premise inside the ScalarFormatter that sets those two equal. I.e. it assumes that if you are using tex to render text, you automatically want your labels in mathmode (encapsulated by $). I do not agree to this premise. Those are really separate things. Now the ScalarFormatter at least allows to set the ._usetex attribute in case you do not want to have your labels in math mode, just because you are using tex. |
Sorry, something went wrong.
|
I see your point. For now will it be sufficient to add self._usetex = rcParams['text.usetex'] to the __init__ for EngFormatter and use that to give user the choice of setting ._usetex to False? |
Sorry, something went wrong.
|
Well, it would be wrong IMO, but at least consistent with ScalarFormatter and hence allow to work around it. So if noone wants to tackle the underlying problem of usetex vs usemath in the near future, I would very much favour the use of something like self._usetex = rcParams['text.usetex'] in the __init__ method. |
Sorry, something went wrong.
|
ok. I will push a temporary fix (adding self._usetex = rcParams['text.usetex']) for now and try to work on separating the usetex vs usemath logic. |
Sorry, something went wrong.
|
I don’t see that adding a private method to give users more control is quite the right solution here! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
ScalarFormatter correctly formats the numbers in ticklabels using $ signs when used with usetex=True but EngFormatter doesn't do so (hence the numbers show up in "text font" instead of "math font"). This results in inconsistent fonts if one of the axes uses EngFormatter but the other one doesn't (see the example below). This PR fixes that by correctly formatting the numbers in ticklabels when EngFormatter is used.
One workaround (as suggested in a related issue #11586 (comment)) is to turn off usetex for the axis that uses ScalarFormatter so that both the axes show ticklables in "text font" (For example -- ax.yaxis.get_major_formatter()._usetex = False).
I think the solution suggested in this PR is much better since it results in consistent (and expected) behavior across different Formatters without having to use the non-public attribute ._usetex.
Before the PR:
After the PR:
PR Checklist