MCPcopy
hub / github.com/matplotlib/matplotlib / test_rotation

Function test_rotation

lib/matplotlib/tests/test_usetex.py:231–251  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

229@image_comparison(baseline_images=['rotation'], extensions=['eps', 'pdf', 'png', 'svg'],
230 style='mpl20', tol=3.91 if _old_gs_version else 0)
231def test_rotation():
232 mpl.rcParams['text.usetex'] = True
233
234 fig = plt.figure()
235 ax = fig.add_axes((0, 0, 1, 1))
236 ax.set(xlim=(-0.5, 5), xticks=[], ylim=(-0.5, 3), yticks=[], frame_on=False)
237
238 text = {val: val[0] for val in ['top', 'center', 'bottom', 'left', 'right']}
239 text['baseline'] = 'B'
240 text['center_baseline'] = 'C'
241
242 for i, va in enumerate(['top', 'center', 'bottom', 'baseline', 'center_baseline']):
243 for j, ha in enumerate(['left', 'center', 'right']):
244 for k, angle in enumerate([0, 90, 180, 270]):
245 k //= 2
246 x = i + k / 2
247 y = j + k / 2
248 ax.plot(x, y, '+', c=f'C{k}', markersize=20, markeredgewidth=0.5)
249 # 'My' checks full height letters plus descenders.
250 ax.text(x, y, f"$\\mathrm{{My {text[ha]}{text[va]} {angle}}}$",
251 rotation=angle, horizontalalignment=ha, verticalalignment=va)
252
253
254def test_unicode_sizing():

Callers

nothing calls this directly

Calls 5

figureMethod · 0.80
add_axesMethod · 0.80
setMethod · 0.45
plotMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…