Skip to content

Number of ticks for dates still gives overlapping labels #7712

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

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()

figure_1-2

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions