From f6f5e0865fc7e198526b41f836476027f0da0ab1 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 11 Apr 2022 18:27:05 +0200 Subject: [PATCH] Remove some unnecessary extra boundaries for colorbars with extensions. AFAICT these do not affect the resulting colorbar at all (run the code before and after to compare). --- examples/specialty_plots/leftventricle_bulleye.py | 2 -- tutorials/colors/colorbar_only.py | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/examples/specialty_plots/leftventricle_bulleye.py b/examples/specialty_plots/leftventricle_bulleye.py index 3f32dafd2b08..c687aa00decd 100644 --- a/examples/specialty_plots/leftventricle_bulleye.py +++ b/examples/specialty_plots/leftventricle_bulleye.py @@ -171,8 +171,6 @@ def bullseye_plot(ax, data, seg_bold=None, cmap=None, norm=None): norm3 = mpl.colors.BoundaryNorm(bounds, cmap3.N) fig.colorbar(mpl.cm.ScalarMappable(cmap=cmap3, norm=norm3), cax=axl3, - # to use 'extend', you must specify two extra boundaries: - boundaries=[0] + bounds + [18], extend='both', ticks=bounds, # optional spacing='proportional', diff --git a/tutorials/colors/colorbar_only.py b/tutorials/colors/colorbar_only.py index daa44b752085..ce48ec50c26b 100644 --- a/tutorials/colors/colorbar_only.py +++ b/tutorials/colors/colorbar_only.py @@ -77,8 +77,7 @@ # `~.Figure.colorbar`. For the out-of-range values to display on the colorbar # without using the *extend* keyword with # `.colors.BoundaryNorm`, we have to use the *extend* keyword argument directly -# in the colorbar call, and supply an additional boundary on each end of the -# range. Here we also +# in the colorbar call. Here we also # use the spacing argument to make # the length of each colorbar segment proportional to its corresponding # interval. @@ -94,7 +93,6 @@ fig.colorbar( mpl.cm.ScalarMappable(cmap=cmap, norm=norm), cax=ax, - boundaries=[0] + bounds + [13], # Adding values for extensions. extend='both', ticks=bounds, spacing='proportional', @@ -121,7 +119,6 @@ fig.colorbar( mpl.cm.ScalarMappable(cmap=cmap, norm=norm), cax=ax, - boundaries=[-10] + bounds + [10], extend='both', extendfrac='auto', ticks=bounds,