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

Function test_quadmesh_set_array

lib/matplotlib/tests/test_collections.py:1066–1093  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1064
1065
1066def test_quadmesh_set_array():
1067 x = np.arange(4)
1068 y = np.arange(4)
1069 z = np.arange(9).reshape((3, 3))
1070 fig, ax = plt.subplots()
1071 coll = ax.pcolormesh(x, y, np.ones(z.shape))
1072 # Test that the collection is able to update with a 2d array
1073 coll.set_array(z)
1074 fig.canvas.draw()
1075 assert np.array_equal(coll.get_array(), z)
1076
1077 # Check that pre-flattened arrays work too
1078 coll.set_array(np.ones(9))
1079 fig.canvas.draw()
1080 assert np.array_equal(coll.get_array(), np.ones(9))
1081
1082 z = np.arange(16).reshape((4, 4))
1083 fig, ax = plt.subplots()
1084 coll = ax.pcolormesh(x, y, np.ones(z.shape), shading='gouraud')
1085 # Test that the collection is able to update with a 2d array
1086 coll.set_array(z)
1087 fig.canvas.draw()
1088 assert np.array_equal(coll.get_array(), z)
1089
1090 # Check that pre-flattened arrays work too
1091 coll.set_array(np.ones(16))
1092 fig.canvas.draw()
1093 assert np.array_equal(coll.get_array(), np.ones(16))
1094
1095
1096def test_quadmesh_vmin_vmax(pcfunc):

Callers

nothing calls this directly

Calls 5

pcolormeshMethod · 0.80
get_arrayMethod · 0.80
subplotsMethod · 0.45
set_arrayMethod · 0.45
drawMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…