()
| 71 | 'figure_align_titles_constrained.png'], |
| 72 | style='mpl20', tol=0 if platform.machine() == 'x86_64' else 0.021) |
| 73 | def test_align_titles(): |
| 74 | for layout in ['tight', 'constrained']: |
| 75 | fig, axs = plt.subplots(1, 2, layout=layout, width_ratios=[2, 1]) |
| 76 | |
| 77 | ax = axs[0] |
| 78 | ax.plot(np.arange(0, 1e6, 1000)) |
| 79 | ax.set_title('Title0 left', loc='left') |
| 80 | ax.set_title('Title0 center', loc='center') |
| 81 | ax.set_title('Title0 right', loc='right') |
| 82 | |
| 83 | ax = axs[1] |
| 84 | ax.plot(np.arange(0, 1e4, 100)) |
| 85 | ax.set_title('Title1') |
| 86 | ax.set_xlabel('Xlabel0') |
| 87 | ax.xaxis.set_label_position("top") |
| 88 | ax.xaxis.tick_top() |
| 89 | for tick in ax.get_xticklabels(): |
| 90 | tick.set_rotation(90) |
| 91 | |
| 92 | fig.align_titles() |
| 93 | |
| 94 | |
| 95 | def test_align_labels_stray_axes(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…