How to interpret this matplotlib's plot scale?

Viewed 37

The y-axis shows 1e-17+2e-4. not sure how to interpret this.

enter image description here

1 Answers

a value of y equals y * 1e-17 + 2e-4

see documentation:

Offset notation and scientific notation

Offset notation and scientific notation look quite similar at first sight. Both split some information from the formatted tick values and display it at the end of the axis.

The scientific notation splits up the order of magnitude, i.e. a multiplicative scaling factor, e.g. 1e6.

The offset notation separates an additive constant, e.g. +1e6. The offset notation label is always prefixed with a + or - sign and is thus distinguishable from the order of magnitude label.

You can control the usage of offsets with set_useOffset:

import matplotlib.pyplot as plt

fig, ax = plt.subplots(ncols=2, layout='constrained')
fig.suptitle('Both y-axes have equal scales:')

ax[0].set_ylim(.200001, .200010)

ax[1].set_ylim(.200001, .200010)
ax[1].yaxis.get_major_formatter().set_useOffset(False)

enter image description here

Related