PYTHON (Plotly) - Renaming axis ticks -
i have line graph have done matplotlib dataframe called linefgdf:
the code used is:
fig, ax2 = plt.subplots(figsize=(15, 10)) x = linefdf[threeyr] x.plot(kind='line', marker='',color='#0c1e3c') plt.grid(color='#e5e0e0', linestyle=':', linewidth=0.8)
it produces this:
which great , can see months on x axis. however, want plotly can make interactive.
so found way of doing in plotly, months have gone , have been replaced numbers. how month labels back?
this code:
random_x = linefdf[threeyr] trace0 = go.scatter( y = random_x, mode = 'lines', name = 'lines' ) data = [trace0] plotly.offline.iplot(data, filename='line-mode')
which produces this:
specify x in trace0. set x equal the months see.
trace0 = go.scatter( x = ['jan','feb','ma','ap','may','jun'], y = [1,2,3,4,5,6], mode = 'lines', name = 'lines' )
results in graph.
Comments
Post a Comment