Skip to content

BUG: plotting daily data with two-day gaps #1668

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
lesteve opened this issue Jul 24, 2012 · 2 comments
Closed

BUG: plotting daily data with two-day gaps #1668

lesteve opened this issue Jul 24, 2012 · 2 comments

Comments

@lesteve
Copy link
Contributor

lesteve commented Jul 24, 2012

Hi,

you should be able to copy and paste this in a ipython --pylab session:

import pandas
index = pandas.date_range(start='2001-1-1', end='2001-1-10', freq='D')
data = index.day
ts = pandas.TimeSeries(index=index, data=data)
tsWithGaps = ts[:3].append(ts[5:])
figure()
tsWithGaps.plot(style='o')
figure()
tsWithGaps.asfreq('D').plot(style='o')

I tried this snippet with 0.8.2.dev-7c54141 (i.e. latest git version as I write). The two plots below come from an improved version of the snippet which prints the timeseries on the plot.

The first plot I get looks weird (wrong label for January 5th + double data point on the 8th)
http://imgur.com/LFJup,aYLYJ#0
The timeseries is printed on the plot and looks perfectly fine.

The second plot with the explicitly resampled ts is fine:
http://imgur.com/LFJup,aYLYJ#1

Trying to tweak the parameters a 3-day gap looks fine and you get x axis labelling like plt.plot_date. She 2-day gaps seems always broken, although in a more subtle way than the plot above (generally the label before the gap is wrong but I don't get double data points). It looks like a timeseries with 2-day gaps is close enough to a regular index timeseries (maybe because of week-ends) and the index labelling goes wrong somewhere.

@changhiskhan
Copy link
Contributor

Just put in a fix for this. Please give it a shot and let me know if it works on your end.
Thanks for the bug report

@lesteve
Copy link
Contributor Author

lesteve commented Jul 24, 2012

Just tried and it looks fine. Thanks a lot for the fix. I guess I can still explicitly resample the timeseries if I want to get the nicer scikits.timeseries style tick labeling.

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

No branches or pull requests

2 participants