Search code examples
pythonplotly

Plotly small numbers as power


I am using plotly to plot data (small numbers - piko and nano) and I change a format of yaxes on "power".

fig.update_yaxes(exponentformat = 'power')

And I wonder if I can change the display of y-axis ticks? I would like to see 1.2 instead of 1.2x10 ^ -12 and a power at the top of the axis.


Solution

  • import numpy as np
    import plotly.express as px
    
    px.line(y=np.linspace(10**-12, 10**-9, 20)).update_yaxes(exponentformat = 'power', showexponent="last")
    

    enter image description here