|
28 | 28 | from numpy.testing import assert_allclose, assert_array_equal
|
29 | 29 | from matplotlib.cbook import IgnoredKeywordWarning
|
30 | 30 | from matplotlib.cbook._backports import broadcast_to
|
| 31 | +from matplotlib.cbook import get_sample_data |
31 | 32 |
|
32 | 33 | # Note: Some test cases are run twice: once normally and once with labeled data
|
33 | 34 | # These two must be defined in the same test function or need to have
|
@@ -5271,3 +5272,30 @@ def test_twinx_knows_limits():
|
5271 | 5272 | def test_zero_linewidth():
|
5272 | 5273 | # Check that setting a zero linewidth doesn't error
|
5273 | 5274 | plt.plot([0, 1], [0, 1], ls='--', lw=0)
|
| 5275 | + |
| 5276 | + |
| 5277 | +@image_comparison( |
| 5278 | + baseline_images=['bivar_imshow', 'bivar_pcolor', 'bivar_pcolormesh', |
| 5279 | + 'bivar_pcolorfast'], |
| 5280 | + extensions=['png'] |
| 5281 | +) |
| 5282 | +def test_bivariates(): |
| 5283 | + air_temp = np.load(get_sample_data('air_temperature.npy')) |
| 5284 | + surf_pres = np.load(get_sample_data('surface_pressure.npy')) |
| 5285 | + bivariate = [air_temp, surf_pres] |
| 5286 | + |
| 5287 | + fig1, ax1 = plt.subplots() |
| 5288 | + cax1 = ax1.imshow(bivariate) |
| 5289 | + cbar = fig1.colorbar(cax1, xlabel='air_temp', ylabel='surf_pres') |
| 5290 | + |
| 5291 | + fig2, ax2 = plt.subplots() |
| 5292 | + cax2 = ax2.pcolor(bivariate) |
| 5293 | + cbar = fig2.colorbar(cax2, xlabel='air_temp', ylabel='surf_pres') |
| 5294 | + |
| 5295 | + fig3, ax3 = plt.subplots() |
| 5296 | + cax3 = ax3.pcolormesh(bivariate) |
| 5297 | + cbar = fig3.colorbar(cax3, xlabel='air_temp', ylabel='surf_pres') |
| 5298 | + |
| 5299 | + fig4, ax4 = plt.subplots() |
| 5300 | + cax4 = ax4.pcolorfast(bivariate) |
| 5301 | + cbar = fig4.colorbar(cax4, xlabel='air_temp', ylabel='surf_pres') |
0 commit comments