10000 scales.py: use subplots_adjust to give room; tweak symlog parameter · matplotlib/matplotlib@7f8b927 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7f8b927

Browse files
committed
scales.py: use subplots_adjust to give room; tweak symlog parameter
1 parent 723f33e commit 7f8b927

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

examples/scales/scales.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
"""
44
import numpy as np
55
import matplotlib.pyplot as plt
6+
from matplotlib.ticker import NullFormatter
67

8+
np.random.seed(1)
79
# make up some data in the interval ]0, 1[
810
y = np.random.normal(loc=0.5, scale=0.4, size=1000)
911
y = y[(y > 0) & (y < 1)]
1012
y.sort()
1113
x = np.arange(len(y))
1214

1315
# plot with various axes scales
14-
fig, axs = plt.subplots(2, 2)
16+
fig, axs = plt.subplots(2, 2, sharex=True)
17+
fig.subplots_adjust(left=0.08, right=0.98, wspace=0.3)
1518

1619
# linear
1720
ax = axs[0, 0]
@@ -30,18 +33,19 @@
3033

3134

3235
# symmetric log
33-
ax = axs[1, 0]
36+
ax = axs[1, 1]
3437
ax.plot(x, y - y.mean())
35-
ax.set_yscale('symlog', linthreshy=0.05)
38+
ax.set_yscale('symlog', linthreshy=0.02)
3639
ax.set_title('symlog')
3740
ax.grid(True)
3841

3942
# logit
40-
ax = axs[1, 1]
43+
ax = axs[1, 0]
4144
ax.plot(x, y)
4245
ax.set_yscale('logit')
4346
ax.set_title('logit')
4447
ax.grid(True)
48+
ax.yaxis.set_minor_formatter(NullFormatter())
4549

4650

4751
plt.show()

0 commit comments

Comments
 (0)
0