@@ -226,15 +226,26 @@ class Colorbar:
226
226
mappable : `.ScalarMappable`
227
227
The mappable whose colormap and norm will be used.
228
228
229
- To show the under- and over- value colors, the mappable's norm should
230
- be specified as ::
229
+ To show the colors versus index instead of on a 0-1 scale, set the
230
+ mappable's norm to ``colors.NoNorm()``.
231
231
232
- norm = colors.Normalize(clip=False)
232
+ alpha : float
233
+ The colorbar transparency between 0 (transparent) and 1 (opaque).
234
+
235
+ location : None or {'left', 'right', 'top', 'bottom'}
236
+ Set the colorbar's *orientation* and *ticklocation*. Colorbars on
237
+ the left and right are vertical, colorbars at the top and bottom
238
+ are horizontal. The *ticklocation* is the same as *location*, so if
239
+ *location* is 'top', the ticks are on the top. *orientation* and/or
240
+ *ticklocation* can be provided as well and overrides the value set by
241
+ *location*, but there will be an error for incompatible combinations.
233
242
234
- To show the colors versus index instead of on a 0-1 scale, use::
243
+ .. versionadded:: 3.7
235
244
236
- norm=colors.NoNorm()
245
+ %(_colormap_kw_doc)s
237
246
247
+ Other Parameters
248
+ ----------------
238
249
cmap : `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
239
250
The colormap to use. This parameter is ignored, unless *mappable* is
240
251
None.
@@ -243,9 +254,6 @@ class Colorbar:
243
254
The normalization to use. This parameter is ignored, unless *mappable*
244
255
is None.
245
256
246
- alpha : float
247
- The colorbar transparency between 0 (transparent) and 1 (opaque).
248
-
249
257
orientation : None or {'vertical', 'horizontal'}
250
258
If None, use the value determined by *location*. If both
251
259
*orientation* and *location* are None then defaults to 'vertical'.
@@ -257,40 +265,27 @@ class Colorbar:
257
265
*location*, so a colorbar to the left will have ticks to the left. If
258
266
*location* is None, the ticks will be at the bottom for a horizontal
259
267
colorbar and at the right for a vertical.
260
-
261
- %(_colormap_kw_doc)s
262
-
263
- location : None or {'left', 'right', 'top', 'bottom'}
264
- Set the *orientation* and *ticklocation* of the colorbar using a
265
- single argument. Colorbars on the left and right are vertical,
266
- colorbars at the top and bottom are horizontal. The *ticklocation* is
267
- the same as *location*, so if *location* is 'top', the ticks are on
268
- the top. *orientation* and/or *ticklocation* can be provided as well
269
- and overrides the value set by *location*, but there will be an error
270
- for incompatible combinations.
271
-
272
- .. versionadded:: 3.7
273
268
"""
274
269
275
270
n_rasterize = 50 # rasterize solids if number of colors >= n_rasterize
276
271
277
- def __init__ (self , ax , mappable = None , * , cmap = None ,
278
- norm = None ,
279
- alpha = None ,
280
- values = None ,
281
- boundaries = None ,
282
- orientation = None ,
283
- ticklocation = 'auto' ,
284
- extend = None ,
285
- spacing = 'uniform' , # uniform or proportional
286
- ticks = None ,
287
- format = None ,
288
- drawedges = False ,
289
- extendfrac = None ,
290
- extendrect = False ,
291
- label = '' ,
292
- location = None ,
293
- ):
272
+ def __init__ (
273
+ self , ax , mappable = None , * ,
274
+ alpha = None ,
275
+ location = None ,
276
+ extend = None ,
277
+ extendfrac = None ,
278
+ extendrect = False ,
279
+ ticks = None ,
280
+ format = None ,
281
+ values = None ,
282
+ boundaries = None ,
283
+ spacing = 'uniform' ,
284
+ drawedges = False ,
285
+ label = '' ,
286
+ cmap = None , norm = None , # redundant with *mappable*
287
+ orientation = None , ticklocation = 'auto' , # redundant with * location*
288
+ ):
294
289
295
290
if mappable is None :
296
291
mappable = cm .ScalarMappable (norm = norm , cmap = cmap )
0 commit comments