Merge Colorbar and ColorbarBase. · matplotlib/matplotlib@7ca1f75 · GitHub
Skip to content

Commit 7ca1f75

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 29da23a commit 7ca1f75

3 files changed

Lines changed: 157 additions & 175 deletions

File tree

examples/color/colorbar_basics.py

Lines changed: 2 additions & 2 deletions

examples/images_contours_and_fields/image_masked.py

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)