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

Number of ticks for dates still gives overlapping labels · Issue #7712 · matplotlib/matplotlib · GitHub

Repository navigation

Number of ticks for dates still gives overlapping labels #7712

Closed

Description

Matplotlib 2.0 introduced better default tick locators to have a better (often less) number of ticks (http://matplotlib.org/devdocs/users/dflt_style_changes.html#number-of-ticks) that prevents overlap of ticklabels. Which is a really nice enhancement, only it seems that this enhancement is not working for datetime tick labels:

>>> import matplotlib
>>> import matplotlib.pyplot as plt
>>> matplotlib.__version__
'2.0.0rc2'
>>> import datetime
>>> dates = [datetime.datetime(2016,1,i) for i in range(1,30)]
>>> values = list(range(1,30))
>>> plt.plot(dates, values)
[<matplotlib.lines.Line2D object at 0x7f41327d2e80>]
>>> plt.show()

This still gives the 'too much' tick labels like before (actually, the same plot but with integer x values gives fewer ticks).

Is there a technical reason for this? (the DateLocator using another mechanism to determine the number of ticks as the default AutoLocator)

Matplotlib 2.0.0rc2 (installed from conda-forge)

Activity

  1. efiring commented on Dec 31, 2016

    Member

    The AutoDateLocator uses a completely different mechanism to set the default max number of ticks. It has an internal table of max numbers depending on the unit of time it is working with, and there is no consideration of the physical size of the axis or of the font size. You can supply a max that overrides the default. You can also slant the tick labels as in http://matplotlib.org/devdocs/examples/api/date_demo.html.

    I think that there is considerable room for improvement in the way we handle datetime ticking and labeling, but it needs to be left as a project for after the v2.0 release.

  2. added this to the milestone on Dec 31, 2016
  3. patniharshit commented on Mar 1, 2017

    Contributor

    I would like to work on the issue. Where should I start with this?

  4. Shang-Jia commented on Mar 6, 2017

    Modified the AutoDateLocator to use the largest possible tickable size rather than the smallest. Should I submit a pull request? And what testcases/if any should be written for this?

  5. ParagBh commented on Mar 6, 2017

    @Shang-Jia

    How did you get the daily interval to be every 6 days? If you look at the value of DAILY inside the self.intervald dictionary, the intervals can within a month can only be every 1, 2, 3, 7, 14, or 12 days because DAILY: [1,2,3,7,14,21]. So shouldn't the interval be either 1, 2, 3, 7, 14, and 21 and not 6? Please, correct me if I'm wrong.

  6. ParagBh commented on Mar 6, 2017

    I think I may have a solution for this one but not sure if it's right. How exactly do I write testcases for this?

  7. Shang-Jia commented on Mar 6, 2017

    Yeah, I was playing around with differing minticks and intervals as well

  8. modified the milestones: , on Oct 3, 2017
  9. jklymak commented on Jan 28, 2019

    Member

    I'm going to close this as partially obviated by #10841. That new formatter is not the default, but does give the user a way to have more compact date labels.

    In general, its going to be hard to make tick locating depend on tick formatting.

  10. modified the milestones: needs sorting, v3.1 on Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL