1

I am planning to use plotly and plot value from a number to .k, for example, the value showed on the chart is like 8247294, and I want it to show like 8.25M

I tried something like this:

x = [x for x in range(1,len(table))] #date
y = table['revenue'].values.tolist()

fig = go.Figure(go.Scatter(x=x, y=y,text=y,mode="lines+markers+text",
                line=dict(color='firebrick', width=4)))
fig.update_layout(width=900,height=650)

fig.update_layout(
      tickformat='k') 

It is not working.So what's the correct way of doing it?

qwer1234
  • 257
  • 2
  • 9
  • what is the error that you are getting ? – Madhur Yadav Jul 20 '19 at 09:15
  • Sorry I didn't explain it clearly. the value showed on the chart is like 8247294, and I want it to show like 8.25M – qwer1234 Jul 20 '19 at 09:18
  • Did you try to copy-paste an example and adapt it to your needs? https://plot.ly/python/v3/tick-formatting/ Looks like there's plenty of flexible formatting options, including setting tick labels manually – Yuri Feldman Jul 20 '19 at 09:31
  • At the moment there's no functionality for processing the data passed to `text`: it is displayed as-is. An upcoming version of Plotly.py will support this, however, as it is being implemented in the underlying Plotly.js library this week. – nicolaskruchten Jul 21 '19 at 19:18

0 Answers0