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

Function test_titletwiny

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

Source from the content-addressed store, hash-verified

7885
7886
7887def test_titletwiny():
7888 plt.style.use('mpl20')
7889 fig, ax = plt.subplots(dpi=72)
7890 ax2 = ax.twiny()
7891 xlabel2 = ax2.set_xlabel('Xlabel2')
7892 title = ax.set_title('Title')
7893 fig.canvas.draw()
7894 renderer = fig.canvas.get_renderer()
7895 # ------- Test that title is put above Xlabel2 (Xlabel2 at top) ----------
7896 bbox_y0_title = title.get_window_extent(renderer).y0 # bottom of title
7897 bbox_y1_xlabel2 = xlabel2.get_window_extent(renderer).y1 # top of xlabel2
7898 y_diff = bbox_y0_title - bbox_y1_xlabel2
7899 assert y_diff >= 3
7900
7901
7902def test_titlesetpos():

Callers

nothing calls this directly

Calls 7

set_xlabelMethod · 0.80
subplotsMethod · 0.45
twinyMethod · 0.45
set_titleMethod · 0.45
drawMethod · 0.45
get_rendererMethod · 0.45
get_window_extentMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…