79111774

Date: 2024-10-21 21:16:00
Score: 0.5
Natty:
Report link

Using matplotlib.ticker can provide a solution indeed.

formatter = ticker.ScalarFormatter(useOffset=True, useMathText=True)
formatter.set_scientific(True)
formatter.set_powerlimits((-3, 4))  # define when to apply scientific notation

axs[i].xaxis.set_major_formatter(formatter)
axs[i].yaxis.set_major_formatter(formatter)

powerlimits defines which numbers are shown in scientific and which in decimal notation, referring to the exponents of 10. Outside the interval it will be scientific, inside decimal.

Resulting in: enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Márton Horváth