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

Skip to content

Commit 91903b5

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 f008953 commit 91903b5

File tree

6 files changed

+166
-178
lines changed

6 files changed

+166
-178
lines changed

doc/users/prev_whats_new/whats_new_3.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ frame. Padding and separation parameters can be adjusted.
6060
Add ``minorticks_on()/off()`` methods for colorbar
6161
--------------------------------------------------
6262

63-
A new method `~.colorbar.ColorbarBase.minorticks_on` has been added to
63+
A new method ``ColorbarBase.minorticks_on`` has been added to
6464
correctly display minor ticks on a colorbar. This method doesn't allow the
6565
minor ticks to extend into the regions beyond vmin and vmax when the *extend*
6666
keyword argument (used while creating the colorbar) is set to 'both', 'max' or
67-
'min'. A complementary method `~.colorbar.ColorbarBase.minorticks_off` has
67+
'min'. A complementary method ``ColorbarBase.minorticks_off`` has
6868
also been added to remove the minor ticks on the colorbar.
6969

7070

doc/users/prev_whats_new/whats_new_3.3.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ Align labels to Axes edges
285285
--------------------------
286286

287287
`~.axes.Axes.set_xlabel`, `~.axes.Axes.set_ylabel` and
288-
`.ColorbarBase.set_label` support a parameter ``loc`` for simplified
288+
``ColorbarBase.set_label`` support a parameter ``loc`` for simplified
289289
positioning. For the xlabel, the supported values are 'left', 'center', or
290290
'right'. For the ylabel, the supported values are 'bottom', 'center', or
291291
'top'.

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)