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

Function test_set_position

lib/matplotlib/tests/test_text.py:329–358  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

327
328
329def test_set_position():
330 fig, ax = plt.subplots()
331
332 # test set_position
333 ann = ax.annotate(
334 'test', (0, 0), xytext=(0, 0), textcoords='figure pixels')
335 fig.canvas.draw()
336
337 init_pos = ann.get_window_extent(fig.canvas.renderer)
338 shift_val = 15
339 ann.set_position((shift_val, shift_val))
340 fig.canvas.draw()
341 post_pos = ann.get_window_extent(fig.canvas.renderer)
342
343 for a, b in zip(init_pos.min, post_pos.min):
344 assert a + shift_val == b
345
346 # test xyann
347 ann = ax.annotate(
348 'test', (0, 0), xytext=(0, 0), textcoords='figure pixels')
349 fig.canvas.draw()
350
351 init_pos = ann.get_window_extent(fig.canvas.renderer)
352 shift_val = 15
353 ann.xyann = (shift_val, shift_val)
354 fig.canvas.draw()
355 post_pos = ann.get_window_extent(fig.canvas.renderer)
356
357 for a, b in zip(init_pos.min, post_pos.min):
358 assert a + shift_val == b
359
360
361def test_char_index_at():

Callers

nothing calls this directly

Calls 5

annotateMethod · 0.80
subplotsMethod · 0.45
drawMethod · 0.45
get_window_extentMethod · 0.45
set_positionMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…