pdvega
pdvega copied to clipboard
Plotting data with datetimes
trafficstars
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()
Thanks – I think this has to do with the way temporal data is serialized to JSON.