FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Backport PR #29662 on branch v3.10.x (DOC: Move Colorbar parameters to __init__) by meeseeksmachine · Pull Request #29675 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
98 changes: 49 additions & 49 deletions lib/matplotlib/colorbar.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -217,54 +217,6 @@ class Colorbar:
A list of `.LineCollection` (empty if no lines were drawn).
dividers : `.LineCollection`
A LineCollection (empty if *drawedges* is ``False``).

Parameters
----------
ax : `~matplotlib.axes.Axes`
The `~.axes.Axes` instance in which the colorbar is drawn.

mappable : `.ScalarMappable`
The mappable whose colormap and norm will be used.

To show the colors versus index instead of on a 0-1 scale, set the
mappable's norm to ``colors.NoNorm()``.

alpha : float
The colorbar transparency between 0 (transparent) and 1 (opaque).

location : None or {'left', 'right', 'top', 'bottom'}
Set the colorbar's *orientation* and *ticklocation*. Colorbars on
the left and right are vertical, colorbars at the top and bottom
are horizontal. The *ticklocation* is the same as *location*, so if
*location* is 'top', the ticks are on the top. *orientation* and/or
*ticklocation* can be provided as well and overrides the value set by
*location*, but there will be an error for incompatible combinations.

.. versionadded:: 3.7

%(_colormap_kw_doc)s

Other Parameters
----------------
cmap : `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
The colormap to use. This parameter is ignored, unless *mappable* is
None.

norm : `~matplotlib.colors.Normalize`
The normalization to use. This parameter is ignored, unless *mappable*
is None.

orientation : None or {'vertical', 'horizontal'}
If None, use the value determined by *location*. If both
*orientation* and *location* are None then defaults to 'vertical'.

ticklocation : {'auto', 'left', 'right', 'top', 'bottom'}
The location of the colorbar ticks. The *ticklocation* must match
*orientation*. For example, a horizontal colorbar can only have ticks
at the top or the bottom. If 'auto', the ticks will be the same as
*location*, so a colorbar to the left will have ticks to the left. If
*location* is None, the ticks will be at the bottom for a horizontal
colorbar and at the right for a vertical.
"""

n_rasterize = 50 # rasterize solids if number of colors >= n_rasterize
Expand All @@ -286,7 +238,55 @@ def __init__(
cmap=None, norm=None, # redundant with *mappable*
orientation=None, ticklocation='auto', # redundant with *location*
):

"""
Parameters
----------
ax : `~matplotlib.axes.Axes`
The `~.axes.Axes` instance in which the colorbar is drawn.

mappable : `.ScalarMappable`
The mappable whose colormap and norm will be used.

To show the colors versus index instead of on a 0-1 scale, set the
mappable's norm to ``colors.NoNorm()``.

alpha : float
The colorbar transparency between 0 (transparent) and 1 (opaque).

location : None or {'left', 'right', 'top', 'bottom'}
Set the colorbar's *orientation* and *ticklocation*. Colorbars on
the left and right are vertical, colorbars at the top and bottom
are horizontal. The *ticklocation* is the same as *location*, so if
*location* is 'top', the ticks are on the top. *orientation* and/or
*ticklocation* can be provided as well and overrides the value set by
*location*, but there will be an error for incompatible combinations.

.. versionadded:: 3.7

%(_colormap_kw_doc)s

Other Parameters
----------------
cmap : `~matplotlib.colors.Colormap`, default: :rc:`image.cmap`
The colormap to use. This parameter is ignored, unless *mappable* is
None.

norm : `~matplotlib.colors.Normalize`
The normalization to use. This parameter is ignored, unless *mappable*
is None.

orientation : None or {'vertical', 'horizontal'}
If None, use the value determined by *location*. If both
*orientation* and *location* are None then defaults to 'vertical'.

ticklocation : {'auto', 'left', 'right', 'top', 'bottom'}
The location of the colorbar ticks. The *ticklocation* must match
*orientation*. For example, a horizontal colorbar can only have ticks
at the top or the bottom. If 'auto', the ticks will be the same as
*location*, so a colorbar to the left will have ticks to the left. If
*location* is None, the ticks will be at the bottom for a horizontal
colorbar and at the right for a vertical.
"""
if mappable is None:
mappable = cm.ScalarMappable(norm=norm, cmap=cmap)

Expand Down

Back | FazBrowse Home | New Git URL