Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Plotting data with datetimes #26

Open
StephanieWillis opened this issue Jun 6, 2018 · 1 comment
Open

Plotting data with datetimes #26

StephanieWillis opened this issue Jun 6, 2018 · 1 comment

Comments

@StephanieWillis
Copy link

The plotting library doesn't seem to work when I try and plot a datetime object. It can handle just dates but when there is an associated time the plot builds without error but no line is plotted.

Code here that doesn't work:

import pandas as pd
import matplotlib.pyplot as plt
import pdvega

rng = pd.date_range('1/1/2011', periods=72, freq='H')
rng = [pd.Timestamp(r) for r in rng]
ts = pd.Series(np.random.randn(len(rng)), index=rng)

ts.vgplot.line() #this doesn't throw any errors but no data is shown

ts.plot() #this works on the other hand
plt.show()

@jakevdp
Copy link
Member

jakevdp commented Jun 6, 2018

Thanks – I think this has to do with the way temporal data is serialized to JSON.

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

No branches or pull requests

2 participants