MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_axis_not_in_layout

Function test_axis_not_in_layout

lib/matplotlib/tests/test_axis.py:14–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13
14def test_axis_not_in_layout():
15 fig1, (ax1_left, ax1_right) = plt.subplots(ncols=2, layout='constrained')
16 fig2, (ax2_left, ax2_right) = plt.subplots(ncols=2, layout='constrained')
17
18 # 100 label overlapping the end of the axis
19 ax1_left.set_xlim(0, 100)
20 # 100 label not overlapping the end of the axis
21 ax2_left.set_xlim(0, 120)
22
23 for ax in ax1_left, ax2_left:
24 ax.set_xticks([0, 100])
25 ax.xaxis.set_in_layout(False)
26
27 for fig in fig1, fig2:
28 fig.draw_without_rendering()
29
30 # Positions should not be affected by overlapping 100 label
31 assert ax1_left.get_position().bounds == ax2_left.get_position().bounds
32 assert ax1_right.get_position().bounds == ax2_right.get_position().bounds
33
34
35@check_figures_equal()

Callers

nothing calls this directly

Calls 6

set_xticksMethod · 0.80
set_in_layoutMethod · 0.80
subplotsMethod · 0.45
set_xlimMethod · 0.45
get_positionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…