8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 21247cf commit 2950bdbCopy full SHA for 2950bdb
lib/matplotlib/tests/baseline_images/test_colorbar/colorbar_norms.png
52 KB
lib/matplotlib/tests/test_colorbar.py
@@ -570,3 +570,17 @@ def test_colorbar_label():
570
571
cbar3 = fig.colorbar(im, orientation='horizontal', label='horizontal cbar')
572
assert cbar3.ax.get_xlabel() == 'horizontal cbar'
573
+
574
+@image_comparison(
575
+ baseline_images=['colorbar_norms'], extensions=['png'])
576
+def test_cbar_norms():
577
+ # Test colormaps with different norms
578
+ norms = [mcolors.Normalize(vmin=-1, vmax=2),
579
+ mcolors.BoundaryNorm(boundaries=[-1, 0, 1], ncolors=4),
580
+ mcolors.LogNorm(vmin=1, vmax=1e4),
581
+ mcolors.PowerNorm(gamma=0.2, vmin=0.1, vmax=0.6),
582
583
+ mcolors.TwoSlopeNorm(1, vmin=0, vmax=2)]
584
+ fig, axs = plt.subplots(ncols=len(norms), constrained_layout=True)
585
+ for ax, norm in zip(axs, norms):
586
+ fig.colorbar(cm.ScalarMappable(norm=norm, cmap='viridis'), cax=ax, extend='both')
0 commit comments