8000 Cleanup spines example. (#15083) · matplotlib/matplotlib@d8123e6 · GitHub
[go: up one dir, main page]

Skip to content

Commit d8123e6

Browse files
authored
Cleanup spines example. (#15083)
Cleanup spines example.
2 parents e04ebd2 + de5bb3b commit d8123e6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

examples/ticks_and_spines/spines.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
======
55
66
This demo compares:
7-
- normal axes, with spines on all four sides;
8-
- an axes with spines only on the left and bottom;
9-
- an axes using custom bounds to limit the extent of the spine.
7+
8+
- normal axes, with spines on all four sides;
9+
- an axes with spines only on the left and bottom;
10+
- an axes using custom bounds to limit the extent of the spine.
1011
"""
1112
import numpy as np
1213
import matplotlib.pyplot as plt
@@ -15,7 +16,8 @@
1516
x = np.linspace(0, 2 * np.pi, 100)
1617
y = 2 * np.sin(x)
1718

18-
fig, (ax0, ax1, ax2) = plt.subplots(nrows=3)
19+
# Constrained layout makes sure the labels don't overlap the axes.
20+
fig, (ax0, ax1, ax2) = plt.subplots(nrows=3, constrained_layout=True)
1921

2022
ax0.plot(x, y)
2123
ax0.set_title('normal spines')
@@ -41,6 +43,4 @@
4143
ax2.yaxis.set_ticks_position('left')
4244
ax2.xaxis.set_ticks_position('bottom')
4345

44-
# Tweak spacing between subplots to prevent labels from overlapping
45-
plt.subplots_adjust(hspace=0.5)
4646
plt.show()

0 commit comments

Comments
 (0)
0