()
| 29 | @image_comparison(['figure_align_labels'], extensions=['png', 'svg'], style='mpl20', |
| 30 | tol=0 if platform.machine() == 'x86_64' else 0.01) |
| 31 | def test_align_labels(): |
| 32 | fig = plt.figure(layout='tight') |
| 33 | gs = gridspec.GridSpec(3, 3) |
| 34 | |
| 35 | ax = fig.add_subplot(gs[0, :2]) |
| 36 | ax.plot(np.arange(0, 1e6, 1000)) |
| 37 | ax.set_ylabel('Ylabel0 0') |
| 38 | ax = fig.add_subplot(gs[0, -1]) |
| 39 | ax.plot(np.arange(0, 1e4, 100)) |
| 40 | |
| 41 | for i in range(3): |
| 42 | ax = fig.add_subplot(gs[1, i]) |
| 43 | ax.set_ylabel('YLabel1 %d' % i) |
| 44 | ax.set_xlabel('XLabel1 %d' % i) |
| 45 | if i in [0, 2]: |
| 46 | ax.xaxis.set_label_position("top") |
| 47 | ax.xaxis.tick_top() |
| 48 | if i == 0: |
| 49 | for tick in ax.get_xticklabels(): |
| 50 | tick.set_rotation(90) |
| 51 | if i == 2: |
| 52 | ax.yaxis.set_label_position("right") |
| 53 | ax.yaxis.tick_right() |
| 54 | |
| 55 | for i in range(3): |
| 56 | ax = fig.add_subplot(gs[2, i]) |
| 57 | ax.set_xlabel(f'XLabel2 {i}') |
| 58 | ax.set_ylabel(f'YLabel2 {i}') |
| 59 | |
| 60 | if i == 2: |
| 61 | ax.plot(np.arange(0, 1e4, 10)) |
| 62 | ax.yaxis.set_label_position("right") |
| 63 | ax.yaxis.tick_right() |
| 64 | for tick in ax.get_xticklabels(): |
| 65 | tick.set_rotation(90) |
| 66 | |
| 67 | fig.align_labels() |
| 68 | |
| 69 | |
| 70 | @image_comparison(['figure_align_titles_tight.png', |
nothing calls this directly
no test coverage detected
searching dependent graphs…