Test that the inset lines are correctly located with inverted data axes.
(x_inverted, y_inverted)
| 8405 | @pytest.mark.parametrize('x_inverted', [False, True]) |
| 8406 | @pytest.mark.parametrize('y_inverted', [False, True]) |
| 8407 | def test_indicate_inset_inverted(x_inverted, y_inverted): |
| 8408 | """ |
| 8409 | Test that the inset lines are correctly located with inverted data axes. |
| 8410 | """ |
| 8411 | fig, (ax1, ax2) = plt.subplots(1, 2) |
| 8412 | |
| 8413 | x = np.arange(10) |
| 8414 | ax1.plot(x, x, 'o') |
| 8415 | if x_inverted: |
| 8416 | ax1.invert_xaxis() |
| 8417 | if y_inverted: |
| 8418 | ax1.invert_yaxis() |
| 8419 | |
| 8420 | inset = ax1.indicate_inset([2, 2, 5, 4], ax2) |
| 8421 | lower_left, upper_left, lower_right, upper_right = inset.connectors |
| 8422 | |
| 8423 | sign_x = -1 if x_inverted else 1 |
| 8424 | sign_y = -1 if y_inverted else 1 |
| 8425 | assert sign_x * (lower_right.xy2[0] - lower_left.xy2[0]) > 0 |
| 8426 | assert sign_x * (upper_right.xy2[0] - upper_left.xy2[0]) > 0 |
| 8427 | assert sign_y * (upper_left.xy2[1] - lower_left.xy2[1]) > 0 |
| 8428 | assert sign_y * (upper_right.xy2[1] - lower_right.xy2[1]) > 0 |
| 8429 | |
| 8430 | |
| 8431 | def test_set_position(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…