I recently come across plotly which is a very powerful interactive online plot system. So i was thinking converting plots generated by matplot into plotly. Everything works fine except for the time series plot.
here is a simple version of my code.
import pandas as pd
import matplotlib.pyplot as plt
import plotly.plotly as py
import plotly.tools as tls
tls.set_credentials_file(
username="edwinwang1988",
api_key="o8xw6s61dn")
import numpy as np
x = pd.date_range('1/1/2001',periods =72,freq='D') # genrate a date range
Series = pd.DataFrame(x,columns=['Date']) # generate a date range data frame
np.random.seed(0)
col = ['A','B','C','D'] #set col names for return series
s = pd.DataFrame(np.random.randn(72,4),columns=col) # generate random return series with col names as col
for i in range(len(col)):
s[col[i]] = s[col[i]].cumsum()
s['Date']=x # add date to dataframe s
s.plot(x='Date') # plot s and set date as x axis
this works fine and give me the plot i want with date as x axis. but when i tried to convert the figure to plotly.
mpl_fig2= plt.gcf()
py.iplot_mpl(mpl_fig2,strip_styple = True,filename='test')
i am seeing code error like "min() arg is an empty sequence" and sometimes this "year=1 is before 1900; the datetime strftime() methods require year >= 1900"