Adjust exponent text after setting scientific limits on matplotlib axis

后端 未结 5 989
旧时难觅i
旧时难觅i 2020-12-05 16:13

At the moment if I set matplotlib y axis ticklabels to scientific mode it gives me an exponent at the top of the y axis of the form 1e-5

I\'d like to ad

5条回答
  •  孤城傲影
    2020-12-05 16:50

    Add two lines in your code

    import matplotlib.ticker as ptick
    ax.yaxis.set_major_formatter(ptick.ScalarFormatter(useMathText=True)) 
    

提交回复
热议问题