Skip to content

AutoDateLocator docs has a typo #17643

Closed

Description

@ysBach

Bug report

Bug summary

Unlike the doc, the intervd dictionary has keys of integers, so the example in the doc ("only show every 3 hours") did not work.

Code for reproduction

import matplotlib.dates as mdates
locator = mdates.AutoDateLocator()
print(locator.intervald)

Actual outcome

{
0: [1, 2, 4, 5, 10, 20, 40, 50, 100, 200, 400, 500, 1000, 2000, 4000, 5000, 10000], 
1: [1, 2, 3, 4, 6], 
3: [1, 2, 4, 7, 14, 21], 
4: [1, 2, 3, 4, 6, 12],
5: [1, 5, 10, 15, 30], 
6: [1, 5, 10, 15, 30], 
7: [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000]
}

Expected outcome

{
    YEARLY  : [1, 2, 4, 5, 10, 20, 40, 50, 100, 200, 400, 500,
               1000, 2000, 4000, 5000, 10000],
    MONTHLY : [1, 2, 3, 4, 6],
    DAILY   : [1, 2, 3, 7, 14],
    HOURLY  : [1, 2, 3, 4, 6, 12],
    MINUTELY: [1, 5, 10, 15, 30],
    SECONDLY: [1, 5, 10, 15, 30],
    MICROSECONDLY: [1, 2, 5, 10, 20, 50, 100, 200, 500,
                    1000, 2000, 5000, 10000, 20000, 50000,
                    100000, 200000, 500000, 1000000],
}

Matplotlib version

  • Operating system: macOS 10.14.6
  • Matplotlib version: 3.2.1
  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline
  • Python version: 3.7.7
  • Jupyter version (if applicable):
jupyter core     : 4.6.3
jupyter-notebook : 6.0.3
qtconsole        : 4.7.4
ipython          : 7.13.0
ipykernel        : 5.1.4
jupyter client   : 6.1.3
jupyter lab      : 1.2.6
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 5.0.6
traitlets        : 4.3.3
  • Other libraries:

Activity

  1. ysBach commented on Jun 16, 2020

    @ysBach
    Author

    Oh my bad, it imports (in the source code)

    from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY,
                                MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY,
                                SECONDLY)

    So it's not a typo. I thought string like keyword for the dict such as intervd["HOURLY"], but it was not.

    But I guess a bit of explanation in the doc may be helpful :)

  2. added this to the v3.3.0 milestone on Jun 18, 2020
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