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

Plot_date default date format is not always the same · Issue #9765 · matplotlib/matplotlib · GitHub

Repository navigation

Plot_date default date format is not always the same #9765

Closed

Description

Bug report

Bug summary

In the example below date format is changed when plotting with plot_date after calling dates.DayLocator(). This can be fixed with using dates.DateFormatter(), but the confusion could be avoided if plot_date uses the same date format when it is not specified by user.

Code for reproduction

import datetime
import matplotlib.pyplot as plt
import matplotlib.dates as mdates

DATE1 = mdates.date2num(datetime.datetime(2017, 8, 10, 18, 0))
DATE2 = mdates.date2num(datetime.datetime(2017, 8, 11, 18, 0))
DATE3 = mdates.date2num(datetime.datetime(2017, 8, 12, 18, 0))
plt.plot_date([DATE1, DATE2, DATE3], [1, 2, 3], '-')
plt.show()

plt.plot_date([DATE1, DATE2, DATE3], [1, 2, 3], '-')
plt.gca().xaxis.set_major_locator(mdates.DayLocator())
plt.show()

Actual outcome

Matplotlib version

  • Operating system: Mac OS
  • Matplotlib version: 2.0.2
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version: 2.7.13
  • Jupyter version (if applicable):
  • Other libraries:

Activity

  1. story645 commented on Nov 15, 2017

    Member

    I sort of thing this should be generalized to plot_date should default to include the resolution of the ticks (or at least only one level higher). Like since it's a day locator, the ticks should include the days, it it was a month locator, it should id the months, etc...

  2. jklymak commented on Mar 24, 2018

    Member

    Cross ref #10841

  3. timhoffm commented on Jul 16, 2020

    Member

    Apparently fixed. As of current master, the ticks include the days.

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL