Skip to content

Commit 5ef5995

Browse files
authored
Merge pull request #7137 from afvincent/doc_engformatter_example
DOC: improve engineering formatter example
2 parents d1b837f + 54a67a6 commit 5ef5995

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/api/engineering_formatter.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77

88
from matplotlib.ticker import EngFormatter
99

10+
prng = np.random.RandomState(123)
11+
1012
fig, ax = plt.subplots()
1113
ax.set_xscale('log')
12-
formatter = EngFormatter(unit='Hz', places=1)
14+
formatter = EngFormatter(unit='Hz')
1315
ax.xaxis.set_major_formatter(formatter)
1416

1517
xs = np.logspace(1, 9, 100)
16-
ys = (0.8 + 0.4*np.random.uniform(size=100))*np.log10(xs)**2
18+
ys = (0.8 + 0.4 * prng.uniform(size=100)) * np.log10(xs)**2
1719
ax.plot(xs, ys)
1820

1921
plt.show()

0 commit comments

Comments
 (0)