PYTHON (Plotly) - Renaming axis ticks -


i have line graph have done matplotlib dataframe called linefgdf:

enter image description here

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:

enter image description here

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:

enter image description here

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.

enter image description here


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -