Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a7f1ee

Browse files
authored
Merge pull request #17838 from anntzer/cbarbase
Prefer colorbar(ScalarMappable(...)) to ColorbarBase in tutorial.
2 parents c272578 + be7422b commit 7a7f1ee

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

tutorials/colors/colorbar_only.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,10 @@
5252
cmap = mpl.cm.viridis
5353
bounds = [-1, 2, 5, 7, 12, 15]
5454
norm = mpl.colors.BoundaryNorm(bounds, cmap.N, extend='both')
55-
cb2 = mpl.colorbar.ColorbarBase(ax, cmap=cmap,
56-
norm=norm,
57-
orientation='horizontal')
58-
cb2.set_label("Discrete intervals with extend='both' keyword")
59-
fig.show()
55+
56+
fig.colorbar(mpl.cm.ScalarMappable(norm=norm, cmap=cmap),
57+
cax=ax, orientation='horizontal',
58+
label="Discrete intervals with extend='both' keyword")
6059

6160
###############################################################################
6261
# Discrete intervals colorbar

0 commit comments

Comments
 (0)