Skip to content

Commit 97c836b

Browse files
authored
Merge pull request #25392 from meeseeksmachine/auto-backport-of-pr-25388-on-v3.7.x
Backport PR #25388 on branch v3.7.x (Better axis labels for examples)
2 parents d50b964 + 51e6d08 commit 97c836b

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
2-
=======================
3-
Simple Axis Direction01
4-
=======================
2+
=====================
3+
Simple axis direction
4+
=====================
55
66
"""
77
import matplotlib.pyplot as plt
@@ -12,10 +12,10 @@
1212
fig.subplots_adjust(right=0.8)
1313

1414
ax1.axis["left"].major_ticklabels.set_axis_direction("top")
15-
ax1.axis["left"].label.set_text("Label")
15+
ax1.axis["left"].label.set_text("Left label")
1616

1717
ax1.axis["right"].label.set_visible(True)
18-
ax1.axis["right"].label.set_text("Label")
18+
ax1.axis["right"].label.set_text("Right label")
1919
ax1.axis["right"].label.set_axis_direction("left")
2020

2121
plt.show()

examples/axisartist/simple_axis_direction03.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
"""
2-
=======================
3-
Simple Axis Direction03
4-
=======================
2+
==========================================
3+
Simple axis tick label and tick directions
4+
==========================================
55
6+
First subplot moves the tick labels to inside the spines.
7+
Second subplots moves the ticks to inside the spines.
8+
These effects can be obtained for a standard Axes by `~.Axes.tick_params`.
69
"""
710

811
import matplotlib.pyplot as plt
@@ -20,15 +23,15 @@ def setup_axes(fig, pos):
2023
fig.subplots_adjust(wspace=0.4, bottom=0.3)
2124

2225
ax1 = setup_axes(fig, 121)
23-
ax1.set_xlabel("X-label")
24-
ax1.set_ylabel("Y-label")
26+
ax1.set_xlabel("ax1 X-label")
27+
ax1.set_ylabel("ax1 Y-label")
2528

2629
ax1.axis[:].invert_ticklabel_direction()
2730

2831
ax2 = setup_axes(fig, 122)
29-
ax2.set_xlabel("X-label")
30-
ax2.set_ylabel("Y-label")
32+
ax2.set_xlabel("ax2 X-label")
33+
ax2.set_ylabel("ax2 Y-label")
3134

32-
ax2.axis[:].major_ticks.set_tick_out(True)
35+
ax2.axis[:].major_ticks.set_tick_out(False)
3336

3437
plt.show()

0 commit comments

Comments
 (0)