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

Function test_bool_autolevel

lib/matplotlib/tests/test_contour.py:837–851  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

835
836
837def test_bool_autolevel():
838 x, y = np.random.rand(2, 9)
839 z = (np.arange(9) % 2).reshape((3, 3)).astype(bool)
840 m = [[False, False, False], [False, True, False], [False, False, False]]
841 assert plt.contour(z.tolist()).levels.tolist() == [.5]
842 assert plt.contour(z).levels.tolist() == [.5]
843 assert plt.contour(np.ma.array(z, mask=m)).levels.tolist() == [.5]
844 assert plt.contourf(z.tolist()).levels.tolist() == [0, .5, 1]
845 assert plt.contourf(z).levels.tolist() == [0, .5, 1]
846 assert plt.contourf(np.ma.array(z, mask=m)).levels.tolist() == [0, .5, 1]
847 z = z.ravel()
848 assert plt.tricontour(x, y, z.tolist()).levels.tolist() == [.5]
849 assert plt.tricontour(x, y, z).levels.tolist() == [.5]
850 assert plt.tricontourf(x, y, z.tolist()).levels.tolist() == [0, .5, 1]
851 assert plt.tricontourf(x, y, z).levels.tolist() == [0, .5, 1]
852
853
854def test_all_nan():

Callers

nothing calls this directly

Calls 4

tricontourMethod · 0.80
tricontourfMethod · 0.80
contourMethod · 0.45
contourfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…