Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Better choice of axes offset value #5755

Copy link
Copy link
Closed
@anntzer

Description

@anntzer
Issue body actions

Currently, when setting xlim(1231, 1239), the offset text is "+1.231e3" and the x labels are 0, ..., 8. I would suggest switching this to +1230 and x labels being 1, ..., 9. There is a formatting issue (basically using "%g" instead of "%f"), but I want to concentrate here on the actual value of the offset.

Basically, I think a reasonable algorithm for the choice of the offset value is the following:
(1) if xmin and xmax have the same number of digits: use the longest common prefix of their string representations, padded by zeros (e.g. xyzabc .. xyzdef => xyz000).
(2) if they don't have the same number of digits (e.g. 9995 .. 10005), I see two possibilities: either fall back to using 9995 as base offset, or use 10000 as base offset in which case the x labels will go from -5 to +5. I tend to think the second option is better but it is true that negative labels can look weird.
(3) note that using negative labels is also an option in case (1) if the number of zeros in the padding is "large" relative to the x range, e.g. 12399995 .. 12400005: it may be better to use 12400000 as base offset and have x labels from -5 to +5 rather than 12300000 as base offset and have x labels from 99995 to 100005.

Thoughts?

Related to #4445, #4451, #5738.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.