| 1094 | |
| 1095 | |
| 1096 | def test_quadmesh_vmin_vmax(pcfunc): |
| 1097 | # test when vmin/vmax on the norm changes, the quadmesh gets updated |
| 1098 | fig, ax = plt.subplots() |
| 1099 | cmap = mpl.colormaps['plasma'] |
| 1100 | norm = mpl.colors.Normalize(vmin=0, vmax=1) |
| 1101 | coll = getattr(ax, pcfunc)([[1]], cmap=cmap, norm=norm) |
| 1102 | fig.canvas.draw() |
| 1103 | assert np.array_equal(coll.get_facecolors()[0, :], cmap(norm(1))) |
| 1104 | |
| 1105 | # Change the vmin/vmax of the norm so that the color is from |
| 1106 | # the bottom of the colormap now |
| 1107 | norm.vmin, norm.vmax = 1, 2 |
| 1108 | fig.canvas.draw() |
| 1109 | assert np.array_equal(coll.get_facecolors()[0, :], cmap(norm(1))) |
| 1110 | |
| 1111 | |
| 1112 | def test_quadmesh_alpha_array(pcfunc): |