Skip to content

Remove some unnecessary extra boundaries for colorbars with extensions. #22824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions examples/specialty_plots/leftventricle_bulleye.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 1 addition & 4 deletions tutorials/colors/colorbar_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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',
Expand All @@ -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,
Expand Down