From ccb788e2db3a2ee0b9bf02d07294c633f9c87663 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 7 Oct 2024 10:30:53 +0200 Subject: [PATCH] In colorbar docs, add ref from 'boundaries' doc to 'spacing' doc. The `spacing` kwarg only makes sense in relation to `boundaries`, so put the docs for them next to one another and add an explicit reference from `boundaries` to `spacing`. (The order of the kwargs in the signature did not change, because it already doesn't match the docs anyways; reordering them could be done separately.) --- lib/matplotlib/colorbar.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 2d2fe42dd16a..89e511fa1428 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -86,11 +86,6 @@ If *False* the minimum and maximum colorbar extensions will be triangular (the default). If *True* the extensions will be rectangular. -spacing : {'uniform', 'proportional'} - For discrete colorbars (`.BoundaryNorm` or contours), 'uniform' gives each - color the same space; 'proportional' makes the space proportional to the - data interval. - ticks : None or list of ticks or Locator If None, ticks are determined automatically from the input. @@ -109,9 +104,15 @@ If unset, the colormap will be displayed on a 0-1 scale. If sequences, *values* must have a length 1 less than *boundaries*. For each region delimited by adjacent entries in *boundaries*, the color mapped - to the corresponding value in values will be used. + to the corresponding value in *values* will be used. The size of each + region is determined by the *spacing* parameter. Normally only useful for indexed colors (i.e. ``norm=NoNorm()``) or other - unusual circumstances.""") + unusual circumstances. + +spacing : {'uniform', 'proportional'} + For discrete colorbars (`.BoundaryNorm` or contours), 'uniform' gives each + color the same space; 'proportional' makes the space proportional to the + data interval.""") def _set_ticks_on_axis_warn(*args, **kwargs):