Skip to content

logitlocator misses tick at edge of axis #14743

Open

Description

@anntzer

Bug report

Bug summary

When no data is plotted, a logit scale ignores calls to set_{x/y}lim and sticks to the default(?) of [1e-7, 1-1e-7]


edit: fixed, but see follow up at #14743 (comment).

Code for reproduction

gca().set(yscale="logit", ylim=(.9, .999))  # or (.001, .1), or etc.

Actual outcome

test

This image is made with the formatter provided by #14512 for legibility (the formatter before that PR is impossible to read), but that doesn't change the axes limits.

Expected outcome

limits respecting the set ylims.
Note that adding a call to e.g. plot(<any values>) (within or without the given limits) fixes the issue.

Matplotlib version

  • Operating system: linux
  • Matplotlib version: 3.1 or master, perhaps earlier?
  • Matplotlib backend (print(matplotlib.get_backend())): any
  • Python version: 3.7
  • Jupyter version (if applicable):
  • Other libraries:

Activity

  1. lukelbd commented on Aug 8, 2019

    @lukelbd
    Contributor

    This issue seems to be more complicated. When I try to explicitly set the axis limits, axis limits revert to the default (i.e. the opposite of what I want). This is independent of whether I run a plot command afterward. Also the default range is too large and default number of ticks is too high.

    import matplotlib.pyplot as plt
    import numpy as np
    f, ax = plt.subplots()
    N = 50
    ax.set_yscale('logit')
    # ax.set_ylim((0.1,0.9))
    ax.plot(np.linspace(0,1,N), np.linspace(0.1,0.9,N))

    bug2

    import matplotlib.pyplot as plt
    import numpy as np
    f, ax = plt.subplots()
    N = 50
    ax.set_yscale('logit')
    ax.set_ylim((0.1,0.9))
    ax.plot(np.linspace(0,1,N), np.linspace(0.1,0.9,N))

    bug1

  2. timhoffm commented on Aug 10, 2019

    @timhoffm
    Member

    As of master, the results are
    grafik

    grafik

    So at least the number of ticks issue is solved (cf. #14512).

  3. added this to the v3.2.0 milestone on Sep 10, 2019
  4. modified the milestones: v3.2.0, v3.3.0 on Sep 10, 2019
  5. anntzer commented on Sep 10, 2019

    @anntzer
    ContributorAuthor

    The original issue was fixed in #14928, but there's a small followup: when doing gca().set(yscale="logit", ylim=(.9, .999)), there is no tick at x=0.999, but it shows up if the upper limit is 0.999001 for example. Probably just a matter of < vs <=...

  6. changed the title [-]logit scale ignores limits when no data is plotted[/-] [+]logitlocator misses tick at edge of axis[/+] on Sep 10, 2019
  7. RiazCharania commented on Mar 2, 2020

    @RiazCharania

    Is anyone else currently working on this? If not I'll give it a try.

  8. timhoffm commented on Mar 4, 2020

    @timhoffm
    Member

    Go for it.

  9. 5 remaining items

  10. modified the milestones: v3.5.0, v3.6.0 on Sep 25, 2021
  11. oscargus commented on Jun 4, 2022

    @oscargus
    Member

    The remaining example gca().set(yscale="logit", ylim=(.9, .999)) now gives:
    image

    which seems different from the description, but hardly correct.

  12. anntzer commented on Jul 15, 2022

    @anntzer
    ContributorAuthor

    I think that's what I said: a tick is missing at the top (1-1e-3).

  13. modified the milestones: v3.6.0, v3.7.0 on Aug 24, 2022
  14. modified the milestones: v3.7.0, v3.7.1 on Feb 14, 2023
  15. modified the milestones: v3.7.1, v3.7.2 on Mar 4, 2023
  16. modified the milestones: v3.7.2, v3.7.3 on Jul 5, 2023
  17. modified the milestones: v3.7.3, v3.8.0 on Sep 9, 2023
  18. removed this from the v3.8.0 milestone on Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions