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

Skip to content

Commit 6e76ae6

Browse files
committed
Merge Colorbar and ColorbarBase.
ColorbarBase differs from Colorbar in that it is not associated with a ScalarMappable (but constructed from explicit cmap/norm), but we already document in Figure.colorbar that the preferred way to draw colorbars not associated with an existing artist is to create an empty ScalarMappable to provide `norm` and `cmap`. Hence, likewise merge Colorbar and ColorbarBase (creating the ScalarMappable on-the-fly if no mappable is passed to the constructor), which should make the APIs clearer. (Note that we are already discouraging users to directly call either class' constructors, anyways). We could deprecate the backcompat APIs (i.e., the `ColorbarBase` alias, the `cmap` and `norm` kwargs, and the different semantics of `add_lines`), but that can be done later; this PR should be entirely backcompatible.
1 parent a3fbf18 commit 6e76ae6

File tree

3 files changed

+157
-175
lines changed

3 files changed

+157
-175
lines changed

examples/color/colorbar_basics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@
5454
#
5555
# - `matplotlib.axes.Axes.imshow` / `matplotlib.pyplot.imshow`
5656
# - `matplotlib.figure.Figure.colorbar` / `matplotlib.pyplot.colorbar`
57-
# - `matplotlib.colorbar.ColorbarBase.minorticks_on`
58-
# - `matplotlib.colorbar.ColorbarBase.minorticks_off`
57+
# - `matplotlib.colorbar.Colorbar.minorticks_on`
58+
# - `matplotlib.colorbar.Colorbar.minorticks_off`

examples/images_contours_and_fields/image_masked.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@
7979
# - `matplotlib.axes.Axes.imshow` / `matplotlib.pyplot.imshow`
8080
# - `matplotlib.figure.Figure.colorbar` / `matplotlib.pyplot.colorbar`
8181
# - `matplotlib.colors.BoundaryNorm`
82-
# - `matplotlib.colorbar.ColorbarBase.set_label`
82+
# - `matplotlib.colorbar.Colorbar.set_label`

0 commit comments

Comments
 (0)