Skip to content

Commit 7f670ed

Browse files
authored
Merge pull request #17189 from anntzer/cbarbasekwo
Make all parameters of ColorbarBase, except `ax`, keyword-only.
2 parents 29aae1f + 6a70beb commit 7f670ed

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

doc/api/api_changes_3.3/deprecations.rst

+5
Original file line numberDiff line numberDiff line change
@@ -455,3 +455,8 @@ replaced by calls to ``draw_idle()`` on the corresponding canvas.
455455
~~~~~~~~~~~~~~~~~~~~~~~~~~
456456
The ``add_checker`` and ``check_update`` methods and ``update_dict`` attribute
457457
of `.ScalarMappable` are deprecated.
458+
459+
``ColorbarBase`` parameters will become keyword-only
460+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
461+
All parameters of ``ColorbarBase``, except for the first (*ax*), will become
462+
keyword-only, consistently with ``Colorbar``.

lib/matplotlib/colorbar.py

+1
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ class ColorbarBase:
394394

395395
n_rasterize = 50 # rasterize solids if number of colors >= n_rasterize
396396

397+
@cbook._make_keyword_only("3.3", "cmap")
397398
def __init__(self, ax, cmap=None,
398399
norm=None,
399400
alpha=None,

lib/matplotlib/tests/test_colorbar.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def test_remove_from_figure(use_gridspec):
226226
def test_colorbarbase():
227227
# smoke test from #3805
228228
ax = plt.gca()
229-
ColorbarBase(ax, plt.cm.bone)
229+
ColorbarBase(ax, cmap=plt.cm.bone)
230230

231231

232232
@image_comparison(['colorbar_closed_patch'], remove_text=True)

0 commit comments

Comments
 (0)