| 229 | @image_comparison(baseline_images=['rotation'], extensions=['eps', 'pdf', 'png', 'svg'], |
| 230 | style='mpl20', tol=3.91 if _old_gs_version else 0) |
| 231 | def 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 | |
| 254 | def test_unicode_sizing(): |