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

Function test_label_without_ticks

lib/matplotlib/tests/test_spines.py:118–144  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116
117
118def test_label_without_ticks():
119 fig, ax = plt.subplots()
120 plt.subplots_adjust(left=0.3, bottom=0.3)
121 ax.plot(np.arange(10))
122 ax.yaxis.set_ticks_position('left')
123 ax.spines.left.set_position(('outward', 30))
124 ax.spines.right.set_visible(False)
125 ax.set_ylabel('y label')
126 ax.xaxis.set_ticks_position('bottom')
127 ax.spines.bottom.set_position(('outward', 30))
128 ax.spines.top.set_visible(False)
129 ax.set_xlabel('x label')
130 ax.xaxis.set_ticks([])
131 ax.yaxis.set_ticks([])
132 plt.draw()
133
134 spine = ax.spines.left
135 spinebbox = spine.get_transform().transform_path(
136 spine.get_path()).get_extents()
137 assert ax.yaxis.label.get_position()[0] < spinebbox.xmin, \
138 "Y-Axis label not left of the spine"
139
140 spine = ax.spines.bottom
141 spinebbox = spine.get_transform().transform_path(
142 spine.get_path()).get_extents()
143 assert ax.xaxis.label.get_position()[1] < spinebbox.ymin, \
144 "X-Axis label not below the spine"
145
146
147@image_comparison(['black_axes.png'], style='_classic_test')

Callers

nothing calls this directly

Calls 15

subplots_adjustMethod · 0.80
set_ylabelMethod · 0.80
set_xlabelMethod · 0.80
subplotsMethod · 0.45
plotMethod · 0.45
set_ticks_positionMethod · 0.45
set_positionMethod · 0.45
set_visibleMethod · 0.45
set_ticksMethod · 0.45
drawMethod · 0.45
get_extentsMethod · 0.45
transform_pathMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…