()
| 1159 | |
| 1160 | |
| 1161 | def test_inverted_limits(): |
| 1162 | # Test gh:1553 |
| 1163 | # Calling invert_xaxis prior to plotting should not disable autoscaling |
| 1164 | # while still maintaining the inverted direction |
| 1165 | fig, ax = plt.subplots() |
| 1166 | ax.invert_xaxis() |
| 1167 | ax.plot([-5, -3, 2, 4], [1, 2, -3, 5]) |
| 1168 | |
| 1169 | assert ax.get_xlim() == (4, -5) |
| 1170 | assert ax.get_ylim() == (-3, 5) |
| 1171 | plt.close() |
| 1172 | |
| 1173 | fig, ax = plt.subplots() |
| 1174 | ax.invert_yaxis() |
| 1175 | ax.plot([-5, -3, 2, 4], [1, 2, -3, 5]) |
| 1176 | |
| 1177 | assert ax.get_xlim() == (-5, 4) |
| 1178 | assert ax.get_ylim() == (5, -3) |
| 1179 | |
| 1180 | # Test inverting nonlinear axes. |
| 1181 | fig, ax = plt.subplots() |
| 1182 | ax.set_yscale("log") |
| 1183 | ax.set_ylim(10, 1) |
| 1184 | assert ax.get_ylim() == (10, 1) |
| 1185 | |
| 1186 | |
| 1187 | @image_comparison(['nonfinite_limits'], style='mpl20') |
nothing calls this directly
no test coverage detected
searching dependent graphs…