diff --git a/doc/api/api_changes_3.3/deprecations.rst b/doc/api/api_changes_3.3/deprecations.rst index a1c40be2b6d6..adf6337deca9 100644 --- a/doc/api/api_changes_3.3/deprecations.rst +++ b/doc/api/api_changes_3.3/deprecations.rst @@ -455,3 +455,8 @@ replaced by calls to ``draw_idle()`` on the corresponding canvas. ~~~~~~~~~~~~~~~~~~~~~~~~~~ The ``add_checker`` and ``check_update`` methods and ``update_dict`` attribute of `.ScalarMappable` are deprecated. + +``ColorbarBase`` parameters will become keyword-only +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +All parameters of ``ColorbarBase``, except for the first (*ax*), will become +keyword-only, consistently with ``Colorbar``. diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 09e7d3bd9e69..b49451e67e89 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -394,6 +394,7 @@ class ColorbarBase: n_rasterize = 50 # rasterize solids if number of colors >= n_rasterize + @cbook._make_keyword_only("3.3", "cmap") def __init__(self, ax, cmap=None, norm=None, alpha=None, diff --git a/lib/matplotlib/tests/test_colorbar.py b/lib/matplotlib/tests/test_colorbar.py index 61b3efa3d3de..2a234cf7c0e9 100644 --- a/lib/matplotlib/tests/test_colorbar.py +++ b/lib/matplotlib/tests/test_colorbar.py @@ -226,7 +226,7 @@ def test_remove_from_figure(use_gridspec): def test_colorbarbase(): # smoke test from #3805 ax = plt.gca() - ColorbarBase(ax, plt.cm.bone) + ColorbarBase(ax, cmap=plt.cm.bone) @image_comparison(['colorbar_closed_patch'], remove_text=True)