-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use scalars below a certain exponent in labes of log-scales axis #6834
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
This one really makes clear how the vertical alignment is wrong for text with superscripts as I've been saying on gitter. |
This is probably the same root cause as #6847 |
@mdboom: Your fix for the x-axis aligment does indeed fix the issue here but also changes the aligmnent of labels in many other test images, and some of them look worse. Maybe we should review that in a different PR? |
@zblz This needs a rebase |
The alignment fix by @mdboom introduces changes in many many labels on the test images. I'm not sure about many of them and think this should be discussed in a separate PR. I propose to split the alignment fix into its own PR so we can discuss it independently. |
This is a reasonable proposal provide an option that some will like, but I am not comfortable with the extra complexity it adds to handle the positioning. It sounds like a better way to to do that is via positioning labels by their baseline, as suggested somewhere that I can't find right now. I'm open to arguments either way. |
This needs a rebase and a review, so I don't think it's going into 2.0. |
This looks like a neat feature! @zblz could you rebase it on to the current master branch? |
@dstansby - This is now rebased on master with tests updated for py.test. |
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.
Looks good to me, just needs a what's new entry.
Closing in favor of #8322 |
This is a restart of #4730 with the added functionality of the configuration through rcParams. There is a new rcParam called
axes.formatter.min_exponent
that sets the minimum exponent that will be formatted as10^{x}
. I have currently set the default to 0 to retain current behaviour of formatting everything as10^{x}
, including10^{0}
. A setting of 3 would reproduce the behaviour of @astrofrog's implementation in #4730.The remaining problem is the baseline for labels on the x axis. Because of the lack of exponent, they are aligned quite a bit higher that the rest of the labels, see below. @mdboom: Any idea on how to fix this? Is there a way to pass a minimum height for the text box from the formatter?