|
16 | 16 | import warnings
|
17 | 17 |
|
18 | 18 | import matplotlib
|
| 19 | +import matplotlib as mpl |
19 | 20 | from matplotlib.testing.decorators import (
|
20 | 21 | image_comparison, check_figures_equal, remove_ticks_and_titles)
|
21 | 22 | import matplotlib.pyplot as plt
|
@@ -5220,14 +5221,21 @@ def test_no_None():
|
5220 | 5221 | plt.plot(None, None)
|
5221 | 5222 |
|
5222 | 5223 |
|
5223 |
| -def test_pcolor_fast_non_uniform(): |
5224 |
| - Z = np.arange(6).reshape((3, 2)) |
5225 |
| - X = np.array([0, 1, 2, 10]) |
5226 |
| - Y = np.array([0, 1, 2]) |
5227 |
| - |
5228 |
| - plt.figure() |
5229 |
| - ax = plt.subplot(111) |
5230 |
| - ax.pcolorfast(X, Y, Z.T) |
| 5224 | +@pytest.mark.parametrize( |
| 5225 | + "xy, cls", [ |
| 5226 | + ((), mpl.image.AxesImage), # (0, N) |
| 5227 | + (((3, 7), (2, 6)), mpl.image.AxesImage), # (xmin, xmax) |
| 5228 | + ((range(5), range(4)), mpl.image.AxesImage), # regular grid |
| 5229 | + (([1, 2, 4, 8, 16], [0, 1, 2, 3]), # irregular grid |
| 5230 | + mpl.image.PcolorImage), |
| 5231 | + ((np.random.random((4, 5)), np.random.random((4, 5))), # 2D coords |
| 5232 | + mpl.collections.QuadMesh), |
| 5233 | + ] |
| 5234 | +) |
| 5235 | +def test_pcolorfast_colormapped(xy, cls): |
| 5236 | + fig, ax = plt.subplots() |
| 5237 | + data = np.arange(12).reshape((3, 4)) |
| 5238 | + assert type(ax.pcolorfast(*xy, data)) == cls |
5231 | 5239 |
|
5232 | 5240 |
|
5233 | 5241 | def test_shared_scale():
|
|
0 commit comments