0

I'd like to know how I can prevent that the scientific notation (especially the fact that there is a sum of two numbers in scientific notation, which seemed weird to me) on the top of my plot appears.

I'd try to plot some data which has a finite real part and no imaginary part (all these values are zero). Therefore I expected the plot to do no weird things And so I can't figure out matplot.lib decides to plot this sum above my plot.

enter image description here

  • I'm not sure what are the actual numbers that are being plotted (it would be clearer if they would be included in the question), but if it is actually like 10**(-8) then you could plot normalized values (i.e., values * 10**8). – dimnnv Dec 04 '22 at 13:51
  • The values range from: 0.09768862 to 0.09768863 – I Need your help Dec 04 '22 at 14:09
  • You can try setting the ticks manually if automatic fails for some reason. I think something like plt.yticks([0.09768862,0.097688622,0.097688624,0.097688626,0.097688628,0.09768863]) might help. However it is not very convenient as the y-number contains a lot of leading digits that are not changing in the plot. I think it's better to consider plotting some other value (e.g. y = y0 + delta_y) depending on the context of your problem. In this case delta_y could start with 0. – dimnnv Dec 04 '22 at 14:17
  • 1
    `ax.ticklabel_format('y', useOffset=False)` see [docs](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.ticklabel_format.html#matplotlib.axes.Axes.ticklabel_format) – Stef Dec 04 '22 at 16:59
  • 1
    btw, newer versions of matplotlib (~3.6.0 and above) should move the title up to prevent overlapping with the axis offset – Stef Dec 04 '22 at 17:01

0 Answers0