| 2852 | @image_comparison(['contour_colorbar'], style='mpl20', |
| 2853 | tol=0 if platform.machine() == 'x86_64' else 0.54) |
| 2854 | def test_contour_colorbar(): |
| 2855 | x, y, z = contour_dat() |
| 2856 | |
| 2857 | fig, ax = plt.subplots() |
| 2858 | cs = ax.contourf(x, y, z, levels=np.arange(-1.8, 1.801, 0.2), |
| 2859 | cmap=mpl.colormaps['RdBu'], |
| 2860 | vmin=-0.6, |
| 2861 | vmax=0.6, |
| 2862 | extend='both') |
| 2863 | cs1 = ax.contour(x, y, z, levels=np.arange(-2.2, -0.599, 0.2), |
| 2864 | colors=['y'], |
| 2865 | linestyles='solid', |
| 2866 | linewidths=2) |
| 2867 | cs2 = ax.contour(x, y, z, levels=np.arange(0.6, 2.2, 0.2), |
| 2868 | colors=['c'], |
| 2869 | linewidths=2) |
| 2870 | cbar = fig.colorbar(cs, ax=ax) |
| 2871 | cbar.add_lines(cs1) |
| 2872 | cbar.add_lines(cs2, erase=False) |
| 2873 | |
| 2874 | |
| 2875 | @image_comparison(['hist2d.png', 'hist2d.png'], remove_text=True, style='mpl20') |