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

Skip to content

Supported datetimes with microseconds, and those with long time series (>160 years).#1925

Merged
efiring merged 4 commits intomatplotlib:masterfrom
pelson:long_timeseries_plots
May 20, 2013
Merged

Supported datetimes with microseconds, and those with long time series (>160 years).#1925
efiring merged 4 commits intomatplotlib:masterfrom
pelson:long_timeseries_plots

Conversation

@pelson
Copy link
Copy Markdown
Member

@pelson pelson commented Apr 19, 2013

This pull request updates the AutoDateLocator and AutoDateFormatter classes to handle extreme time series (<1 second and >160 years).

The follow code demonstrates the problems:



import datetime as dt
import numpy as np
import matplotlib.pyplot as plt


d1 = dt.datetime(1990, 1, 1)

if False:
    n = 365 * 200
    x = np.array([d1 + dt.timedelta(days=i) for i in range(n)], dtype=object)
else:
    n = int(1e4)
    x = np.array([d1 + dt.timedelta(microseconds=i * 10) for i in range(n)], dtype=object)

y = np.sin(np.linspace(0, np.pi * 2, n))

plt.figure(figsize=(12, 6))
plt.plot(x, y)

ax = plt.gca()
dt_loc = ax.xaxis.get_major_locator()
plt.show()

(try running this before this PR to see the improvement)

Comment thread lib/matplotlib/dates.py Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo: nonsigular => nonsingular

@pelson
Copy link
Copy Markdown
Member Author

pelson commented Apr 25, 2013

Thanks @NelleV - I've added a commit which addresses your comments.

@NelleV
Copy link
Copy Markdown
Member

NelleV commented Apr 25, 2013

LGTM 👍 for merge !

Comment thread lib/matplotlib/dates.py Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: singular

@pelson
Copy link
Copy Markdown
Member Author

pelson commented May 14, 2013

Thanks @efiring - I've done all of the above. The dates module is also now completely pep8 compliant.
I've also removed the pdf and svg testing, which was not adding any value to the test suite (other than testing the svg and pdf backends which are being tested elsewhere).

I think this is good to go.

@mdboom
Copy link
Copy Markdown
Member

mdboom commented May 14, 2013

There are some Travis failures here, but once those are resolved, I think this looks good.

@pelson
Copy link
Copy Markdown
Member Author

pelson commented May 17, 2013

I've updated the failing test result (and removed the formats which are not exercising anything new).

@pelson
Copy link
Copy Markdown
Member Author

pelson commented May 20, 2013

Again, I think this is good for merge.

efiring added a commit that referenced this pull request May 20, 2013
Supported datetimes with microseconds, and those with long time series (>160 years).
@efiring efiring merged commit f30dc0a into matplotlib:master May 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants