Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AutoDateLocator docs has a typo #17643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ysBach opened this issue Jun 16, 2020 · 1 comment · Fixed by #17664
Closed

AutoDateLocator docs has a typo #17643

ysBach opened this issue Jun 16, 2020 · 1 comment · Fixed by #17664

Comments

@ysBach
Copy link

ysBach commented Jun 16, 2020

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:
@ysBach
Copy link
Author

ysBach commented Jun 16, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants