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

Function test_move_offsetlabel

lib/matplotlib/tests/test_axes.py:7225–7248  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7223
7224
7225def test_move_offsetlabel():
7226 data = np.random.random(10) * 1e-22
7227
7228 fig, ax = plt.subplots()
7229 ax.plot(data)
7230 fig.canvas.draw()
7231 before = ax.yaxis.offsetText.get_position()
7232 assert ax.yaxis.offsetText.get_horizontalalignment() == 'left'
7233 ax.yaxis.tick_right()
7234 fig.canvas.draw()
7235 after = ax.yaxis.offsetText.get_position()
7236 assert after[0] > before[0] and after[1] == before[1]
7237 assert ax.yaxis.offsetText.get_horizontalalignment() == 'right'
7238
7239 fig, ax = plt.subplots()
7240 ax.plot(data)
7241 fig.canvas.draw()
7242 before = ax.xaxis.offsetText.get_position()
7243 assert ax.xaxis.offsetText.get_verticalalignment() == 'top'
7244 ax.xaxis.tick_top()
7245 fig.canvas.draw()
7246 after = ax.xaxis.offsetText.get_position()
7247 assert after[0] == before[0] and after[1] > before[1]
7248 assert ax.xaxis.offsetText.get_verticalalignment() == 'bottom'
7249
7250
7251@image_comparison(['rc_spines.png'], savefig_kwarg={'dpi': 40}, style='mpl20')

Callers

nothing calls this directly

Calls 8

tick_rightMethod · 0.80
get_verticalalignmentMethod · 0.80
tick_topMethod · 0.80
subplotsMethod · 0.45
plotMethod · 0.45
drawMethod · 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…