MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_inverted_limits

Function test_inverted_limits

lib/matplotlib/tests/test_axes.py:1161–1184  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1159
1160
1161def 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')

Callers

nothing calls this directly

Calls 9

invert_yaxisMethod · 0.80
subplotsMethod · 0.45
invert_xaxisMethod · 0.45
plotMethod · 0.45
get_xlimMethod · 0.45
get_ylimMethod · 0.45
closeMethod · 0.45
set_yscaleMethod · 0.45
set_ylimMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…