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

Function test_tick_label_update

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

Source from the content-addressed store, hash-verified

7052
7053
7054def test_tick_label_update():
7055 # test issue 9397
7056
7057 fig, ax = plt.subplots()
7058
7059 # Set up a dummy formatter
7060 def formatter_func(x, pos):
7061 return "unit value" if x == 1 else ""
7062 ax.xaxis.set_major_formatter(plt.FuncFormatter(formatter_func))
7063
7064 # Force some of the x-axis ticks to be outside of the drawn range
7065 ax.set_xticks([-1, 0, 1, 2, 3])
7066 ax.set_xlim(-0.5, 2.5)
7067
7068 fig.canvas.draw()
7069 tick_texts = [tick.get_text() for tick in ax.xaxis.get_ticklabels()]
7070 assert tick_texts == ["", "", "unit value", "", ""]
7071
7072
7073@image_comparison(['o_marker_path_snap.png'], savefig_kwarg={'dpi': 72}, style='mpl20')

Callers

nothing calls this directly

Calls 7

set_xticksMethod · 0.80
get_ticklabelsMethod · 0.80
subplotsMethod · 0.45
set_major_formatterMethod · 0.45
set_xlimMethod · 0.45
drawMethod · 0.45
get_textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…