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

Function test_small_autoscale

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

Source from the content-addressed store, hash-verified

9666
9667
9668def test_small_autoscale():
9669 # Check that paths with small values autoscale correctly #24097.
9670 verts = np.array([
9671 [-5.45, 0.00], [-5.45, 0.00], [-5.29, 0.00], [-5.29, 0.00],
9672 [-5.13, 0.00], [-5.13, 0.00], [-4.97, 0.00], [-4.97, 0.00],
9673 [-4.81, 0.00], [-4.81, 0.00], [-4.65, 0.00], [-4.65, 0.00],
9674 [-4.49, 0.00], [-4.49, 0.00], [-4.33, 0.00], [-4.33, 0.00],
9675 [-4.17, 0.00], [-4.17, 0.00], [-4.01, 0.00], [-4.01, 0.00],
9676 [-3.85, 0.00], [-3.85, 0.00], [-3.69, 0.00], [-3.69, 0.00],
9677 [-3.53, 0.00], [-3.53, 0.00], [-3.37, 0.00], [-3.37, 0.00],
9678 [-3.21, 0.00], [-3.21, 0.01], [-3.05, 0.01], [-3.05, 0.01],
9679 [-2.89, 0.01], [-2.89, 0.01], [-2.73, 0.01], [-2.73, 0.02],
9680 [-2.57, 0.02], [-2.57, 0.04], [-2.41, 0.04], [-2.41, 0.04],
9681 [-2.25, 0.04], [-2.25, 0.06], [-2.09, 0.06], [-2.09, 0.08],
9682 [-1.93, 0.08], [-1.93, 0.10], [-1.77, 0.10], [-1.77, 0.12],
9683 [-1.61, 0.12], [-1.61, 0.14], [-1.45, 0.14], [-1.45, 0.17],
9684 [-1.30, 0.17], [-1.30, 0.19], [-1.14, 0.19], [-1.14, 0.22],
9685 [-0.98, 0.22], [-0.98, 0.25], [-0.82, 0.25], [-0.82, 0.27],
9686 [-0.66, 0.27], [-0.66, 0.29], [-0.50, 0.29], [-0.50, 0.30],
9687 [-0.34, 0.30], [-0.34, 0.32], [-0.18, 0.32], [-0.18, 0.33],
9688 [-0.02, 0.33], [-0.02, 0.32], [0.13, 0.32], [0.13, 0.33], [0.29, 0.33],
9689 [0.29, 0.31], [0.45, 0.31], [0.45, 0.30], [0.61, 0.30], [0.61, 0.28],
9690 [0.77, 0.28], [0.77, 0.25], [0.93, 0.25], [0.93, 0.22], [1.09, 0.22],
9691 [1.09, 0.19], [1.25, 0.19], [1.25, 0.17], [1.41, 0.17], [1.41, 0.15],
9692 [1.57, 0.15], [1.57, 0.12], [1.73, 0.12], [1.73, 0.10], [1.89, 0.10],
9693 [1.89, 0.08], [2.05, 0.08], [2.05, 0.07], [2.21, 0.07], [2.21, 0.05],
9694 [2.37, 0.05], [2.37, 0.04], [2.53, 0.04], [2.53, 0.02], [2.69, 0.02],
9695 [2.69, 0.02], [2.85, 0.02], [2.85, 0.01], [3.01, 0.01], [3.01, 0.01],
9696 [3.17, 0.01], [3.17, 0.00], [3.33, 0.00], [3.33, 0.00], [3.49, 0.00],
9697 [3.49, 0.00], [3.65, 0.00], [3.65, 0.00], [3.81, 0.00], [3.81, 0.00],
9698 [3.97, 0.00], [3.97, 0.00], [4.13, 0.00], [4.13, 0.00], [4.29, 0.00],
9699 [4.29, 0.00], [4.45, 0.00], [4.45, 0.00], [4.61, 0.00], [4.61, 0.00],
9700 [4.77, 0.00], [4.77, 0.00], [4.93, 0.00], [4.93, 0.00],
9701 ])
9702
9703 minx = np.min(verts[:, 0])
9704 miny = np.min(verts[:, 1])
9705 maxx = np.max(verts[:, 0])
9706 maxy = np.max(verts[:, 1])
9707
9708 p = mpath.Path(verts)
9709
9710 fig, ax = plt.subplots()
9711 ax.add_patch(mpatches.PathPatch(p))
9712 ax.autoscale()
9713
9714 assert ax.get_xlim()[0] <= minx
9715 assert ax.get_xlim()[1] >= maxx
9716 assert ax.get_ylim()[0] <= miny
9717 assert ax.get_ylim()[1] >= maxy
9718
9719
9720def test_get_xticklabel():

Callers

nothing calls this directly

Calls 7

minMethod · 0.80
maxMethod · 0.80
add_patchMethod · 0.80
subplotsMethod · 0.45
autoscaleMethod · 0.45
get_xlimMethod · 0.45
get_ylimMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…