I am trying to plot an line graph which has timestamp on x-axis and count on y-axis. The output of matplotlib plot is stored in an html file using mpld3 save_html() method. when the code is run on windows platform, the output is rendered as follows:
windows output ( html rendering- correct output)
However my code needs to run on Amazon cloud ( Arch linux) where it outputs the x-axis ticks as unsigned int as shown below ( graph looks different as it was taken some minutes later):-
Looking for experts guidance here on why it is not showing the actual date/timestamp.
I am posting the code below which a small change. My datasource with timestamp is locally defined. Everything else is the same. Note that this won't render the same graph as above as the datasource is different.
fig2,ax2=plt.subplots()
dsize=fig2.get_size_inches()
fig2.set_size_inches((dsize[0]/2)*(1.5),(dsize[1]/2)*(1.25))
data=pd.DataFrame([['2017-12-01 11:55:01',5],['2017-12-01 13:55:03',10],['2017-12-01 16:55:01',3],['2017-12-01 16:55:01',12]],columns=['timestamp','count'])
tt=data['timestamp'].apply(lambda x: datetime.strptime(x,"%Y-%m-%d %H:%M:%S"))
tt1=tt.apply(lambda x: datetime(x.year,x.month,x.day,x.hour))
x=[i for k,i in enumerate(tt1)]
print (x)
y=[i for k, i in enumerate(data['count'])]
print(y)
ax2.minorticks_off()
ax2.tick_params(axis='x', which='major', pad=15)
plt.xticks(rotation=90)
line, =ax2.plot(x,y)
ax2.set_xlabel('Date')
ax2.set_ylabel('Count of Anomalies')
line.set_color("Red")
mpld3.save_html(fig2,'test2.html')