()
| 6431 | |
| 6432 | |
| 6433 | def test_shared_with_aspect_3(): |
| 6434 | # Different aspect ratios: |
| 6435 | for adjustable in ['box', 'datalim']: |
| 6436 | fig, axs = plt.subplots(nrows=2, sharey=True) |
| 6437 | axs[0].set_aspect(2, adjustable=adjustable) |
| 6438 | axs[1].set_aspect(0.5, adjustable=adjustable) |
| 6439 | axs[0].plot([1, 2], [3, 4]) |
| 6440 | axs[1].plot([3, 4], [1, 2]) |
| 6441 | plt.draw() # Trigger apply_aspect(). |
| 6442 | assert axs[0].get_xlim() != axs[1].get_xlim() |
| 6443 | assert axs[0].get_ylim() == axs[1].get_ylim() |
| 6444 | fig_aspect = fig.bbox_inches.height / fig.bbox_inches.width |
| 6445 | for ax in axs: |
| 6446 | p = ax.get_position() |
| 6447 | box_aspect = p.height / p.width |
| 6448 | lim_aspect = ax.viewLim.height / ax.viewLim.width |
| 6449 | expected = fig_aspect * box_aspect / lim_aspect |
| 6450 | assert round(expected, 4) == round(ax.get_aspect(), 4) |
| 6451 | |
| 6452 | |
| 6453 | def test_shared_aspect_error(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…