Skip to content

Commit

Permalink
Prefer colorbar(ScalarMappable(...)) to ColorbarBase in tutorial.
Browse files Browse the repository at this point in the history
Nearly all the colorbar_only tutorial already uses
`colorbar(ScalarMappable(...))` to generate "standalone" colorbars;
change the last example that was still using `ColorbarBase`.
  • Loading branch information
anntzer committed Jul 5, 2020
1 parent 8c2fbda commit be7422b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tutorials/colors/colorbar_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@
cmap = mpl.cm.viridis
bounds = [-1, 2, 5, 7, 12, 15]
norm = mpl.colors.BoundaryNorm(bounds, cmap.N, extend='both')
cb2 = mpl.colorbar.ColorbarBase(ax, cmap=cmap,
norm=norm,
orientation='horizontal')
cb2.set_label("Discrete intervals with extend='both' keyword")
fig.show()

fig.colorbar(mpl.cm.ScalarMappable(norm=norm, cmap=cmap),
cax=ax, orientation='horizontal',
label="Discrete intervals with extend='both' keyword")

###############################################################################
# Discrete intervals colorbar
Expand Down

0 comments on commit be7422b

Please sign in to comment.