| 2874 | |
| 2875 | @image_comparison(['hist2d.png', 'hist2d.png'], remove_text=True, style='mpl20') |
| 2876 | def test_hist2d(): |
| 2877 | # Remove this line when this test image is regenerated. |
| 2878 | plt.rcParams['pcolormesh.snap'] = False |
| 2879 | |
| 2880 | np.random.seed(0) |
| 2881 | # make it not symmetric in case we switch x and y axis |
| 2882 | x = np.random.randn(100)*2+5 |
| 2883 | y = np.random.randn(100)-2 |
| 2884 | fig, ax = plt.subplots() |
| 2885 | ax.hist2d(x, y, bins=10, rasterized=True) |
| 2886 | |
| 2887 | # Reuse testcase from above for a labeled data test |
| 2888 | data = {"x": x, "y": y} |
| 2889 | fig, ax = plt.subplots() |
| 2890 | ax.hist2d("x", "y", bins=10, data=data, rasterized=True) |
| 2891 | |
| 2892 | |
| 2893 | @image_comparison(['hist2d_transpose.png'], remove_text=True, style='mpl20') |