Make all parameters of ColorbarBase, except `ax`, keyword-only. · matplotlib/matplotlib@84a3327 · GitHub
Skip to content

Commit 84a3327

Browse files
committed
Make all parameters of ColorbarBase, except ax, keyword-only.
This is consistent with Colorbar. Moreover, this will make it possibly to ultimately merge Colorbar into ColorbarBase -- currently, they only differ by the fact that a ColorbarBase doesn't have an associated ScalarMappable, but we can just construct an empty ScalarMappable in that case (this is already what we document as recommended approach to construct colorbars not attached to an artist -- `fig.colorbar(ScalarMappable(norm=..., cmap=...))`. Right now this merging is *nearly* possible except for the fact that the constructors' signatures are a pain to combine.
1 parent f369b10 commit 84a3327

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

doc/api/api_changes_3.3/deprecations.rst

Lines changed: 5 additions & 0 deletions

lib/matplotlib/colorbar.py

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)