From a293146445f471e66d284ea00363aaebacc1756f Mon Sep 17 00:00:00 2001 From: "Adrien F. VINCENT" Date: Mon, 19 Sep 2016 07:38:03 +0200 Subject: [PATCH 1/2] fix xticklabels overlapping --- examples/api/engineering_formatter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/api/engineering_formatter.py b/examples/api/engineering_formatter.py index a2c5d3003b16..1dbbcda28c31 100644 --- a/examples/api/engineering_formatter.py +++ b/examples/api/engineering_formatter.py @@ -9,7 +9,7 @@ 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) From 54a67a686df357924044c24443d4ad56fb863b56 Mon Sep 17 00:00:00 2001 From: "Adrien F. VINCENT" Date: Mon, 19 Sep 2016 07:41:30 +0200 Subject: [PATCH 2/2] Add PRNG with fix seed for reproducibility --- examples/api/engineering_formatter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/api/engineering_formatter.py b/examples/api/engineering_formatter.py index 1dbbcda28c31..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') 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()