Using matplotlib, I would like to write text on my graphs, which are displayed in the usual scientific notation, for example, as 1.92x10 -7 instead of the standard 1.92e-7. I found help on how to do this for numbers representing ticks on axes, but not for a text function. Here is an example of my code that I would like to modify:
import numpy as np import matplotlib.pyplot as plt x = np.linspace(0,0.5) y = x*(1.0-x) a=1.92e-7 plt.figure() plt.plot(x, y) plt.text(0.01, 0.23, r"$a = {0:0.2e}$".format(a), size=20) plt.show()
python matplotlib
Dave JPNY
source share