r""" Draw a colorbar in an existing Axes. Typically, colorbars are created using `.Figure.colorbar` or `.pyplot.colorbar` and associated with `.ColorizingArtist`\s (such as an `.AxesImage` generated via `~.axes.Axes.imshow`). In order to draw a colorbar not associated with othe
| 208 | |
| 209 | @_docstring.interpd |
| 210 | class Colorbar: |
| 211 | r""" |
| 212 | Draw a colorbar in an existing Axes. |
| 213 | |
| 214 | Typically, colorbars are created using `.Figure.colorbar` or |
| 215 | `.pyplot.colorbar` and associated with `.ColorizingArtist`\s (such as an |
| 216 | `.AxesImage` generated via `~.axes.Axes.imshow`). |
| 217 | |
| 218 | In order to draw a colorbar not associated with other elements in the |
| 219 | figure, e.g. when showing a colormap by itself, one can create an empty |
| 220 | `.ColorizingArtist`, or directly pass *cmap* and *norm* instead of *mappable* |
| 221 | to `Colorbar`. |
| 222 | |
| 223 | Useful public methods are :meth:`set_label` and :meth:`add_lines`. |
| 224 | |
| 225 | Attributes |
| 226 | ---------- |
| 227 | ax : `~matplotlib.axes.Axes` |
| 228 | The `~.axes.Axes` instance in which the colorbar is drawn. |
| 229 | lines : list |
| 230 | A list of `.LineCollection` (empty if no lines were drawn). |
| 231 | dividers : `.LineCollection` |
| 232 | A LineCollection (empty if *drawedges* is ``False``). |
| 233 | """ |
| 234 | |
| 235 | n_rasterize = 50 # rasterize solids if number of colors >= n_rasterize |
| 236 | |
| 237 | def __init__( |
| 238 | self, ax, mappable=None, *, |
| 239 | alpha=None, |
| 240 | location=None, |
| 241 | extend=None, |
| 242 | extendfrac=None, |
| 243 | extendrect=False, |
| 244 | ticks=None, |
| 245 | format=None, |
| 246 | values=None, |
| 247 | boundaries=None, |
| 248 | spacing='uniform', |
| 249 | drawedges=False, |
| 250 | label='', |
| 251 | cmap=None, norm=None, # redundant with *mappable* |
| 252 | orientation=None, ticklocation='auto', # redundant with *location* |
| 253 | ): |
| 254 | """ |
| 255 | Parameters |
| 256 | ---------- |
| 257 | ax : `~matplotlib.axes.Axes` |
| 258 | The `~.axes.Axes` instance in which the colorbar is drawn. |
| 259 | |
| 260 | mappable : `.ColorizingArtist` |
| 261 | The mappable whose colormap and norm will be used. |
| 262 | |
| 263 | To show the colors versus index instead of on a 0-1 scale, set the |
| 264 | mappable's norm to ``colors.NoNorm()``. |
| 265 | |
| 266 | alpha : float |
| 267 | The colorbar transparency between 0 (transparent) and 1 (opaque). |
no outgoing calls
searching dependent graphs…