FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Figures not correctly displaying grid lines for minor ticks · Issue #16339 · matplotlib/matplotlib · GitHub

Repository navigation

Figures not correctly displaying grid lines for minor ticks #16339

Closed

Description

Bug report

Bug summary

Figures not correctly showing grid for minor ticks on one axis.
Code for reproduction

x = np.arange(0,100,.5)
y = 2*x**3

plt.loglog(x,y)
plt.minorticks_on()
plt.grid(True,which="both", axis="both",ls="-")
plt.show()

Actual outcome

Expected outcome
The Y axis should have minor ticks and their corresponding grid lines.

Matplotlib version

  • Operating system: ArchLinux (5.4.6-arch3-1)
  • Matplotlib version: 3.1.2
  • Matplotlib backend (print(matplotlib.get_backend())): agg
  • Python version: 3.8.1
  • Jupyter version (if applicable):
  • Other libraries:

Installed via pip

Activity

  1. ImportanceOfBeingErnest commented on Jan 27, 2020

    Member

    A workaround would be to use a custom locator

    locmin = matplotlib.ticker.LogLocator(base=10.0,subs=(0.2,0.4,0.6,0.8),numticks=12)
    ax.yaxis.set_minor_locator(locmin)
    

    So the question is, if setting the ticks on via ax.minorticks_on() would be expected to superseed the log locator's choice not to show minor ticks in case the axis range is large (and the absolute axes size small).

  2. timhoffm commented on Jan 27, 2020

    Member

    My first guess is that explicitly setting minor ticks should be respected. But I‘m not clear if there are fundamental reasons the log locator would want to override this. If we‘re deciding to not follow minorticks_on, we should at least issue a warning about that.

  3. jklymak commented on Jan 27, 2020

    Member

    The minor locator is being called. It’s just not finding any ticks we could change the minor locator.

  4. ImportanceOfBeingErnest commented on Jan 27, 2020

    Member

    There is a bit of history to this through #5161, #7000, #7419, #8111, #12865.
    The problem is that the locator determines if there are minor ticks to be shown or not and reading through the above issues/PRs it does that for good reasons. E.g. for small ranges you would need minor ticks, even if they haven't been turned on explicitely, but for large ranges minor ticks would overcrowd the axes; also, as seen in issue #8111 one needs to be a bit careful which minor ticks to show.

    To me it looks like fixing this would require the locator to query the axes if minor ticks have been set on explixitely by the user and then come up with a logic for which minor ticks to show in such case where major ticks are more than a decade away from each other.

  5. oscargus commented on Jun 4, 2022

    Member

    This seems to have been solved at some stage. With the current main branch this gives:

    I'm closing this, but feel free to reopen if there are still issues.

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


      Back | FazBrowse Home | New Git URL