diff --git a/examples/api/engineering_formatter.py b/examples/api/engineering_formatter.py index a2c5d3003b16..dac48d074bd7 100644 --- a/examples/api/engineering_formatter.py +++ b/examples/api/engineering_formatter.py @@ -7,13 +7,15 @@ from matplotlib.ticker import EngFormatter +prng = np.random.RandomState(123) + fig, ax = plt.subplots() ax.set_xscale('log') -formatter = EngFormatter(unit='Hz', places=1) +formatter = EngFormatter(unit='Hz') ax.xaxis.set_major_formatter(formatter) xs = np.logspace(1, 9, 100) -ys = (0.8 + 0.4*np.random.uniform(size=100))*np.log10(xs)**2 +ys = (0.8 + 0.4 * prng.uniform(size=100)) * np.log10(xs)**2 ax.plot(xs, ys) plt.show()