doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
matplotlib.pyplot.xlim matplotlib.pyplot.xlim(*args, **kwargs)[source]
Get or set the x limits of the current axes. Call signatures: left, right = xlim() # return the current xlim
xlim((left, right)) # set the xlim to left, right
xlim(left, right) # set the xlim to left, right
If you do not specify args, you can pass left or right as kwargs, i.e.: xlim(right=3) # adjust the right leaving left unchanged
xlim(left=1) # adjust the left leaving right unchanged
Setting limits turns autoscaling off for the x-axis. Returns
left, right
A tuple of the new x-axis limits. Notes Calling this function with no arguments (e.g. xlim()) is the pyplot equivalent of calling get_xlim on the current axes. Calling this function with arguments is the pyplot equivalent of calling set_xlim on the current axes. All arguments are passed though.
Examples using matplotlib.pyplot.xlim
Shared Axis
Infinite lines
Pyplot Text
Frame grabbing
Interactive functions | matplotlib._as_gen.matplotlib.pyplot.xlim |
matplotlib.pyplot.xscale matplotlib.pyplot.xscale(value, **kwargs)[source]
Set the x-axis scale. Parameters
value{"linear", "log", "symlog", "logit", ...} or ScaleBase
The axis scale type to apply. **kwargs
Different keyword arguments are accepted, depending on the scale. See the respective class keyword arguments: matplotlib.scale.LinearScale matplotlib.scale.LogScale matplotlib.scale.SymmetricalLogScale matplotlib.scale.LogitScale matplotlib.scale.FuncScale Notes By default, Matplotlib supports the above mentioned scales. Additionally, custom scales may be registered using matplotlib.scale.register_scale. These scales can then also be used here. | matplotlib._as_gen.matplotlib.pyplot.xscale |
matplotlib.pyplot.xticks matplotlib.pyplot.xticks(ticks=None, labels=None, **kwargs)[source]
Get or set the current tick locations and labels of the x-axis. Pass no arguments to return the current values without modifying them. Parameters
ticksarray-like, optional
The list of xtick locations. Passing an empty list removes all xticks.
labelsarray-like, optional
The labels to place at the given ticks locations. This argument can only be passed if ticks is passed as well. **kwargs
Text properties can be used to control the appearance of the labels. Returns
locs
The list of xtick locations. labels
The list of xlabel Text objects. Notes Calling this function with no arguments (e.g. xticks()) is the pyplot equivalent of calling get_xticks and get_xticklabels on the current axes. Calling this function with arguments is the pyplot equivalent of calling set_xticks and set_xticklabels on the current axes. Examples >>> locs, labels = xticks() # Get the current locations and labels.
>>> xticks(np.arange(0, 1, step=0.2)) # Set label locations.
>>> xticks(np.arange(3), ['Tom', 'Dick', 'Sue']) # Set text labels.
>>> xticks([0, 1, 2], ['January', 'February', 'March'],
... rotation=20) # Set text labels and properties.
>>> xticks([]) # Disable xticks.
Examples using matplotlib.pyplot.xticks
Secondary Axis
Table Demo
Rotating custom tick labels | matplotlib._as_gen.matplotlib.pyplot.xticks |
matplotlib.pyplot.ylabel matplotlib.pyplot.ylabel(ylabel, fontdict=None, labelpad=None, *, loc=None, **kwargs)[source]
Set the label for the y-axis. Parameters
ylabelstr
The label text.
labelpadfloat, default: rcParams["axes.labelpad"] (default: 4.0)
Spacing in points from the Axes bounding box including ticks and tick labels. If None, the previous value is left as is.
loc{'bottom', 'center', 'top'}, default: rcParams["yaxis.labellocation"] (default: 'center')
The label position. This is a high-level alternative for passing parameters y and horizontalalignment. Other Parameters
**kwargsText properties
Text properties control the appearance of the label. See also text
Documents the properties supported by Text.
Examples using matplotlib.pyplot.ylabel
Scatter Symbol
Multiple subplots
Controlling style of text and labels using a dictionary
Pyplot Mathtext
Pyplot Simple
Pyplot Text
Solarized Light stylesheet
Findobj Demo
Table Demo
Custom scale
Basic Usage
Pyplot tutorial | matplotlib._as_gen.matplotlib.pyplot.ylabel |
matplotlib.pyplot.ylim matplotlib.pyplot.ylim(*args, **kwargs)[source]
Get or set the y-limits of the current axes. Call signatures: bottom, top = ylim() # return the current ylim
ylim((bottom, top)) # set the ylim to bottom, top
ylim(bottom, top) # set the ylim to bottom, top
If you do not specify args, you can alternatively pass bottom or top as kwargs, i.e.: ylim(top=3) # adjust the top leaving bottom unchanged
ylim(bottom=1) # adjust the bottom leaving top unchanged
Setting limits turns autoscaling off for the y-axis. Returns
bottom, top
A tuple of the new y-axis limits. Notes Calling this function with no arguments (e.g. ylim()) is the pyplot equivalent of calling get_ylim on the current axes. Calling this function with arguments is the pyplot equivalent of calling set_ylim on the current axes. All arguments are passed though.
Examples using matplotlib.pyplot.ylim
Infinite lines
Pyplot Text
Frame grabbing
Interactive functions
Findobj Demo
Pyplot tutorial | matplotlib._as_gen.matplotlib.pyplot.ylim |
matplotlib.pyplot.yscale matplotlib.pyplot.yscale(value, **kwargs)[source]
Set the y-axis scale. Parameters
value{"linear", "log", "symlog", "logit", ...} or ScaleBase
The axis scale type to apply. **kwargs
Different keyword arguments are accepted, depending on the scale. See the respective class keyword arguments: matplotlib.scale.LinearScale matplotlib.scale.LogScale matplotlib.scale.SymmetricalLogScale matplotlib.scale.LogitScale matplotlib.scale.FuncScale Notes By default, Matplotlib supports the above mentioned scales. Additionally, custom scales may be registered using matplotlib.scale.register_scale. These scales can then also be used here.
Examples using matplotlib.pyplot.yscale
Custom scale
Pyplot tutorial | matplotlib._as_gen.matplotlib.pyplot.yscale |
matplotlib.pyplot.yticks matplotlib.pyplot.yticks(ticks=None, labels=None, **kwargs)[source]
Get or set the current tick locations and labels of the y-axis. Pass no arguments to return the current values without modifying them. Parameters
ticksarray-like, optional
The list of ytick locations. Passing an empty list removes all yticks.
labelsarray-like, optional
The labels to place at the given ticks locations. This argument can only be passed if ticks is passed as well. **kwargs
Text properties can be used to control the appearance of the labels. Returns
locs
The list of ytick locations. labels
The list of ylabel Text objects. Notes Calling this function with no arguments (e.g. yticks()) is the pyplot equivalent of calling get_yticks and get_yticklabels on the current axes. Calling this function with arguments is the pyplot equivalent of calling set_yticks and set_yticklabels on the current axes. Examples >>> locs, labels = yticks() # Get the current locations and labels.
>>> yticks(np.arange(0, 1, step=0.2)) # Set label locations.
>>> yticks(np.arange(3), ['Tom', 'Dick', 'Sue']) # Set text labels.
>>> yticks([0, 1, 2], ['January', 'February', 'March'],
... rotation=45) # Set text labels and properties.
>>> yticks([]) # Disable yticks.
Examples using matplotlib.pyplot.yticks
Table Demo | matplotlib._as_gen.matplotlib.pyplot.yticks |
matplotlib.quiver Support for plotting vector fields. Presently this contains Quiver and Barb. Quiver plots an arrow in the direction of the vector, with the size of the arrow related to the magnitude of the vector. Barbs are like quiver in that they point along a vector, but the magnitude of the vector is given schematically by the presence of barbs or flags on the barb. This will also become a home for things such as standard deviation ellipses, which can and will be derived very easily from the Quiver code. Classes
Quiver(ax, *args[, scale, headwidth, ...]) Specialized PolyCollection for arrows.
QuiverKey(Q, X, Y, U, label, *[, angle, ...]) Labelled arrow for use as a quiver plot scale key.
Barbs(ax, *args[, pivot, length, barbcolor, ...]) Specialized PolyCollection for barbs. | matplotlib.quiver_api |
matplotlib.quiver.Barbs classmatplotlib.quiver.Barbs(ax, *args, pivot='tip', length=7, barbcolor=None, flagcolor=None, sizes=None, fill_empty=False, barb_increments=None, rounding=True, flip_barb=False, **kw)[source]
Bases: matplotlib.collections.PolyCollection Specialized PolyCollection for barbs. The only API method is set_UVC(), which can be used to change the size, orientation, and color of the arrows. Locations are changed using the set_offsets() collection method. Possibly this method will be useful in animations. There is one internal function _find_tails() which finds exactly what should be put on the barb given the vector magnitude. From there _make_barbs() is used to find the vertices of the polygon to represent the barb based on this information. The constructor takes one required argument, an Axes instance, followed by the args and kwargs described by the following pyplot interface documentation: Plot a 2D field of barbs. Call signature: barbs([X, Y], U, V, [C], **kw)
Where X, Y define the barb locations, U, V define the barb directions, and C optionally sets the color. All arguments may be 1D or 2D. U, V, C may be masked arrays, but masked X, Y are not supported at present. Barbs are traditionally used in meteorology as a way to plot the speed and direction of wind observations, but can technically be used to plot any two dimensional vector quantity. As opposed to arrows, which give vector magnitude by the length of the arrow, the barbs give more quantitative information about the vector magnitude by putting slanted lines or a triangle for various increments in magnitude, as show schematically below: : /\ \
: / \ \
: / \ \ \
: / \ \ \
: ------------------------------
The largest increment is given by a triangle (or "flag"). After those come full lines (barbs). The smallest increment is a half line. There is only, of course, ever at most 1 half line. If the magnitude is small and only needs a single half-line and no full lines or triangles, the half-line is offset from the end of the barb so that it can be easily distinguished from barbs with a single full line. The magnitude for the barb shown above would nominally be 65, using the standard increments of 50, 10, and 5. See also https://en.wikipedia.org/wiki/Wind_barb. Parameters
X, Y1D or 2D array-like, optional
The x and y coordinates of the barb locations. See pivot for how the barbs are drawn to the x, y positions. If not given, they will be generated as a uniform integer meshgrid based on the dimensions of U and V. If X and Y are 1D but U, V are 2D, X, Y are expanded to 2D using X, Y = np.meshgrid(X, Y). In this case len(X) and len(Y) must match the column and row dimensions of U and V.
U, V1D or 2D array-like
The x and y components of the barb shaft.
C1D or 2D array-like, optional
Numeric data that defines the barb colors by colormapping via norm and cmap. This does not support explicit colors. If you want to set colors directly, use barbcolor instead.
lengthfloat, default: 7
Length of the barb in points; the other parts of the barb are scaled against this.
pivot{'tip', 'middle'} or float, default: 'tip'
The part of the arrow that is anchored to the X, Y grid. The barb rotates about this point. This can also be a number, which shifts the start of the barb that many points away from grid point.
barbcolorcolor or color sequence
The color of all parts of the barb except for the flags. This parameter is analogous to the edgecolor parameter for polygons, which can be used instead. However this parameter will override facecolor.
flagcolorcolor or color sequence
The color of any flags on the barb. This parameter is analogous to the facecolor parameter for polygons, which can be used instead. However, this parameter will override facecolor. If this is not set (and C has not either) then flagcolor will be set to match barbcolor so that the barb has a uniform color. If C has been set, flagcolor has no effect.
sizesdict, optional
A dictionary of coefficients specifying the ratio of a given feature to the length of the barb. Only those values one wishes to override need to be included. These features include: 'spacing' - space between features (flags, full/half barbs) 'height' - height (distance from shaft to top) of a flag or full barb 'width' - width of a flag, twice the width of a full barb 'emptybarb' - radius of the circle used for low magnitudes
fill_emptybool, default: False
Whether the empty barbs (circles) that are drawn should be filled with the flag color. If they are not filled, the center is transparent.
roundingbool, default: True
Whether the vector magnitude should be rounded when allocating barb components. If True, the magnitude is rounded to the nearest multiple of the half-barb increment. If False, the magnitude is simply truncated to the next lowest multiple.
barb_incrementsdict, optional
A dictionary of increments specifying values to associate with different parts of the barb. Only those values one wishes to override need to be included. 'half' - half barbs (Default is 5) 'full' - full barbs (Default is 10) 'flag' - flags (default is 50)
flip_barbbool or array-like of bool, default: False
Whether the lines and flags should point opposite to normal. Normal behavior is for the barbs and lines to point right (comes from wind barbs having these features point towards low pressure in the Northern Hemisphere). A single value is applied to all barbs. Individual barbs can be flipped by passing a bool array of the same size as U and V. Returns
barbsBarbs
Other Parameters
dataindexable object, optional
DATA_PARAMETER_PLACEHOLDER **kwargs
The barbs can further be customized using PolyCollection keyword arguments:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets (N, 2) or (2,) array-like
path_effects AbstractPathEffect
paths list of array-like
picker None or bool or float or callable
pickradius float
rasterized bool
sizes ndarray or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
verts list of array-like
verts_and_codes unknown
visible bool
zorder float barbs_doc='\nPlot a 2D field of barbs.\n\nCall signature::\n\n barbs([X, Y], U, V, [C], **kw)\n\nWhere *X*, *Y* define the barb locations, *U*, *V* define the barb\ndirections, and *C* optionally sets the color.\n\nAll arguments may be 1D or 2D. *U*, *V*, *C* may be masked arrays, but masked\n*X*, *Y* are not supported at present.\n\nBarbs are traditionally used in meteorology as a way to plot the speed\nand direction of wind observations, but can technically be used to\nplot any two dimensional vector quantity. As opposed to arrows, which\ngive vector magnitude by the length of the arrow, the barbs give more\nquantitative information about the vector magnitude by putting slanted\nlines or a triangle for various increments in magnitude, as show\nschematically below::\n\n : /\\ \\\n : / \\ \\\n : / \\ \\ \\\n : / \\ \\ \\\n : ------------------------------\n\nThe largest increment is given by a triangle (or "flag"). After those\ncome full lines (barbs). The smallest increment is a half line. There\nis only, of course, ever at most 1 half line. If the magnitude is\nsmall and only needs a single half-line and no full lines or\ntriangles, the half-line is offset from the end of the barb so that it\ncan be easily distinguished from barbs with a single full line. The\nmagnitude for the barb shown above would nominally be 65, using the\nstandard increments of 50, 10, and 5.\n\nSee also https://en.wikipedia.org/wiki/Wind_barb.\n\nParameters\n----------\nX, Y : 1D or 2D array-like, optional\n The x and y coordinates of the barb locations. See *pivot* for how the\n barbs are drawn to the x, y positions.\n\n If not given, they will be generated as a uniform integer meshgrid based\n on the dimensions of *U* and *V*.\n\n If *X* and *Y* are 1D but *U*, *V* are 2D, *X*, *Y* are expanded to 2D\n using ``X, Y = np.meshgrid(X, Y)``. In this case ``len(X)`` and ``len(Y)``\n must match the column and row dimensions of *U* and *V*.\n\nU, V : 1D or 2D array-like\n The x and y components of the barb shaft.\n\nC : 1D or 2D array-like, optional\n Numeric data that defines the barb colors by colormapping via *norm* and\n *cmap*.\n\n This does not support explicit colors. If you want to set colors directly,\n use *barbcolor* instead.\n\nlength : float, default: 7\n Length of the barb in points; the other parts of the barb\n are scaled against this.\n\npivot : {\'tip\', \'middle\'} or float, default: \'tip\'\n The part of the arrow that is anchored to the *X*, *Y* grid. The barb\n rotates about this point. This can also be a number, which shifts the\n start of the barb that many points away from grid point.\n\nbarbcolor : color or color sequence\n The color of all parts of the barb except for the flags. This parameter\n is analogous to the *edgecolor* parameter for polygons, which can be used\n instead. However this parameter will override facecolor.\n\nflagcolor : color or color sequence\n The color of any flags on the barb. This parameter is analogous to the\n *facecolor* parameter for polygons, which can be used instead. However,\n this parameter will override facecolor. If this is not set (and *C* has\n not either) then *flagcolor* will be set to match *barbcolor* so that the\n barb has a uniform color. If *C* has been set, *flagcolor* has no effect.\n\nsizes : dict, optional\n A dictionary of coefficients specifying the ratio of a given\n feature to the length of the barb. Only those values one wishes to\n override need to be included. These features include:\n\n - \'spacing\' - space between features (flags, full/half barbs)\n - \'height\' - height (distance from shaft to top) of a flag or full barb\n - \'width\' - width of a flag, twice the width of a full barb\n - \'emptybarb\' - radius of the circle used for low magnitudes\n\nfill_empty : bool, default: False\n Whether the empty barbs (circles) that are drawn should be filled with\n the flag color. If they are not filled, the center is transparent.\n\nrounding : bool, default: True\n Whether the vector magnitude should be rounded when allocating barb\n components. If True, the magnitude is rounded to the nearest multiple\n of the half-barb increment. If False, the magnitude is simply truncated\n to the next lowest multiple.\n\nbarb_increments : dict, optional\n A dictionary of increments specifying values to associate with\n different parts of the barb. Only those values one wishes to\n override need to be included.\n\n - \'half\' - half barbs (Default is 5)\n - \'full\' - full barbs (Default is 10)\n - \'flag\' - flags (default is 50)\n\nflip_barb : bool or array-like of bool, default: False\n Whether the lines and flags should point opposite to normal.\n Normal behavior is for the barbs and lines to point right (comes from wind\n barbs having these features point towards low pressure in the Northern\n Hemisphere).\n\n A single value is applied to all barbs. Individual barbs can be flipped by\n passing a bool array of the same size as *U* and *V*.\n\nReturns\n-------\nbarbs : `~matplotlib.quiver.Barbs`\n\nOther Parameters\n----------------\ndata : indexable object, optional\n DATA_PARAMETER_PLACEHOLDER\n\n**kwargs\n The barbs can further be customized using `.PolyCollection` keyword\n arguments:\n\n \n .. table::\n :class: property-table\n\n ================================================================================================= =====================================================================================================\n Property Description \n ================================================================================================= =====================================================================================================\n :meth:`agg_filter <matplotlib.artist.Artist.set_agg_filter>` a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array\n :meth:`alpha <matplotlib.collections.Collection.set_alpha>` array-like or scalar or None \n :meth:`animated <matplotlib.artist.Artist.set_animated>` bool \n :meth:`antialiased <matplotlib.collections.Collection.set_antialiased>` or aa or antialiaseds bool or list of bools \n :meth:`array <matplotlib.cm.ScalarMappable.set_array>` array-like or None \n :meth:`capstyle <matplotlib.collections.Collection.set_capstyle>` `.CapStyle` or {\'butt\', \'projecting\', \'round\'} \n :meth:`clim <matplotlib.cm.ScalarMappable.set_clim>` (vmin: float, vmax: float) \n :meth:`clip_box <matplotlib.artist.Artist.set_clip_box>` `.Bbox` \n :meth:`clip_on <matplotlib.artist.Artist.set_clip_on>` bool \n :meth:`clip_path <matplotlib.artist.Artist.set_clip_path>` Patch or (Path, Transform) or None \n :meth:`cmap <matplotlib.cm.ScalarMappable.set_cmap>` `.Colormap` or str or None \n :meth:`color <matplotlib.collections.Collection.set_color>` color or list of rgba tuples \n :meth:`edgecolor <matplotlib.collections.Collection.set_edgecolor>` or ec or edgecolors color or list of colors or \'face\' \n :meth:`facecolor <matplotlib.collections.Collection.set_facecolor>` or facecolors or fc color or list of colors \n :meth:`figure <matplotlib.artist.Artist.set_figure>` `.Figure` \n :meth:`gid <matplotlib.artist.Artist.set_gid>` str \n :meth:`hatch <matplotlib.collections.Collection.set_hatch>` {\'/\', \'\\\\\', \'|\', \'-\', \'+\', \'x\', \'o\', \'O\', \'.\', \'*\'} \n :meth:`in_layout <matplotlib.artist.Artist.set_in_layout>` bool \n :meth:`joinstyle <matplotlib.collections.Collection.set_joinstyle>` `.JoinStyle` or {\'miter\', \'round\', \'bevel\'} \n :meth:`label <matplotlib.artist.Artist.set_label>` object \n :meth:`linestyle <matplotlib.collections.Collection.set_linestyle>` or dashes or linestyles or ls str or tuple or list thereof \n :meth:`linewidth <matplotlib.collections.Collection.set_linewidth>` or linewidths or lw float or list of floats \n :meth:`norm <matplotlib.cm.ScalarMappable.set_norm>` `.Normalize` or None \n :meth:`offset_transform <matplotlib.collections.Collection.set_offset_transform>` `.Transform` \n :meth:`offsets <matplotlib.collections.Collection.set_offsets>` (N, 2) or (2,) array-like \n :meth:`path_effects <matplotlib.artist.Artist.set_path_effects>` `.AbstractPathEffect` \n :meth:`paths <matplotlib.collections.PolyCollection.set_verts>` list of array-like \n :meth:`picker <matplotlib.artist.Artist.set_picker>` None or bool or float or callable \n :meth:`pickradius <matplotlib.collections.Collection.set_pickradius>` float \n :meth:`rasterized <matplotlib.artist.Artist.set_rasterized>` bool \n :meth:`sizes <matplotlib.collections._CollectionWithSizes.set_sizes>` ndarray or None \n :meth:`sketch_params <matplotlib.artist.Artist.set_sketch_params>` (scale: float, length: float, randomness: float) \n :meth:`snap <matplotlib.artist.Artist.set_snap>` bool or None \n :meth:`transform <matplotlib.artist.Artist.set_transform>` `.Transform` \n :meth:`url <matplotlib.artist.Artist.set_url>` str \n :meth:`urls <matplotlib.collections.Collection.set_urls>` list of str or None \n :meth:`verts <matplotlib.collections.PolyCollection.set_verts>` list of array-like \n :meth:`verts_and_codes <matplotlib.collections.PolyCollection.set_verts_and_codes>` unknown \n :meth:`visible <matplotlib.artist.Artist.set_visible>` bool \n :meth:`zorder <matplotlib.artist.Artist.set_zorder>` float \n ================================================================================================= =====================================================================================================\n\n'
set(*, UVC=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sizes=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, verts=<UNSET>, verts_and_codes=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
UVC unknown
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets sequence of pairs of floats
path_effects AbstractPathEffect
paths list of array-like
picker None or bool or float or callable
pickradius float
rasterized bool
sizes ndarray or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
verts list of array-like
verts_and_codes unknown
visible bool
zorder float
set_UVC(U, V, C=None)[source]
set_offsets(xy)[source]
Set the offsets for the barb polygons. This saves the offsets passed in and masks them as appropriate for the existing U/V data. Parameters
xysequence of pairs of floats | matplotlib._as_gen.matplotlib.quiver.barbs |
barbs_doc='\nPlot a 2D field of barbs.\n\nCall signature::\n\n barbs([X, Y], U, V, [C], **kw)\n\nWhere *X*, *Y* define the barb locations, *U*, *V* define the barb\ndirections, and *C* optionally sets the color.\n\nAll arguments may be 1D or 2D. *U*, *V*, *C* may be masked arrays, but masked\n*X*, *Y* are not supported at present.\n\nBarbs are traditionally used in meteorology as a way to plot the speed\nand direction of wind observations, but can technically be used to\nplot any two dimensional vector quantity. As opposed to arrows, which\ngive vector magnitude by the length of the arrow, the barbs give more\nquantitative information about the vector magnitude by putting slanted\nlines or a triangle for various increments in magnitude, as show\nschematically below::\n\n : /\\ \\\n : / \\ \\\n : / \\ \\ \\\n : / \\ \\ \\\n : ------------------------------\n\nThe largest increment is given by a triangle (or "flag"). After those\ncome full lines (barbs). The smallest increment is a half line. There\nis only, of course, ever at most 1 half line. If the magnitude is\nsmall and only needs a single half-line and no full lines or\ntriangles, the half-line is offset from the end of the barb so that it\ncan be easily distinguished from barbs with a single full line. The\nmagnitude for the barb shown above would nominally be 65, using the\nstandard increments of 50, 10, and 5.\n\nSee also https://en.wikipedia.org/wiki/Wind_barb.\n\nParameters\n----------\nX, Y : 1D or 2D array-like, optional\n The x and y coordinates of the barb locations. See *pivot* for how the\n barbs are drawn to the x, y positions.\n\n If not given, they will be generated as a uniform integer meshgrid based\n on the dimensions of *U* and *V*.\n\n If *X* and *Y* are 1D but *U*, *V* are 2D, *X*, *Y* are expanded to 2D\n using ``X, Y = np.meshgrid(X, Y)``. In this case ``len(X)`` and ``len(Y)``\n must match the column and row dimensions of *U* and *V*.\n\nU, V : 1D or 2D array-like\n The x and y components of the barb shaft.\n\nC : 1D or 2D array-like, optional\n Numeric data that defines the barb colors by colormapping via *norm* and\n *cmap*.\n\n This does not support explicit colors. If you want to set colors directly,\n use *barbcolor* instead.\n\nlength : float, default: 7\n Length of the barb in points; the other parts of the barb\n are scaled against this.\n\npivot : {\'tip\', \'middle\'} or float, default: \'tip\'\n The part of the arrow that is anchored to the *X*, *Y* grid. The barb\n rotates about this point. This can also be a number, which shifts the\n start of the barb that many points away from grid point.\n\nbarbcolor : color or color sequence\n The color of all parts of the barb except for the flags. This parameter\n is analogous to the *edgecolor* parameter for polygons, which can be used\n instead. However this parameter will override facecolor.\n\nflagcolor : color or color sequence\n The color of any flags on the barb. This parameter is analogous to the\n *facecolor* parameter for polygons, which can be used instead. However,\n this parameter will override facecolor. If this is not set (and *C* has\n not either) then *flagcolor* will be set to match *barbcolor* so that the\n barb has a uniform color. If *C* has been set, *flagcolor* has no effect.\n\nsizes : dict, optional\n A dictionary of coefficients specifying the ratio of a given\n feature to the length of the barb. Only those values one wishes to\n override need to be included. These features include:\n\n - \'spacing\' - space between features (flags, full/half barbs)\n - \'height\' - height (distance from shaft to top) of a flag or full barb\n - \'width\' - width of a flag, twice the width of a full barb\n - \'emptybarb\' - radius of the circle used for low magnitudes\n\nfill_empty : bool, default: False\n Whether the empty barbs (circles) that are drawn should be filled with\n the flag color. If they are not filled, the center is transparent.\n\nrounding : bool, default: True\n Whether the vector magnitude should be rounded when allocating barb\n components. If True, the magnitude is rounded to the nearest multiple\n of the half-barb increment. If False, the magnitude is simply truncated\n to the next lowest multiple.\n\nbarb_increments : dict, optional\n A dictionary of increments specifying values to associate with\n different parts of the barb. Only those values one wishes to\n override need to be included.\n\n - \'half\' - half barbs (Default is 5)\n - \'full\' - full barbs (Default is 10)\n - \'flag\' - flags (default is 50)\n\nflip_barb : bool or array-like of bool, default: False\n Whether the lines and flags should point opposite to normal.\n Normal behavior is for the barbs and lines to point right (comes from wind\n barbs having these features point towards low pressure in the Northern\n Hemisphere).\n\n A single value is applied to all barbs. Individual barbs can be flipped by\n passing a bool array of the same size as *U* and *V*.\n\nReturns\n-------\nbarbs : `~matplotlib.quiver.Barbs`\n\nOther Parameters\n----------------\ndata : indexable object, optional\n DATA_PARAMETER_PLACEHOLDER\n\n**kwargs\n The barbs can further be customized using `.PolyCollection` keyword\n arguments:\n\n \n .. table::\n :class: property-table\n\n ================================================================================================= =====================================================================================================\n Property Description \n ================================================================================================= =====================================================================================================\n :meth:`agg_filter <matplotlib.artist.Artist.set_agg_filter>` a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array\n :meth:`alpha <matplotlib.collections.Collection.set_alpha>` array-like or scalar or None \n :meth:`animated <matplotlib.artist.Artist.set_animated>` bool \n :meth:`antialiased <matplotlib.collections.Collection.set_antialiased>` or aa or antialiaseds bool or list of bools \n :meth:`array <matplotlib.cm.ScalarMappable.set_array>` array-like or None \n :meth:`capstyle <matplotlib.collections.Collection.set_capstyle>` `.CapStyle` or {\'butt\', \'projecting\', \'round\'} \n :meth:`clim <matplotlib.cm.ScalarMappable.set_clim>` (vmin: float, vmax: float) \n :meth:`clip_box <matplotlib.artist.Artist.set_clip_box>` `.Bbox` \n :meth:`clip_on <matplotlib.artist.Artist.set_clip_on>` bool \n :meth:`clip_path <matplotlib.artist.Artist.set_clip_path>` Patch or (Path, Transform) or None \n :meth:`cmap <matplotlib.cm.ScalarMappable.set_cmap>` `.Colormap` or str or None \n :meth:`color <matplotlib.collections.Collection.set_color>` color or list of rgba tuples \n :meth:`edgecolor <matplotlib.collections.Collection.set_edgecolor>` or ec or edgecolors color or list of colors or \'face\' \n :meth:`facecolor <matplotlib.collections.Collection.set_facecolor>` or facecolors or fc color or list of colors \n :meth:`figure <matplotlib.artist.Artist.set_figure>` `.Figure` \n :meth:`gid <matplotlib.artist.Artist.set_gid>` str \n :meth:`hatch <matplotlib.collections.Collection.set_hatch>` {\'/\', \'\\\\\', \'|\', \'-\', \'+\', \'x\', \'o\', \'O\', \'.\', \'*\'} \n :meth:`in_layout <matplotlib.artist.Artist.set_in_layout>` bool \n :meth:`joinstyle <matplotlib.collections.Collection.set_joinstyle>` `.JoinStyle` or {\'miter\', \'round\', \'bevel\'} \n :meth:`label <matplotlib.artist.Artist.set_label>` object \n :meth:`linestyle <matplotlib.collections.Collection.set_linestyle>` or dashes or linestyles or ls str or tuple or list thereof \n :meth:`linewidth <matplotlib.collections.Collection.set_linewidth>` or linewidths or lw float or list of floats \n :meth:`norm <matplotlib.cm.ScalarMappable.set_norm>` `.Normalize` or None \n :meth:`offset_transform <matplotlib.collections.Collection.set_offset_transform>` `.Transform` \n :meth:`offsets <matplotlib.collections.Collection.set_offsets>` (N, 2) or (2,) array-like \n :meth:`path_effects <matplotlib.artist.Artist.set_path_effects>` `.AbstractPathEffect` \n :meth:`paths <matplotlib.collections.PolyCollection.set_verts>` list of array-like \n :meth:`picker <matplotlib.artist.Artist.set_picker>` None or bool or float or callable \n :meth:`pickradius <matplotlib.collections.Collection.set_pickradius>` float \n :meth:`rasterized <matplotlib.artist.Artist.set_rasterized>` bool \n :meth:`sizes <matplotlib.collections._CollectionWithSizes.set_sizes>` ndarray or None \n :meth:`sketch_params <matplotlib.artist.Artist.set_sketch_params>` (scale: float, length: float, randomness: float) \n :meth:`snap <matplotlib.artist.Artist.set_snap>` bool or None \n :meth:`transform <matplotlib.artist.Artist.set_transform>` `.Transform` \n :meth:`url <matplotlib.artist.Artist.set_url>` str \n :meth:`urls <matplotlib.collections.Collection.set_urls>` list of str or None \n :meth:`verts <matplotlib.collections.PolyCollection.set_verts>` list of array-like \n :meth:`verts_and_codes <matplotlib.collections.PolyCollection.set_verts_and_codes>` unknown \n :meth:`visible <matplotlib.artist.Artist.set_visible>` bool \n :meth:`zorder <matplotlib.artist.Artist.set_zorder>` float \n ================================================================================================= =====================================================================================================\n\n' | matplotlib._as_gen.matplotlib.quiver.barbs#matplotlib.quiver.Barbs.barbs_doc |
set(*, UVC=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sizes=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, verts=<UNSET>, verts_and_codes=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
UVC unknown
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets sequence of pairs of floats
path_effects AbstractPathEffect
paths list of array-like
picker None or bool or float or callable
pickradius float
rasterized bool
sizes ndarray or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
verts list of array-like
verts_and_codes unknown
visible bool
zorder float | matplotlib._as_gen.matplotlib.quiver.barbs#matplotlib.quiver.Barbs.set |
set_offsets(xy)[source]
Set the offsets for the barb polygons. This saves the offsets passed in and masks them as appropriate for the existing U/V data. Parameters
xysequence of pairs of floats | matplotlib._as_gen.matplotlib.quiver.barbs#matplotlib.quiver.Barbs.set_offsets |
set_UVC(U, V, C=None)[source] | matplotlib._as_gen.matplotlib.quiver.barbs#matplotlib.quiver.Barbs.set_UVC |
matplotlib.quiver.Quiver classmatplotlib.quiver.Quiver(ax, *args, scale=None, headwidth=3, headlength=5, headaxislength=4.5, minshaft=1, minlength=1, units='width', scale_units=None, angles='uv', width=None, color='k', pivot='tail', **kw)[source]
Bases: matplotlib.collections.PolyCollection Specialized PolyCollection for arrows. The only API method is set_UVC(), which can be used to change the size, orientation, and color of the arrows; their locations are fixed when the class is instantiated. Possibly this method will be useful in animations. Much of the work in this class is done in the draw() method so that as much information as possible is available about the plot. In subsequent draw() calls, recalculation is limited to things that might have changed, so there should be no performance penalty from putting the calculations in the draw() method. The constructor takes one required argument, an Axes instance, followed by the args and kwargs described by the following pyplot interface documentation: Plot a 2D field of arrows. Call signature: quiver([X, Y], U, V, [C], **kw)
X, Y define the arrow locations, U, V define the arrow directions, and C optionally sets the color. Each arrow is internally represented by a filled polygon with a default edge linewidth of 0. As a result, an arrow is rather a filled area, not a line with a head, and PolyCollection properties like linewidth, linestyle, facecolor, etc. act accordingly. Arrow size The default settings auto-scales the length of the arrows to a reasonable size. To change this behavior see the scale and scale_units parameters. Arrow shape The defaults give a slightly swept-back arrow; to make the head a triangle, make headaxislength the same as headlength. To make the arrow more pointed, reduce headwidth or increase headlength and headaxislength. To make the head smaller relative to the shaft, scale down all the head parameters. You will probably do best to leave minshaft alone. Arrow outline linewidths and edgecolors can be used to customize the arrow outlines. Parameters
X, Y1D or 2D array-like, optional
The x and y coordinates of the arrow locations. If not given, they will be generated as a uniform integer meshgrid based on the dimensions of U and V. If X and Y are 1D but U, V are 2D, X, Y are expanded to 2D using X, Y = np.meshgrid(X, Y). In this case len(X) and len(Y) must match the column and row dimensions of U and V.
U, V1D or 2D array-like
The x and y direction components of the arrow vectors. They must have the same number of elements, matching the number of arrow locations. U and V may be masked. Only locations unmasked in U, V, and C will be drawn.
C1D or 2D array-like, optional
Numeric data that defines the arrow colors by colormapping via norm and cmap. This does not support explicit colors. If you want to set colors directly, use color instead. The size of C must match the number of arrow locations.
units{'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, default: 'width'
The arrow dimensions (except for length) are measured in multiples of this unit. The following values are supported: 'width', 'height': The width or height of the axis. 'dots', 'inches': Pixels or inches based on the figure dpi. 'x', 'y', 'xy': X, Y or \(\sqrt{X^2 + Y^2}\) in data units. The arrows scale differently depending on the units. For 'x' or 'y', the arrows get larger as one zooms in; for other units, the arrow size is independent of the zoom state. For 'width or 'height', the arrow size increases with the width and height of the axes, respectively, when the window is resized; for 'dots' or 'inches', resizing does not change the arrows.
angles{'uv', 'xy'} or array-like, default: 'uv'
Method for determining the angle of the arrows.
'uv': The arrow axis aspect ratio is 1 so that if U == V the orientation of the arrow on the plot is 45 degrees counter-clockwise from the horizontal axis (positive to the right). Use this if the arrows symbolize a quantity that is not based on X, Y data coordinates. 'xy': Arrows point from (x, y) to (x+u, y+v). Use this for plotting a gradient field, for example.
Alternatively, arbitrary angles may be specified explicitly as an array of values in degrees, counter-clockwise from the horizontal axis. In this case U, V is only used to determine the length of the arrows. Note: inverting a data axis will correspondingly invert the arrows only with angles='xy'.
scalefloat, optional
Number of data units per arrow length unit, e.g., m/s per plot width; a smaller scale parameter makes the arrow longer. Default is None. If None, a simple autoscaling algorithm is used, based on the average vector length and the number of vectors. The arrow length unit is given by the scale_units parameter.
scale_units{'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, optional
If the scale kwarg is None, the arrow length unit. Default is None. e.g. scale_units is 'inches', scale is 2.0, and (u, v) = (1, 0), then the vector will be 0.5 inches long. If scale_units is 'width' or 'height', then the vector will be half the width/height of the axes. If scale_units is 'x' then the vector will be 0.5 x-axis units. To plot vectors in the x-y plane, with u and v having the same units as x and y, use angles='xy', scale_units='xy', scale=1.
widthfloat, optional
Shaft width in arrow units; default depends on choice of units, above, and number of vectors; a typical starting value is about 0.005 times the width of the plot.
headwidthfloat, default: 3
Head width as multiple of shaft width.
headlengthfloat, default: 5
Head length as multiple of shaft width.
headaxislengthfloat, default: 4.5
Head length at shaft intersection.
minshaftfloat, default: 1
Length below which arrow scales, in units of head length. Do not set this to less than 1, or small arrows will look terrible!
minlengthfloat, default: 1
Minimum length as a multiple of shaft width; if an arrow length is less than this, plot a dot (hexagon) of this diameter instead.
pivot{'tail', 'mid', 'middle', 'tip'}, default: 'tail'
The part of the arrow that is anchored to the X, Y grid. The arrow rotates about this point. 'mid' is a synonym for 'middle'.
colorcolor or color sequence, optional
Explicit color(s) for the arrows. If C has been set, color has no effect. This is a synonym for the PolyCollection facecolor parameter. Returns
Quiver
Other Parameters
dataindexable object, optional
DATA_PARAMETER_PLACEHOLDER
**kwargsPolyCollection properties, optional
All other keyword arguments are passed on to PolyCollection:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets (N, 2) or (2,) array-like
path_effects AbstractPathEffect
paths list of array-like
picker None or bool or float or callable
pickradius float
rasterized bool
sizes ndarray or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
verts list of array-like
verts_and_codes unknown
visible bool
zorder float See also Axes.quiverkey
Add a key to a quiver plot. draw(renderer)[source]
Draw the Artist (and its children) using the given renderer. This has no effect if the artist is not visible (Artist.get_visible returns False). Parameters
rendererRendererBase subclass.
Notes This method is overridden in the Artist subclasses.
get_datalim(transData)[source]
quiver_doc="\nPlot a 2D field of arrows.\n\nCall signature::\n\n quiver([X, Y], U, V, [C], **kw)\n\n*X*, *Y* define the arrow locations, *U*, *V* define the arrow directions, and\n*C* optionally sets the color.\n\nEach arrow is internally represented by a filled polygon with a default edge\nlinewidth of 0. As a result, an arrow is rather a filled area, not a line with\na head, and `.PolyCollection` properties like *linewidth*, *linestyle*,\n*facecolor*, etc. act accordingly.\n\n**Arrow size**\n\nThe default settings auto-scales the length of the arrows to a reasonable size.\nTo change this behavior see the *scale* and *scale_units* parameters.\n\n**Arrow shape**\n\nThe defaults give a slightly swept-back arrow; to make the head a\ntriangle, make *headaxislength* the same as *headlength*. To make the\narrow more pointed, reduce *headwidth* or increase *headlength* and\n*headaxislength*. To make the head smaller relative to the shaft,\nscale down all the head parameters. You will probably do best to leave\nminshaft alone.\n\n**Arrow outline**\n\n*linewidths* and *edgecolors* can be used to customize the arrow\noutlines.\n\nParameters\n----------\nX, Y : 1D or 2D array-like, optional\n The x and y coordinates of the arrow locations.\n\n If not given, they will be generated as a uniform integer meshgrid based\n on the dimensions of *U* and *V*.\n\n If *X* and *Y* are 1D but *U*, *V* are 2D, *X*, *Y* are expanded to 2D\n using ``X, Y = np.meshgrid(X, Y)``. In this case ``len(X)`` and ``len(Y)``\n must match the column and row dimensions of *U* and *V*.\n\nU, V : 1D or 2D array-like\n The x and y direction components of the arrow vectors.\n\n They must have the same number of elements, matching the number of arrow\n locations. *U* and *V* may be masked. Only locations unmasked in\n *U*, *V*, and *C* will be drawn.\n\nC : 1D or 2D array-like, optional\n Numeric data that defines the arrow colors by colormapping via *norm* and\n *cmap*.\n\n This does not support explicit colors. If you want to set colors directly,\n use *color* instead. The size of *C* must match the number of arrow\n locations.\n\nunits : {'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, default: 'width'\n The arrow dimensions (except for *length*) are measured in multiples of\n this unit.\n\n The following values are supported:\n\n - 'width', 'height': The width or height of the axis.\n - 'dots', 'inches': Pixels or inches based on the figure dpi.\n - 'x', 'y', 'xy': *X*, *Y* or :math:`\\sqrt{X^2 + Y^2}` in data units.\n\n The arrows scale differently depending on the units. For\n 'x' or 'y', the arrows get larger as one zooms in; for other\n units, the arrow size is independent of the zoom state. For\n 'width or 'height', the arrow size increases with the width and\n height of the axes, respectively, when the window is resized;\n for 'dots' or 'inches', resizing does not change the arrows.\n\nangles : {'uv', 'xy'} or array-like, default: 'uv'\n Method for determining the angle of the arrows.\n\n - 'uv': The arrow axis aspect ratio is 1 so that\n if *U* == *V* the orientation of the arrow on the plot is 45 degrees\n counter-clockwise from the horizontal axis (positive to the right).\n\n Use this if the arrows symbolize a quantity that is not based on\n *X*, *Y* data coordinates.\n\n - 'xy': Arrows point from (x, y) to (x+u, y+v).\n Use this for plotting a gradient field, for example.\n\n - Alternatively, arbitrary angles may be specified explicitly as an array\n of values in degrees, counter-clockwise from the horizontal axis.\n\n In this case *U*, *V* is only used to determine the length of the\n arrows.\n\n Note: inverting a data axis will correspondingly invert the\n arrows only with ``angles='xy'``.\n\nscale : float, optional\n Number of data units per arrow length unit, e.g., m/s per plot width; a\n smaller scale parameter makes the arrow longer. Default is *None*.\n\n If *None*, a simple autoscaling algorithm is used, based on the average\n vector length and the number of vectors. The arrow length unit is given by\n the *scale_units* parameter.\n\nscale_units : {'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, optional\n If the *scale* kwarg is *None*, the arrow length unit. Default is *None*.\n\n e.g. *scale_units* is 'inches', *scale* is 2.0, and ``(u, v) = (1, 0)``,\n then the vector will be 0.5 inches long.\n\n If *scale_units* is 'width' or 'height', then the vector will be half the\n width/height of the axes.\n\n If *scale_units* is 'x' then the vector will be 0.5 x-axis\n units. To plot vectors in the x-y plane, with u and v having\n the same units as x and y, use\n ``angles='xy', scale_units='xy', scale=1``.\n\nwidth : float, optional\n Shaft width in arrow units; default depends on choice of units,\n above, and number of vectors; a typical starting value is about\n 0.005 times the width of the plot.\n\nheadwidth : float, default: 3\n Head width as multiple of shaft width.\n\nheadlength : float, default: 5\n Head length as multiple of shaft width.\n\nheadaxislength : float, default: 4.5\n Head length at shaft intersection.\n\nminshaft : float, default: 1\n Length below which arrow scales, in units of head length. Do not\n set this to less than 1, or small arrows will look terrible!\n\nminlength : float, default: 1\n Minimum length as a multiple of shaft width; if an arrow length\n is less than this, plot a dot (hexagon) of this diameter instead.\n\npivot : {'tail', 'mid', 'middle', 'tip'}, default: 'tail'\n The part of the arrow that is anchored to the *X*, *Y* grid. The arrow\n rotates about this point.\n\n 'mid' is a synonym for 'middle'.\n\ncolor : color or color sequence, optional\n Explicit color(s) for the arrows. If *C* has been set, *color* has no\n effect.\n\n This is a synonym for the `.PolyCollection` *facecolor* parameter.\n\nOther Parameters\n----------------\ndata : indexable object, optional\n DATA_PARAMETER_PLACEHOLDER\n\n**kwargs : `~matplotlib.collections.PolyCollection` properties, optional\n All other keyword arguments are passed on to `.PolyCollection`:\n\n \n .. table::\n :class: property-table\n\n ================================================================================================= =====================================================================================================\n Property Description \n ================================================================================================= =====================================================================================================\n :meth:`agg_filter <matplotlib.artist.Artist.set_agg_filter>` a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array\n :meth:`alpha <matplotlib.collections.Collection.set_alpha>` array-like or scalar or None \n :meth:`animated <matplotlib.artist.Artist.set_animated>` bool \n :meth:`antialiased <matplotlib.collections.Collection.set_antialiased>` or aa or antialiaseds bool or list of bools \n :meth:`array <matplotlib.cm.ScalarMappable.set_array>` array-like or None \n :meth:`capstyle <matplotlib.collections.Collection.set_capstyle>` `.CapStyle` or {'butt', 'projecting', 'round'} \n :meth:`clim <matplotlib.cm.ScalarMappable.set_clim>` (vmin: float, vmax: float) \n :meth:`clip_box <matplotlib.artist.Artist.set_clip_box>` `.Bbox` \n :meth:`clip_on <matplotlib.artist.Artist.set_clip_on>` bool \n :meth:`clip_path <matplotlib.artist.Artist.set_clip_path>` Patch or (Path, Transform) or None \n :meth:`cmap <matplotlib.cm.ScalarMappable.set_cmap>` `.Colormap` or str or None \n :meth:`color <matplotlib.collections.Collection.set_color>` color or list of rgba tuples \n :meth:`edgecolor <matplotlib.collections.Collection.set_edgecolor>` or ec or edgecolors color or list of colors or 'face' \n :meth:`facecolor <matplotlib.collections.Collection.set_facecolor>` or facecolors or fc color or list of colors \n :meth:`figure <matplotlib.artist.Artist.set_figure>` `.Figure` \n :meth:`gid <matplotlib.artist.Artist.set_gid>` str \n :meth:`hatch <matplotlib.collections.Collection.set_hatch>` {'/', '\\\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} \n :meth:`in_layout <matplotlib.artist.Artist.set_in_layout>` bool \n :meth:`joinstyle <matplotlib.collections.Collection.set_joinstyle>` `.JoinStyle` or {'miter', 'round', 'bevel'} \n :meth:`label <matplotlib.artist.Artist.set_label>` object \n :meth:`linestyle <matplotlib.collections.Collection.set_linestyle>` or dashes or linestyles or ls str or tuple or list thereof \n :meth:`linewidth <matplotlib.collections.Collection.set_linewidth>` or linewidths or lw float or list of floats \n :meth:`norm <matplotlib.cm.ScalarMappable.set_norm>` `.Normalize` or None \n :meth:`offset_transform <matplotlib.collections.Collection.set_offset_transform>` `.Transform` \n :meth:`offsets <matplotlib.collections.Collection.set_offsets>` (N, 2) or (2,) array-like \n :meth:`path_effects <matplotlib.artist.Artist.set_path_effects>` `.AbstractPathEffect` \n :meth:`paths <matplotlib.collections.PolyCollection.set_verts>` list of array-like \n :meth:`picker <matplotlib.artist.Artist.set_picker>` None or bool or float or callable \n :meth:`pickradius <matplotlib.collections.Collection.set_pickradius>` float \n :meth:`rasterized <matplotlib.artist.Artist.set_rasterized>` bool \n :meth:`sizes <matplotlib.collections._CollectionWithSizes.set_sizes>` ndarray or None \n :meth:`sketch_params <matplotlib.artist.Artist.set_sketch_params>` (scale: float, length: float, randomness: float) \n :meth:`snap <matplotlib.artist.Artist.set_snap>` bool or None \n :meth:`transform <matplotlib.artist.Artist.set_transform>` `.Transform` \n :meth:`url <matplotlib.artist.Artist.set_url>` str \n :meth:`urls <matplotlib.collections.Collection.set_urls>` list of str or None \n :meth:`verts <matplotlib.collections.PolyCollection.set_verts>` list of array-like \n :meth:`verts_and_codes <matplotlib.collections.PolyCollection.set_verts_and_codes>` unknown \n :meth:`visible <matplotlib.artist.Artist.set_visible>` bool \n :meth:`zorder <matplotlib.artist.Artist.set_zorder>` float \n ================================================================================================= =====================================================================================================\n\n\nReturns\n-------\n`~matplotlib.quiver.Quiver`\n\nSee Also\n--------\n.Axes.quiverkey : Add a key to a quiver plot.\n"
remove()[source]
Remove the artist from the figure if possible. The effect will not be visible until the figure is redrawn, e.g., with FigureCanvasBase.draw_idle. Call relim to update the axes limits if desired. Note: relim will not see collections even if the collection was added to the axes with autolim = True. Note: there is no support for removing the artist's legend entry.
set(*, UVC=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sizes=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, verts=<UNSET>, verts_and_codes=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
UVC unknown
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets (N, 2) or (2,) array-like
path_effects AbstractPathEffect
paths list of array-like
picker None or bool or float or callable
pickradius float
rasterized bool
sizes ndarray or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
verts list of array-like
verts_and_codes unknown
visible bool
zorder float
set_UVC(U, V, C=None)[source]
Examples using matplotlib.quiver.Quiver
Advanced quiver and quiverkey functions
Quiver Simple Demo | matplotlib._as_gen.matplotlib.quiver.quiver |
draw(renderer)[source]
Draw the Artist (and its children) using the given renderer. This has no effect if the artist is not visible (Artist.get_visible returns False). Parameters
rendererRendererBase subclass.
Notes This method is overridden in the Artist subclasses. | matplotlib._as_gen.matplotlib.quiver.quiver#matplotlib.quiver.Quiver.draw |
get_datalim(transData)[source] | matplotlib._as_gen.matplotlib.quiver.quiver#matplotlib.quiver.Quiver.get_datalim |
quiver_doc="\nPlot a 2D field of arrows.\n\nCall signature::\n\n quiver([X, Y], U, V, [C], **kw)\n\n*X*, *Y* define the arrow locations, *U*, *V* define the arrow directions, and\n*C* optionally sets the color.\n\nEach arrow is internally represented by a filled polygon with a default edge\nlinewidth of 0. As a result, an arrow is rather a filled area, not a line with\na head, and `.PolyCollection` properties like *linewidth*, *linestyle*,\n*facecolor*, etc. act accordingly.\n\n**Arrow size**\n\nThe default settings auto-scales the length of the arrows to a reasonable size.\nTo change this behavior see the *scale* and *scale_units* parameters.\n\n**Arrow shape**\n\nThe defaults give a slightly swept-back arrow; to make the head a\ntriangle, make *headaxislength* the same as *headlength*. To make the\narrow more pointed, reduce *headwidth* or increase *headlength* and\n*headaxislength*. To make the head smaller relative to the shaft,\nscale down all the head parameters. You will probably do best to leave\nminshaft alone.\n\n**Arrow outline**\n\n*linewidths* and *edgecolors* can be used to customize the arrow\noutlines.\n\nParameters\n----------\nX, Y : 1D or 2D array-like, optional\n The x and y coordinates of the arrow locations.\n\n If not given, they will be generated as a uniform integer meshgrid based\n on the dimensions of *U* and *V*.\n\n If *X* and *Y* are 1D but *U*, *V* are 2D, *X*, *Y* are expanded to 2D\n using ``X, Y = np.meshgrid(X, Y)``. In this case ``len(X)`` and ``len(Y)``\n must match the column and row dimensions of *U* and *V*.\n\nU, V : 1D or 2D array-like\n The x and y direction components of the arrow vectors.\n\n They must have the same number of elements, matching the number of arrow\n locations. *U* and *V* may be masked. Only locations unmasked in\n *U*, *V*, and *C* will be drawn.\n\nC : 1D or 2D array-like, optional\n Numeric data that defines the arrow colors by colormapping via *norm* and\n *cmap*.\n\n This does not support explicit colors. If you want to set colors directly,\n use *color* instead. The size of *C* must match the number of arrow\n locations.\n\nunits : {'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, default: 'width'\n The arrow dimensions (except for *length*) are measured in multiples of\n this unit.\n\n The following values are supported:\n\n - 'width', 'height': The width or height of the axis.\n - 'dots', 'inches': Pixels or inches based on the figure dpi.\n - 'x', 'y', 'xy': *X*, *Y* or :math:`\\sqrt{X^2 + Y^2}` in data units.\n\n The arrows scale differently depending on the units. For\n 'x' or 'y', the arrows get larger as one zooms in; for other\n units, the arrow size is independent of the zoom state. For\n 'width or 'height', the arrow size increases with the width and\n height of the axes, respectively, when the window is resized;\n for 'dots' or 'inches', resizing does not change the arrows.\n\nangles : {'uv', 'xy'} or array-like, default: 'uv'\n Method for determining the angle of the arrows.\n\n - 'uv': The arrow axis aspect ratio is 1 so that\n if *U* == *V* the orientation of the arrow on the plot is 45 degrees\n counter-clockwise from the horizontal axis (positive to the right).\n\n Use this if the arrows symbolize a quantity that is not based on\n *X*, *Y* data coordinates.\n\n - 'xy': Arrows point from (x, y) to (x+u, y+v).\n Use this for plotting a gradient field, for example.\n\n - Alternatively, arbitrary angles may be specified explicitly as an array\n of values in degrees, counter-clockwise from the horizontal axis.\n\n In this case *U*, *V* is only used to determine the length of the\n arrows.\n\n Note: inverting a data axis will correspondingly invert the\n arrows only with ``angles='xy'``.\n\nscale : float, optional\n Number of data units per arrow length unit, e.g., m/s per plot width; a\n smaller scale parameter makes the arrow longer. Default is *None*.\n\n If *None*, a simple autoscaling algorithm is used, based on the average\n vector length and the number of vectors. The arrow length unit is given by\n the *scale_units* parameter.\n\nscale_units : {'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, optional\n If the *scale* kwarg is *None*, the arrow length unit. Default is *None*.\n\n e.g. *scale_units* is 'inches', *scale* is 2.0, and ``(u, v) = (1, 0)``,\n then the vector will be 0.5 inches long.\n\n If *scale_units* is 'width' or 'height', then the vector will be half the\n width/height of the axes.\n\n If *scale_units* is 'x' then the vector will be 0.5 x-axis\n units. To plot vectors in the x-y plane, with u and v having\n the same units as x and y, use\n ``angles='xy', scale_units='xy', scale=1``.\n\nwidth : float, optional\n Shaft width in arrow units; default depends on choice of units,\n above, and number of vectors; a typical starting value is about\n 0.005 times the width of the plot.\n\nheadwidth : float, default: 3\n Head width as multiple of shaft width.\n\nheadlength : float, default: 5\n Head length as multiple of shaft width.\n\nheadaxislength : float, default: 4.5\n Head length at shaft intersection.\n\nminshaft : float, default: 1\n Length below which arrow scales, in units of head length. Do not\n set this to less than 1, or small arrows will look terrible!\n\nminlength : float, default: 1\n Minimum length as a multiple of shaft width; if an arrow length\n is less than this, plot a dot (hexagon) of this diameter instead.\n\npivot : {'tail', 'mid', 'middle', 'tip'}, default: 'tail'\n The part of the arrow that is anchored to the *X*, *Y* grid. The arrow\n rotates about this point.\n\n 'mid' is a synonym for 'middle'.\n\ncolor : color or color sequence, optional\n Explicit color(s) for the arrows. If *C* has been set, *color* has no\n effect.\n\n This is a synonym for the `.PolyCollection` *facecolor* parameter.\n\nOther Parameters\n----------------\ndata : indexable object, optional\n DATA_PARAMETER_PLACEHOLDER\n\n**kwargs : `~matplotlib.collections.PolyCollection` properties, optional\n All other keyword arguments are passed on to `.PolyCollection`:\n\n \n .. table::\n :class: property-table\n\n ================================================================================================= =====================================================================================================\n Property Description \n ================================================================================================= =====================================================================================================\n :meth:`agg_filter <matplotlib.artist.Artist.set_agg_filter>` a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array\n :meth:`alpha <matplotlib.collections.Collection.set_alpha>` array-like or scalar or None \n :meth:`animated <matplotlib.artist.Artist.set_animated>` bool \n :meth:`antialiased <matplotlib.collections.Collection.set_antialiased>` or aa or antialiaseds bool or list of bools \n :meth:`array <matplotlib.cm.ScalarMappable.set_array>` array-like or None \n :meth:`capstyle <matplotlib.collections.Collection.set_capstyle>` `.CapStyle` or {'butt', 'projecting', 'round'} \n :meth:`clim <matplotlib.cm.ScalarMappable.set_clim>` (vmin: float, vmax: float) \n :meth:`clip_box <matplotlib.artist.Artist.set_clip_box>` `.Bbox` \n :meth:`clip_on <matplotlib.artist.Artist.set_clip_on>` bool \n :meth:`clip_path <matplotlib.artist.Artist.set_clip_path>` Patch or (Path, Transform) or None \n :meth:`cmap <matplotlib.cm.ScalarMappable.set_cmap>` `.Colormap` or str or None \n :meth:`color <matplotlib.collections.Collection.set_color>` color or list of rgba tuples \n :meth:`edgecolor <matplotlib.collections.Collection.set_edgecolor>` or ec or edgecolors color or list of colors or 'face' \n :meth:`facecolor <matplotlib.collections.Collection.set_facecolor>` or facecolors or fc color or list of colors \n :meth:`figure <matplotlib.artist.Artist.set_figure>` `.Figure` \n :meth:`gid <matplotlib.artist.Artist.set_gid>` str \n :meth:`hatch <matplotlib.collections.Collection.set_hatch>` {'/', '\\\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} \n :meth:`in_layout <matplotlib.artist.Artist.set_in_layout>` bool \n :meth:`joinstyle <matplotlib.collections.Collection.set_joinstyle>` `.JoinStyle` or {'miter', 'round', 'bevel'} \n :meth:`label <matplotlib.artist.Artist.set_label>` object \n :meth:`linestyle <matplotlib.collections.Collection.set_linestyle>` or dashes or linestyles or ls str or tuple or list thereof \n :meth:`linewidth <matplotlib.collections.Collection.set_linewidth>` or linewidths or lw float or list of floats \n :meth:`norm <matplotlib.cm.ScalarMappable.set_norm>` `.Normalize` or None \n :meth:`offset_transform <matplotlib.collections.Collection.set_offset_transform>` `.Transform` \n :meth:`offsets <matplotlib.collections.Collection.set_offsets>` (N, 2) or (2,) array-like \n :meth:`path_effects <matplotlib.artist.Artist.set_path_effects>` `.AbstractPathEffect` \n :meth:`paths <matplotlib.collections.PolyCollection.set_verts>` list of array-like \n :meth:`picker <matplotlib.artist.Artist.set_picker>` None or bool or float or callable \n :meth:`pickradius <matplotlib.collections.Collection.set_pickradius>` float \n :meth:`rasterized <matplotlib.artist.Artist.set_rasterized>` bool \n :meth:`sizes <matplotlib.collections._CollectionWithSizes.set_sizes>` ndarray or None \n :meth:`sketch_params <matplotlib.artist.Artist.set_sketch_params>` (scale: float, length: float, randomness: float) \n :meth:`snap <matplotlib.artist.Artist.set_snap>` bool or None \n :meth:`transform <matplotlib.artist.Artist.set_transform>` `.Transform` \n :meth:`url <matplotlib.artist.Artist.set_url>` str \n :meth:`urls <matplotlib.collections.Collection.set_urls>` list of str or None \n :meth:`verts <matplotlib.collections.PolyCollection.set_verts>` list of array-like \n :meth:`verts_and_codes <matplotlib.collections.PolyCollection.set_verts_and_codes>` unknown \n :meth:`visible <matplotlib.artist.Artist.set_visible>` bool \n :meth:`zorder <matplotlib.artist.Artist.set_zorder>` float \n ================================================================================================= =====================================================================================================\n\n\nReturns\n-------\n`~matplotlib.quiver.Quiver`\n\nSee Also\n--------\n.Axes.quiverkey : Add a key to a quiver plot.\n" | matplotlib._as_gen.matplotlib.quiver.quiver#matplotlib.quiver.Quiver.quiver_doc |
remove()[source]
Remove the artist from the figure if possible. The effect will not be visible until the figure is redrawn, e.g., with FigureCanvasBase.draw_idle. Call relim to update the axes limits if desired. Note: relim will not see collections even if the collection was added to the axes with autolim = True. Note: there is no support for removing the artist's legend entry. | matplotlib._as_gen.matplotlib.quiver.quiver#matplotlib.quiver.Quiver.remove |
set(*, UVC=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, array=<UNSET>, capstyle=<UNSET>, clim=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, cmap=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, norm=<UNSET>, offset_transform=<UNSET>, offsets=<UNSET>, path_effects=<UNSET>, paths=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sizes=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, urls=<UNSET>, verts=<UNSET>, verts_and_codes=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
UVC unknown
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha array-like or scalar or None
animated bool
antialiased or aa or antialiaseds bool or list of bools
array array-like or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clim (vmin: float, vmax: float)
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
cmap Colormap or str or None
color color or list of rgba tuples
edgecolor or ec or edgecolors color or list of colors or 'face'
facecolor or facecolors or fc color or list of colors
figure Figure
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or dashes or linestyles or ls str or tuple or list thereof
linewidth or linewidths or lw float or list of floats
norm Normalize or None
offset_transform Transform
offsets (N, 2) or (2,) array-like
path_effects AbstractPathEffect
paths list of array-like
picker None or bool or float or callable
pickradius float
rasterized bool
sizes ndarray or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
urls list of str or None
verts list of array-like
verts_and_codes unknown
visible bool
zorder float | matplotlib._as_gen.matplotlib.quiver.quiver#matplotlib.quiver.Quiver.set |
set_UVC(U, V, C=None)[source] | matplotlib._as_gen.matplotlib.quiver.quiver#matplotlib.quiver.Quiver.set_UVC |
matplotlib.quiver.QuiverKey classmatplotlib.quiver.QuiverKey(Q, X, Y, U, label, *, angle=0, coordinates='axes', color=None, labelsep=0.1, labelpos='N', labelcolor=None, fontproperties=None, **kw)[source]
Bases: matplotlib.artist.Artist Labelled arrow for use as a quiver plot scale key. Add a key to a quiver plot. The positioning of the key depends on X, Y, coordinates, and labelpos. If labelpos is 'N' or 'S', X, Y give the position of the middle of the key arrow. If labelpos is 'E', X, Y positions the head, and if labelpos is 'W', X, Y positions the tail; in either of these two cases, X, Y is somewhere in the middle of the arrow+label key object. Parameters
Qmatplotlib.quiver.Quiver
A Quiver object as returned by a call to quiver().
X, Yfloat
The location of the key.
Ufloat
The length of the key.
labelstr
The key label (e.g., length and units of the key).
anglefloat, default: 0
The angle of the key arrow, in degrees anti-clockwise from the x-axis.
coordinates{'axes', 'figure', 'data', 'inches'}, default: 'axes'
Coordinate system and units for X, Y: 'axes' and 'figure' are normalized coordinate systems with (0, 0) in the lower left and (1, 1) in the upper right; 'data' are the axes data coordinates (used for the locations of the vectors in the quiver plot itself); 'inches' is position in the figure in inches, with (0, 0) at the lower left corner.
colorcolor
Overrides face and edge colors from Q.
labelpos{'N', 'S', 'E', 'W'}
Position the label above, below, to the right, to the left of the arrow, respectively.
labelsepfloat, default: 0.1
Distance in inches between the arrow and the label.
labelcolorcolor, default: rcParams["text.color"] (default: 'black')
Label color.
fontpropertiesdict, optional
A dictionary with keyword arguments accepted by the FontProperties initializer: family, style, variant, size, weight. **kwargs
Any additional keyword arguments are used to override vector properties taken from Q. contains(mouseevent)[source]
Test whether the artist contains the mouse event. Parameters
mouseeventmatplotlib.backend_bases.MouseEvent
Returns
containsbool
Whether any values are within the radius.
detailsdict
An artist-specific dictionary of details of the event context, such as which points are contained in the pick radius. See the individual Artist subclasses for details.
draw(renderer)[source]
Draw the Artist (and its children) using the given renderer. This has no effect if the artist is not visible (Artist.get_visible returns False). Parameters
rendererRendererBase subclass.
Notes This method is overridden in the Artist subclasses.
halign={'E': 'left', 'N': 'center', 'S': 'center', 'W': 'right'}
pivot={'E': 'tip', 'N': 'middle', 'S': 'middle', 'W': 'tail'}
remove()[source]
Remove the artist from the figure if possible. The effect will not be visible until the figure is redrawn, e.g., with FigureCanvasBase.draw_idle. Call relim to update the axes limits if desired. Note: relim will not see collections even if the collection was added to the axes with autolim = True. Note: there is no support for removing the artist's legend entry.
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
figure unknown
gid str
in_layout bool
label object
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
set_figure(fig)[source]
Set the Figure instance the artist belongs to. Parameters
figFigure
valign={'E': 'center', 'N': 'bottom', 'S': 'top', 'W': 'center'}
Examples using matplotlib.quiver.QuiverKey
Advanced quiver and quiverkey functions | matplotlib._as_gen.matplotlib.quiver.quiverkey |
contains(mouseevent)[source]
Test whether the artist contains the mouse event. Parameters
mouseeventmatplotlib.backend_bases.MouseEvent
Returns
containsbool
Whether any values are within the radius.
detailsdict
An artist-specific dictionary of details of the event context, such as which points are contained in the pick radius. See the individual Artist subclasses for details. | matplotlib._as_gen.matplotlib.quiver.quiverkey#matplotlib.quiver.QuiverKey.contains |
draw(renderer)[source]
Draw the Artist (and its children) using the given renderer. This has no effect if the artist is not visible (Artist.get_visible returns False). Parameters
rendererRendererBase subclass.
Notes This method is overridden in the Artist subclasses. | matplotlib._as_gen.matplotlib.quiver.quiverkey#matplotlib.quiver.QuiverKey.draw |
halign={'E': 'left', 'N': 'center', 'S': 'center', 'W': 'right'} | matplotlib._as_gen.matplotlib.quiver.quiverkey#matplotlib.quiver.QuiverKey.halign |
pivot={'E': 'tip', 'N': 'middle', 'S': 'middle', 'W': 'tail'} | matplotlib._as_gen.matplotlib.quiver.quiverkey#matplotlib.quiver.QuiverKey.pivot |
remove()[source]
Remove the artist from the figure if possible. The effect will not be visible until the figure is redrawn, e.g., with FigureCanvasBase.draw_idle. Call relim to update the axes limits if desired. Note: relim will not see collections even if the collection was added to the axes with autolim = True. Note: there is no support for removing the artist's legend entry. | matplotlib._as_gen.matplotlib.quiver.quiverkey#matplotlib.quiver.QuiverKey.remove |
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
figure unknown
gid str
in_layout bool
label object
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float | matplotlib._as_gen.matplotlib.quiver.quiverkey#matplotlib.quiver.QuiverKey.set |
set_figure(fig)[source]
Set the Figure instance the artist belongs to. Parameters
figFigure | matplotlib._as_gen.matplotlib.quiver.quiverkey#matplotlib.quiver.QuiverKey.set_figure |
valign={'E': 'center', 'N': 'bottom', 'S': 'top', 'W': 'center'} | matplotlib._as_gen.matplotlib.quiver.quiverkey#matplotlib.quiver.QuiverKey.valign |
matplotlib.rc(group, **kwargs)[source]
Set the current rcParams. group is the grouping for the rc, e.g., for lines.linewidth the group is lines, for axes.facecolor, the group is axes, and so on. Group may also be a list or tuple of group names, e.g., (xtick, ytick). kwargs is a dictionary attribute name/value pairs, e.g.,: rc('lines', linewidth=2, color='r')
sets the current rcParams and is equivalent to: rcParams['lines.linewidth'] = 2
rcParams['lines.color'] = 'r'
The following aliases are available to save typing for interactive users:
Alias Property
'lw' 'linewidth'
'ls' 'linestyle'
'c' 'color'
'fc' 'facecolor'
'ec' 'edgecolor'
'mew' 'markeredgewidth'
'aa' 'antialiased' Thus you could abbreviate the above call as: rc('lines', lw=2, c='r')
Note you can use python's kwargs dictionary facility to store dictionaries of default parameters. e.g., you can customize the font rc as follows: font = {'family' : 'monospace',
'weight' : 'bold',
'size' : 'larger'}
rc('font', **font) # pass in the font dict as kwargs
This enables you to easily switch between several configurations. Use matplotlib.style.use('default') or rcdefaults() to restore the default rcParams after changes. Notes Similar functionality is available by using the normal dict interface, i.e. rcParams.update({"lines.linewidth": 2, ...}) (but rcParams.update does not support abbreviations or grouping). | matplotlib_configuration_api#matplotlib.rc |
matplotlib.rc_context(rc=None, fname=None)
Return a context manager for temporarily changing rcParams. Parameters
rcdict
The rcParams to temporarily set.
fnamestr or path-like
A file with Matplotlib rc settings. If both fname and rc are given, settings from rc take precedence. See also The matplotlibrc file
Examples Passing explicit values via a dict: with mpl.rc_context({'interactive': False}):
fig, ax = plt.subplots()
ax.plot(range(3), range(3))
fig.savefig('example.png')
plt.close(fig)
Loading settings from a file: with mpl.rc_context(fname='print.rc'):
plt.plot(x, y) # uses 'print.rc' | matplotlib_configuration_api#matplotlib.rc_context |
matplotlib.rc_file(fname, *, use_default_template=True)[source]
Update rcParams from file. Style-blacklisted rcParams (defined in matplotlib.style.core.STYLE_BLACKLIST) are not updated. Parameters
fnamestr or path-like
A file with Matplotlib rc settings.
use_default_templatebool
If True, initialize with default parameters before updating with those in the given file. If False, the current configuration persists and only the parameters specified in the file are updated. | matplotlib_configuration_api#matplotlib.rc_file |
matplotlib.rc_file_defaults()[source]
Restore the rcParams from the original rc file loaded by Matplotlib. Style-blacklisted rcParams (defined in matplotlib.style.core.STYLE_BLACKLIST) are not updated. | matplotlib_configuration_api#matplotlib.rc_file_defaults |
matplotlib.rc_params(fail_on_error=False)[source]
Construct a RcParams instance from the default Matplotlib rc file. | matplotlib_configuration_api#matplotlib.rc_params |
matplotlib.rc_params_from_file(fname, fail_on_error=False, use_default_template=True)[source]
Construct a RcParams from file fname. Parameters
fnamestr or path-like
A file with Matplotlib rc settings.
fail_on_errorbool
If True, raise an error when the parser fails to convert a parameter.
use_default_templatebool
If True, initialize with default parameters before updating with those in the given file. If False, the configuration class only contains the parameters specified in the file. (Useful for updating dicts.) | matplotlib_configuration_api#matplotlib.rc_params_from_file |
matplotlib.rcdefaults()[source]
Restore the rcParams from Matplotlib's internal default style. Style-blacklisted rcParams (defined in matplotlib.style.core.STYLE_BLACKLIST) are not updated. See also matplotlib.rc_file_defaults
Restore the rcParams from the rc file originally loaded by Matplotlib. matplotlib.style.use
Use a specific style file. Call style.use('default') to restore the default style. | matplotlib_configuration_api#matplotlib.rcdefaults |
matplotlib.rcParams[source]
An instance of RcParams for handling default Matplotlib values. | matplotlib_configuration_api#matplotlib.rcParams |
classmatplotlib.RcParams(*args, **kwargs)[source]
A dictionary object including validation. Validating functions are defined and associated with rc parameters in matplotlib.rcsetup. The list of rcParams is: _internal.classic_mode agg.path.chunksize animation.bitrate animation.codec animation.convert_args animation.convert_path animation.embed_limit animation.ffmpeg_args animation.ffmpeg_path animation.frame_format animation.html animation.writer axes.autolimit_mode axes.axisbelow axes.edgecolor axes.facecolor axes.formatter.limits axes.formatter.min_exponent axes.formatter.offset_threshold axes.formatter.use_locale axes.formatter.use_mathtext axes.formatter.useoffset axes.grid axes.grid.axis axes.grid.which axes.labelcolor axes.labelpad axes.labelsize axes.labelweight axes.linewidth axes.prop_cycle axes.spines.bottom axes.spines.left axes.spines.right axes.spines.top axes.titlecolor axes.titlelocation axes.titlepad axes.titlesize axes.titleweight axes.titley axes.unicode_minus axes.xmargin axes.ymargin axes.zmargin axes3d.grid backend backend_fallback boxplot.bootstrap boxplot.boxprops.color boxplot.boxprops.linestyle boxplot.boxprops.linewidth boxplot.capprops.color boxplot.capprops.linestyle boxplot.capprops.linewidth boxplot.flierprops.color boxplot.flierprops.linestyle boxplot.flierprops.linewidth boxplot.flierprops.marker boxplot.flierprops.markeredgecolor boxplot.flierprops.markeredgewidth boxplot.flierprops.markerfacecolor boxplot.flierprops.markersize boxplot.meanline boxplot.meanprops.color boxplot.meanprops.linestyle boxplot.meanprops.linewidth boxplot.meanprops.marker boxplot.meanprops.markeredgecolor boxplot.meanprops.markerfacecolor boxplot.meanprops.markersize boxplot.medianprops.color boxplot.medianprops.linestyle boxplot.medianprops.linewidth boxplot.notch boxplot.patchartist boxplot.showbox boxplot.showcaps boxplot.showfliers boxplot.showmeans boxplot.vertical boxplot.whiskerprops.color boxplot.whiskerprops.linestyle boxplot.whiskerprops.linewidth boxplot.whiskers contour.corner_mask contour.linewidth contour.negative_linestyle date.autoformatter.day date.autoformatter.hour date.autoformatter.microsecond date.autoformatter.minute date.autoformatter.month date.autoformatter.second date.autoformatter.year date.converter date.epoch date.interval_multiples docstring.hardcopy errorbar.capsize figure.autolayout figure.constrained_layout.h_pad figure.constrained_layout.hspace figure.constrained_layout.use figure.constrained_layout.w_pad figure.constrained_layout.wspace figure.dpi figure.edgecolor figure.facecolor figure.figsize figure.frameon figure.max_open_warning figure.raise_window figure.subplot.bottom figure.subplot.hspace figure.subplot.left figure.subplot.right figure.subplot.top figure.subplot.wspace figure.titlesize figure.titleweight font.cursive font.family font.fantasy font.monospace font.sans-serif font.serif font.size font.stretch font.style font.variant font.weight grid.alpha grid.color grid.linestyle grid.linewidth hatch.color hatch.linewidth hist.bins image.aspect image.cmap image.composite_image image.interpolation image.lut image.origin image.resample interactive keymap.back keymap.copy keymap.forward keymap.fullscreen keymap.grid keymap.grid_minor keymap.help keymap.home keymap.pan keymap.quit keymap.quit_all keymap.save keymap.xscale keymap.yscale keymap.zoom legend.borderaxespad legend.borderpad legend.columnspacing legend.edgecolor legend.facecolor legend.fancybox legend.fontsize legend.framealpha legend.frameon legend.handleheight legend.handlelength legend.handletextpad legend.labelcolor legend.labelspacing legend.loc legend.markerscale legend.numpoints legend.scatterpoints legend.shadow legend.title_fontsize lines.antialiased lines.color lines.dash_capstyle lines.dash_joinstyle lines.dashdot_pattern lines.dashed_pattern lines.dotted_pattern lines.linestyle lines.linewidth lines.marker lines.markeredgecolor lines.markeredgewidth lines.markerfacecolor lines.markersize lines.scale_dashes lines.solid_capstyle lines.solid_joinstyle markers.fillstyle mathtext.bf mathtext.cal mathtext.default mathtext.fallback mathtext.fontset mathtext.it mathtext.rm mathtext.sf mathtext.tt patch.antialiased patch.edgecolor patch.facecolor patch.force_edgecolor patch.linewidth path.effects path.simplify path.simplify_threshold path.sketch path.snap pcolor.shading pcolormesh.snap pdf.compression pdf.fonttype pdf.inheritcolor pdf.use14corefonts pgf.preamble pgf.rcfonts pgf.texsystem polaraxes.grid ps.distiller.res ps.fonttype ps.papersize ps.useafm ps.usedistiller savefig.bbox savefig.directory savefig.dpi savefig.edgecolor savefig.facecolor savefig.format savefig.orientation savefig.pad_inches savefig.transparent scatter.edgecolors scatter.marker svg.fonttype svg.hashsalt svg.image_inline text.antialiased text.color text.hinting text.hinting_factor text.kerning_factor text.latex.preamble text.usetex timezone tk.window_focus toolbar webagg.address webagg.open_in_browser webagg.port webagg.port_retries xaxis.labellocation xtick.alignment xtick.bottom xtick.color xtick.direction xtick.labelbottom xtick.labelcolor xtick.labelsize xtick.labeltop xtick.major.bottom xtick.major.pad xtick.major.size xtick.major.top xtick.major.width xtick.minor.bottom xtick.minor.pad xtick.minor.size xtick.minor.top xtick.minor.visible xtick.minor.width xtick.top yaxis.labellocation ytick.alignment ytick.color ytick.direction ytick.labelcolor ytick.labelleft ytick.labelright ytick.labelsize ytick.left ytick.major.left ytick.major.pad ytick.major.right ytick.major.size ytick.major.width ytick.minor.left ytick.minor.pad ytick.minor.right ytick.minor.size ytick.minor.visible ytick.minor.width ytick.right See also The matplotlibrc file
find_all(pattern)[source]
Return the subset of this RcParams dictionary whose keys match, using re.search(), the given pattern. Note Changes to the returned dictionary are not propagated to the parent RcParams dictionary. | matplotlib_configuration_api#matplotlib.RcParams |
find_all(pattern)[source]
Return the subset of this RcParams dictionary whose keys match, using re.search(), the given pattern. Note Changes to the returned dictionary are not propagated to the parent RcParams dictionary. | matplotlib_configuration_api#matplotlib.RcParams.find_all |
matplotlib.rcsetup The rcsetup module contains the validation code for customization using Matplotlib's rc settings. Each rc setting is assigned a function used to validate any attempted changes to that setting. The validation functions are defined in the rcsetup module, and are used to construct the rcParams global object which stores the settings and is referenced throughout Matplotlib. The default values of the rc settings are set in the default matplotlibrc file. Any additions or deletions to the parameter set listed here should also be propagated to the matplotlibrc.template in Matplotlib's root source directory. classmatplotlib.rcsetup.ValidateInStrings(key, valid, ignorecase=False, *, _deprecated_since=None)[source]
Bases: object valid is a list of legal strings.
matplotlib.rcsetup.cycler(*args, **kwargs)[source]
Create a Cycler object much like cycler.cycler(), but includes input validation. Call signatures: cycler(cycler)
cycler(label=values[, label2=values2[, ...]])
cycler(label, values)
Form 1 copies a given Cycler object. Form 2 creates a Cycler which cycles over one or more properties simultaneously. If multiple properties are given, their value lists must have the same length. Form 3 creates a Cycler for a single property. This form exists for compatibility with the original cycler. Its use is discouraged in favor of the kwarg form, i.e. cycler(label=values). Parameters
cyclerCycler
Copy constructor for Cycler.
labelstr
The property key. Must be a valid Artist property. For example, 'color' or 'linestyle'. Aliases are allowed, such as 'c' for 'color' and 'lw' for 'linewidth'.
valuesiterable
Finite-length iterable of the property values. These values are validated and will raise a ValueError if invalid. Returns
Cycler
A new Cycler for the given properties. Examples Creating a cycler for a single property: >>> c = cycler(color=['red', 'green', 'blue'])
Creating a cycler for simultaneously cycling over multiple properties (e.g. red circle, green plus, blue cross): >>> c = cycler(color=['red', 'green', 'blue'],
... marker=['o', '+', 'x'])
matplotlib.rcsetup.validate_any(s)[source]
matplotlib.rcsetup.validate_anylist(s)[source]
matplotlib.rcsetup.validate_aspect(s)[source]
matplotlib.rcsetup.validate_axisbelow(s)[source]
matplotlib.rcsetup.validate_backend(s)[source]
matplotlib.rcsetup.validate_bbox(s)[source]
matplotlib.rcsetup.validate_bool(b)[source]
Convert b to bool or raise.
matplotlib.rcsetup.validate_color(s)[source]
Return a valid color arg.
matplotlib.rcsetup.validate_color_for_prop_cycle(s)[source]
matplotlib.rcsetup.validate_color_or_auto(s)[source]
matplotlib.rcsetup.validate_color_or_inherit(s)[source]
Return a valid color arg.
matplotlib.rcsetup.validate_colorlist(s)[source]
return a list of colorspecs
matplotlib.rcsetup.validate_cycler(s)[source]
Return a Cycler object from a string repr or the object itself.
matplotlib.rcsetup.validate_dashlist(s)[source]
return a list of floats
matplotlib.rcsetup.validate_dpi(s)[source]
Confirm s is string 'figure' or convert s to float or raise.
matplotlib.rcsetup.validate_fillstylelist(s)[source]
matplotlib.rcsetup.validate_float(s)[source]
matplotlib.rcsetup.validate_float_or_None(s)[source]
matplotlib.rcsetup.validate_floatlist(s)[source]
return a list of floats
matplotlib.rcsetup.validate_font_properties(s)[source]
matplotlib.rcsetup.validate_fontsize(s)[source]
matplotlib.rcsetup.validate_fontsize_None(s)[source]
matplotlib.rcsetup.validate_fontsizelist(s)[source]
matplotlib.rcsetup.validate_fonttype(s)[source]
Confirm that this is a Postscript or PDF font type that we know how to convert to.
matplotlib.rcsetup.validate_fontweight(s)[source]
matplotlib.rcsetup.validate_hatch(s)[source]
Validate a hatch pattern. A hatch pattern string can have any sequence of the following characters: \ / | - + * . x o O.
matplotlib.rcsetup.validate_hatchlist(s)[source]
Validate a hatch pattern. A hatch pattern string can have any sequence of the following characters: \ / | - + * . x o O.
matplotlib.rcsetup.validate_hist_bins(s)[source]
matplotlib.rcsetup.validate_int(s)[source]
matplotlib.rcsetup.validate_int_or_None(s)[source]
matplotlib.rcsetup.validate_markevery(s)[source]
Validate the markevery property of a Line2D object. Parameters
sNone, int, (int, int), slice, float, (float, float), or list[int]
Returns
None, int, (int, int), slice, float, (float, float), or list[int]
matplotlib.rcsetup.validate_markeverylist(s)[source]
Validate the markevery property of a Line2D object. Parameters
sNone, int, (int, int), slice, float, (float, float), or list[int]
Returns
None, int, (int, int), slice, float, (float, float), or list[int]
matplotlib.rcsetup.validate_ps_distiller(s)[source]
matplotlib.rcsetup.validate_sketch(s)[source]
matplotlib.rcsetup.validate_string(s)[source]
matplotlib.rcsetup.validate_string_or_None(s)[source]
matplotlib.rcsetup.validate_stringlist(s)[source]
return a list of strings
matplotlib.rcsetup.validate_whiskers(s)[source] | matplotlib.rcsetup_api |
matplotlib.rcsetup.cycler(*args, **kwargs)[source]
Create a Cycler object much like cycler.cycler(), but includes input validation. Call signatures: cycler(cycler)
cycler(label=values[, label2=values2[, ...]])
cycler(label, values)
Form 1 copies a given Cycler object. Form 2 creates a Cycler which cycles over one or more properties simultaneously. If multiple properties are given, their value lists must have the same length. Form 3 creates a Cycler for a single property. This form exists for compatibility with the original cycler. Its use is discouraged in favor of the kwarg form, i.e. cycler(label=values). Parameters
cyclerCycler
Copy constructor for Cycler.
labelstr
The property key. Must be a valid Artist property. For example, 'color' or 'linestyle'. Aliases are allowed, such as 'c' for 'color' and 'lw' for 'linewidth'.
valuesiterable
Finite-length iterable of the property values. These values are validated and will raise a ValueError if invalid. Returns
Cycler
A new Cycler for the given properties. Examples Creating a cycler for a single property: >>> c = cycler(color=['red', 'green', 'blue'])
Creating a cycler for simultaneously cycling over multiple properties (e.g. red circle, green plus, blue cross): >>> c = cycler(color=['red', 'green', 'blue'],
... marker=['o', '+', 'x']) | matplotlib.rcsetup_api#matplotlib.rcsetup.cycler |
matplotlib.rcsetup.validate_any(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_any |
matplotlib.rcsetup.validate_anylist(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_anylist |
matplotlib.rcsetup.validate_aspect(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_aspect |
matplotlib.rcsetup.validate_axisbelow(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_axisbelow |
matplotlib.rcsetup.validate_backend(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_backend |
matplotlib.rcsetup.validate_bbox(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_bbox |
matplotlib.rcsetup.validate_bool(b)[source]
Convert b to bool or raise. | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_bool |
matplotlib.rcsetup.validate_color(s)[source]
Return a valid color arg. | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_color |
matplotlib.rcsetup.validate_color_for_prop_cycle(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_color_for_prop_cycle |
matplotlib.rcsetup.validate_color_or_auto(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_color_or_auto |
matplotlib.rcsetup.validate_color_or_inherit(s)[source]
Return a valid color arg. | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_color_or_inherit |
matplotlib.rcsetup.validate_colorlist(s)[source]
return a list of colorspecs | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_colorlist |
matplotlib.rcsetup.validate_cycler(s)[source]
Return a Cycler object from a string repr or the object itself. | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_cycler |
matplotlib.rcsetup.validate_dashlist(s)[source]
return a list of floats | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_dashlist |
matplotlib.rcsetup.validate_dpi(s)[source]
Confirm s is string 'figure' or convert s to float or raise. | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_dpi |
matplotlib.rcsetup.validate_fillstylelist(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_fillstylelist |
matplotlib.rcsetup.validate_float(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_float |
matplotlib.rcsetup.validate_float_or_None(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_float_or_None |
matplotlib.rcsetup.validate_floatlist(s)[source]
return a list of floats | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_floatlist |
matplotlib.rcsetup.validate_font_properties(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_font_properties |
matplotlib.rcsetup.validate_fontsize(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_fontsize |
matplotlib.rcsetup.validate_fontsize_None(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_fontsize_None |
matplotlib.rcsetup.validate_fontsizelist(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_fontsizelist |
matplotlib.rcsetup.validate_fonttype(s)[source]
Confirm that this is a Postscript or PDF font type that we know how to convert to. | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_fonttype |
matplotlib.rcsetup.validate_fontweight(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_fontweight |
matplotlib.rcsetup.validate_hatch(s)[source]
Validate a hatch pattern. A hatch pattern string can have any sequence of the following characters: \ / | - + * . x o O. | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_hatch |
matplotlib.rcsetup.validate_hatchlist(s)[source]
Validate a hatch pattern. A hatch pattern string can have any sequence of the following characters: \ / | - + * . x o O. | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_hatchlist |
matplotlib.rcsetup.validate_hist_bins(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_hist_bins |
matplotlib.rcsetup.validate_int(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_int |
matplotlib.rcsetup.validate_int_or_None(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_int_or_None |
matplotlib.rcsetup.validate_markevery(s)[source]
Validate the markevery property of a Line2D object. Parameters
sNone, int, (int, int), slice, float, (float, float), or list[int]
Returns
None, int, (int, int), slice, float, (float, float), or list[int] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_markevery |
matplotlib.rcsetup.validate_markeverylist(s)[source]
Validate the markevery property of a Line2D object. Parameters
sNone, int, (int, int), slice, float, (float, float), or list[int]
Returns
None, int, (int, int), slice, float, (float, float), or list[int] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_markeverylist |
matplotlib.rcsetup.validate_ps_distiller(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_ps_distiller |
matplotlib.rcsetup.validate_sketch(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_sketch |
matplotlib.rcsetup.validate_string(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_string |
matplotlib.rcsetup.validate_string_or_None(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_string_or_None |
matplotlib.rcsetup.validate_stringlist(s)[source]
return a list of strings | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_stringlist |
matplotlib.rcsetup.validate_whiskers(s)[source] | matplotlib.rcsetup_api#matplotlib.rcsetup.validate_whiskers |
classmatplotlib.rcsetup.ValidateInStrings(key, valid, ignorecase=False, *, _deprecated_since=None)[source]
Bases: object valid is a list of legal strings. | matplotlib.rcsetup_api#matplotlib.rcsetup.ValidateInStrings |
matplotlib.sankey Module for creating Sankey diagrams using Matplotlib. classmatplotlib.sankey.Sankey(ax=None, scale=1.0, unit='', format='%G', gap=0.25, radius=0.1, shoulder=0.03, offset=0.15, head_angle=100, margin=0.4, tolerance=1e-06, **kwargs)[source]
Bases: object Sankey diagram. Sankey diagrams are a specific type of flow diagram, in which the width of the arrows is shown proportionally to the flow quantity. They are typically used to visualize energy or material or cost transfers between processes. Wikipedia (6/1/2011) Create a new Sankey instance. The optional arguments listed below are applied to all subdiagrams so that there is consistent alignment and formatting. In order to draw a complex Sankey diagram, create an instance of Sankey by calling it without any kwargs: sankey = Sankey()
Then add simple Sankey sub-diagrams: sankey.add() # 1
sankey.add() # 2
#...
sankey.add() # n
Finally, create the full diagram: sankey.finish()
Or, instead, simply daisy-chain those calls: Sankey().add().add... .add().finish()
Other Parameters
axAxes
Axes onto which the data should be plotted. If ax isn't provided, new Axes will be created.
scalefloat
Scaling factor for the flows. scale sizes the width of the paths in order to maintain proper layout. The same scale is applied to all subdiagrams. The value should be chosen such that the product of the scale and the sum of the inputs is approximately 1.0 (and the product of the scale and the sum of the outputs is approximately -1.0).
unitstr
The physical unit associated with the flow quantities. If unit is None, then none of the quantities are labeled.
formatstr or callable
A Python number formatting string or callable used to label the flows with their quantities (i.e., a number times a unit, where the unit is given). If a format string is given, the label will be format % quantity. If a callable is given, it will be called with quantity as an argument.
gapfloat
Space between paths that break in/break away to/from the top or bottom.
radiusfloat
Inner radius of the vertical paths.
shoulderfloat
Size of the shoulders of output arrows.
offsetfloat
Text offset (from the dip or tip of the arrow).
head_anglefloat
Angle, in degrees, of the arrow heads (and negative of the angle of the tails).
marginfloat
Minimum space between Sankey outlines and the edge of the plot area.
tolerancefloat
Acceptable maximum of the magnitude of the sum of flows. The magnitude of the sum of connected flows cannot be greater than tolerance. **kwargs
Any additional keyword arguments will be passed to add(), which will create the first subdiagram. See also Sankey.add
Sankey.finish
Examples (Source code) (png, pdf) (png, pdf) (png, pdf) add(patchlabel='', flows=None, orientations=None, labels='', trunklength=1.0, pathlengths=0.25, prior=None, connect=(0, 0), rotation=0, **kwargs)[source]
Add a simple Sankey diagram with flows at the same hierarchical level. Parameters
patchlabelstr
Label to be placed at the center of the diagram. Note that label (not patchlabel) can be passed as keyword argument to create an entry in the legend.
flowslist of float
Array of flow values. By convention, inputs are positive and outputs are negative. Flows are placed along the top of the diagram from the inside out in order of their index within flows. They are placed along the sides of the diagram from the top down and along the bottom from the outside in. If the sum of the inputs and outputs is nonzero, the discrepancy will appear as a cubic Bezier curve along the top and bottom edges of the trunk.
orientationslist of {-1, 0, 1}
List of orientations of the flows (or a single orientation to be used for all flows). Valid values are 0 (inputs from the left, outputs to the right), 1 (from and to the top) or -1 (from and to the bottom).
labelslist of (str or None)
List of labels for the flows (or a single label to be used for all flows). Each label may be None (no label), or a labeling string. If an entry is a (possibly empty) string, then the quantity for the corresponding flow will be shown below the string. However, if the unit of the main diagram is None, then quantities are never shown, regardless of the value of this argument.
trunklengthfloat
Length between the bases of the input and output groups (in data-space units).
pathlengthslist of float
List of lengths of the vertical arrows before break-in or after break-away. If a single value is given, then it will be applied to the first (inside) paths on the top and bottom, and the length of all other arrows will be justified accordingly. The pathlengths are not applied to the horizontal inputs and outputs.
priorint
Index of the prior diagram to which this diagram should be connected.
connect(int, int)
A (prior, this) tuple indexing the flow of the prior diagram and the flow of this diagram which should be connected. If this is the first diagram or prior is None, connect will be ignored.
rotationfloat
Angle of rotation of the diagram in degrees. The interpretation of the orientations argument will be rotated accordingly (e.g., if rotation == 90, an orientations entry of 1 means to/from the left). rotation is ignored if this diagram is connected to an existing one (using prior and connect). Returns
Sankey
The current Sankey instance. Other Parameters
**kwargs
Additional keyword arguments set matplotlib.patches.PathPatch properties, listed below. For example, one may want to use fill=False or label="A legend entry".
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float See also Sankey.finish
finish()[source]
Adjust the axes and return a list of information about the Sankey subdiagram(s). Return value is a list of subdiagrams represented with the following fields:
Field Description
patch Sankey outline (an instance of PathPatch)
flows values of the flows (positive for input, negative for output)
angles list of angles of the arrows [deg/90] For example, if the diagram has not been rotated, an input to the top side will have an angle of 3 (DOWN), and an output from the top side will have an angle of 1 (UP). If a flow has been skipped (because its magnitude is less than tolerance), then its angle will be None.
tips array in which each row is an [x, y] pair indicating the positions of the tips (or "dips") of the flow paths If the magnitude of a flow is less the tolerance for the instance of Sankey, the flow is skipped and its tip will be at the center of the diagram.
text Text instance for the label of the diagram
texts list of Text instances for the labels of flows See also Sankey.add | matplotlib.sankey_api |
classmatplotlib.sankey.Sankey(ax=None, scale=1.0, unit='', format='%G', gap=0.25, radius=0.1, shoulder=0.03, offset=0.15, head_angle=100, margin=0.4, tolerance=1e-06, **kwargs)[source]
Bases: object Sankey diagram. Sankey diagrams are a specific type of flow diagram, in which the width of the arrows is shown proportionally to the flow quantity. They are typically used to visualize energy or material or cost transfers between processes. Wikipedia (6/1/2011) Create a new Sankey instance. The optional arguments listed below are applied to all subdiagrams so that there is consistent alignment and formatting. In order to draw a complex Sankey diagram, create an instance of Sankey by calling it without any kwargs: sankey = Sankey()
Then add simple Sankey sub-diagrams: sankey.add() # 1
sankey.add() # 2
#...
sankey.add() # n
Finally, create the full diagram: sankey.finish()
Or, instead, simply daisy-chain those calls: Sankey().add().add... .add().finish()
Other Parameters
axAxes
Axes onto which the data should be plotted. If ax isn't provided, new Axes will be created.
scalefloat
Scaling factor for the flows. scale sizes the width of the paths in order to maintain proper layout. The same scale is applied to all subdiagrams. The value should be chosen such that the product of the scale and the sum of the inputs is approximately 1.0 (and the product of the scale and the sum of the outputs is approximately -1.0).
unitstr
The physical unit associated with the flow quantities. If unit is None, then none of the quantities are labeled.
formatstr or callable
A Python number formatting string or callable used to label the flows with their quantities (i.e., a number times a unit, where the unit is given). If a format string is given, the label will be format % quantity. If a callable is given, it will be called with quantity as an argument.
gapfloat
Space between paths that break in/break away to/from the top or bottom.
radiusfloat
Inner radius of the vertical paths.
shoulderfloat
Size of the shoulders of output arrows.
offsetfloat
Text offset (from the dip or tip of the arrow).
head_anglefloat
Angle, in degrees, of the arrow heads (and negative of the angle of the tails).
marginfloat
Minimum space between Sankey outlines and the edge of the plot area.
tolerancefloat
Acceptable maximum of the magnitude of the sum of flows. The magnitude of the sum of connected flows cannot be greater than tolerance. **kwargs
Any additional keyword arguments will be passed to add(), which will create the first subdiagram. See also Sankey.add
Sankey.finish
Examples (Source code) (png, pdf) (png, pdf) (png, pdf) add(patchlabel='', flows=None, orientations=None, labels='', trunklength=1.0, pathlengths=0.25, prior=None, connect=(0, 0), rotation=0, **kwargs)[source]
Add a simple Sankey diagram with flows at the same hierarchical level. Parameters
patchlabelstr
Label to be placed at the center of the diagram. Note that label (not patchlabel) can be passed as keyword argument to create an entry in the legend.
flowslist of float
Array of flow values. By convention, inputs are positive and outputs are negative. Flows are placed along the top of the diagram from the inside out in order of their index within flows. They are placed along the sides of the diagram from the top down and along the bottom from the outside in. If the sum of the inputs and outputs is nonzero, the discrepancy will appear as a cubic Bezier curve along the top and bottom edges of the trunk.
orientationslist of {-1, 0, 1}
List of orientations of the flows (or a single orientation to be used for all flows). Valid values are 0 (inputs from the left, outputs to the right), 1 (from and to the top) or -1 (from and to the bottom).
labelslist of (str or None)
List of labels for the flows (or a single label to be used for all flows). Each label may be None (no label), or a labeling string. If an entry is a (possibly empty) string, then the quantity for the corresponding flow will be shown below the string. However, if the unit of the main diagram is None, then quantities are never shown, regardless of the value of this argument.
trunklengthfloat
Length between the bases of the input and output groups (in data-space units).
pathlengthslist of float
List of lengths of the vertical arrows before break-in or after break-away. If a single value is given, then it will be applied to the first (inside) paths on the top and bottom, and the length of all other arrows will be justified accordingly. The pathlengths are not applied to the horizontal inputs and outputs.
priorint
Index of the prior diagram to which this diagram should be connected.
connect(int, int)
A (prior, this) tuple indexing the flow of the prior diagram and the flow of this diagram which should be connected. If this is the first diagram or prior is None, connect will be ignored.
rotationfloat
Angle of rotation of the diagram in degrees. The interpretation of the orientations argument will be rotated accordingly (e.g., if rotation == 90, an orientations entry of 1 means to/from the left). rotation is ignored if this diagram is connected to an existing one (using prior and connect). Returns
Sankey
The current Sankey instance. Other Parameters
**kwargs
Additional keyword arguments set matplotlib.patches.PathPatch properties, listed below. For example, one may want to use fill=False or label="A legend entry".
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float See also Sankey.finish
finish()[source]
Adjust the axes and return a list of information about the Sankey subdiagram(s). Return value is a list of subdiagrams represented with the following fields:
Field Description
patch Sankey outline (an instance of PathPatch)
flows values of the flows (positive for input, negative for output)
angles list of angles of the arrows [deg/90] For example, if the diagram has not been rotated, an input to the top side will have an angle of 3 (DOWN), and an output from the top side will have an angle of 1 (UP). If a flow has been skipped (because its magnitude is less than tolerance), then its angle will be None.
tips array in which each row is an [x, y] pair indicating the positions of the tips (or "dips") of the flow paths If the magnitude of a flow is less the tolerance for the instance of Sankey, the flow is skipped and its tip will be at the center of the diagram.
text Text instance for the label of the diagram
texts list of Text instances for the labels of flows See also Sankey.add | matplotlib.sankey_api#matplotlib.sankey.Sankey |
add(patchlabel='', flows=None, orientations=None, labels='', trunklength=1.0, pathlengths=0.25, prior=None, connect=(0, 0), rotation=0, **kwargs)[source]
Add a simple Sankey diagram with flows at the same hierarchical level. Parameters
patchlabelstr
Label to be placed at the center of the diagram. Note that label (not patchlabel) can be passed as keyword argument to create an entry in the legend.
flowslist of float
Array of flow values. By convention, inputs are positive and outputs are negative. Flows are placed along the top of the diagram from the inside out in order of their index within flows. They are placed along the sides of the diagram from the top down and along the bottom from the outside in. If the sum of the inputs and outputs is nonzero, the discrepancy will appear as a cubic Bezier curve along the top and bottom edges of the trunk.
orientationslist of {-1, 0, 1}
List of orientations of the flows (or a single orientation to be used for all flows). Valid values are 0 (inputs from the left, outputs to the right), 1 (from and to the top) or -1 (from and to the bottom).
labelslist of (str or None)
List of labels for the flows (or a single label to be used for all flows). Each label may be None (no label), or a labeling string. If an entry is a (possibly empty) string, then the quantity for the corresponding flow will be shown below the string. However, if the unit of the main diagram is None, then quantities are never shown, regardless of the value of this argument.
trunklengthfloat
Length between the bases of the input and output groups (in data-space units).
pathlengthslist of float
List of lengths of the vertical arrows before break-in or after break-away. If a single value is given, then it will be applied to the first (inside) paths on the top and bottom, and the length of all other arrows will be justified accordingly. The pathlengths are not applied to the horizontal inputs and outputs.
priorint
Index of the prior diagram to which this diagram should be connected.
connect(int, int)
A (prior, this) tuple indexing the flow of the prior diagram and the flow of this diagram which should be connected. If this is the first diagram or prior is None, connect will be ignored.
rotationfloat
Angle of rotation of the diagram in degrees. The interpretation of the orientations argument will be rotated accordingly (e.g., if rotation == 90, an orientations entry of 1 means to/from the left). rotation is ignored if this diagram is connected to an existing one (using prior and connect). Returns
Sankey
The current Sankey instance. Other Parameters
**kwargs
Additional keyword arguments set matplotlib.patches.PathPatch properties, listed below. For example, one may want to use fill=False or label="A legend entry".
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float See also Sankey.finish | matplotlib.sankey_api#matplotlib.sankey.Sankey.add |
finish()[source]
Adjust the axes and return a list of information about the Sankey subdiagram(s). Return value is a list of subdiagrams represented with the following fields:
Field Description
patch Sankey outline (an instance of PathPatch)
flows values of the flows (positive for input, negative for output)
angles list of angles of the arrows [deg/90] For example, if the diagram has not been rotated, an input to the top side will have an angle of 3 (DOWN), and an output from the top side will have an angle of 1 (UP). If a flow has been skipped (because its magnitude is less than tolerance), then its angle will be None.
tips array in which each row is an [x, y] pair indicating the positions of the tips (or "dips") of the flow paths If the magnitude of a flow is less the tolerance for the instance of Sankey, the flow is skipped and its tip will be at the center of the diagram.
text Text instance for the label of the diagram
texts list of Text instances for the labels of flows See also Sankey.add | matplotlib.sankey_api#matplotlib.sankey.Sankey.finish |
matplotlib.scale Scales define the distribution of data values on an axis, e.g. a log scaling. They are defined as subclasses of ScaleBase. See also axes.Axes.set_xscale and the scales examples in the documentation. See Custom scale for a full example of defining a custom scale. Matplotlib also supports non-separable transformations that operate on both Axis at the same time. They are known as projections, and defined in matplotlib.projections. classmatplotlib.scale.FuncScale(axis, functions)[source]
Bases: matplotlib.scale.ScaleBase Provide an arbitrary scale with user-supplied function for the axis. Parameters
axisAxis
The axis for the scale.
functions(callable, callable)
two-tuple of the forward and inverse functions for the scale. The forward function must be monotonic. Both functions must have the signature: def forward(values: array-like) -> array-like
get_transform()[source]
Return the FuncTransform associated with this scale.
name='function'
set_default_locators_and_formatters(axis)[source]
Set the locators and formatters of axis to instances suitable for this scale.
classmatplotlib.scale.FuncScaleLog(axis, functions, base=10)[source]
Bases: matplotlib.scale.LogScale Provide an arbitrary scale with user-supplied function for the axis and then put on a logarithmic axes. Parameters
axismatplotlib.axis.Axis
The axis for the scale.
functions(callable, callable)
two-tuple of the forward and inverse functions for the scale. The forward function must be monotonic. Both functions must have the signature: def forward(values: array-like) -> array-like
basefloat, default: 10
Logarithmic base of the scale. propertybase
get_transform()[source]
Return the Transform associated with this scale.
name='functionlog'
classmatplotlib.scale.FuncTransform(forward, inverse)[source]
Bases: matplotlib.transforms.Transform A simple transform that takes and arbitrary function for the forward and inverse transform. Parameters
forwardcallable
The forward function for the transform. This function must have an inverse and, for best behavior, be monotonic. It must have the signature: def forward(values: array-like) -> array-like
inversecallable
The inverse of the forward function. Signature as forward. has_inverse=True
True if this transform has a corresponding inverse transform.
input_dims=1
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
inverted()[source]
Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
is_separable=True
True if this transform is separable in the x- and y- dimensions.
output_dims=1
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
transform_non_affine(values)[source]
Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters
valuesarray
The input values as NumPy array of length input_dims or shape (N x input_dims). Returns
array
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
classmatplotlib.scale.InvertedLogTransform(base)[source]
Bases: matplotlib.transforms.Transform Parameters
shorthand_namestr
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True
True if this transform has a corresponding inverse transform.
input_dims=1
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
inverted()[source]
Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
is_separable=True
True if this transform is separable in the x- and y- dimensions.
output_dims=1
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
transform_non_affine(a)[source]
Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters
valuesarray
The input values as NumPy array of length input_dims or shape (N x input_dims). Returns
array
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
classmatplotlib.scale.InvertedSymmetricalLogTransform(base, linthresh, linscale)[source]
Bases: matplotlib.transforms.Transform Parameters
shorthand_namestr
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True
True if this transform has a corresponding inverse transform.
input_dims=1
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
inverted()[source]
Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
is_separable=True
True if this transform is separable in the x- and y- dimensions.
output_dims=1
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
transform_non_affine(a)[source]
Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters
valuesarray
The input values as NumPy array of length input_dims or shape (N x input_dims). Returns
array
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
classmatplotlib.scale.LinearScale(axis)[source]
Bases: matplotlib.scale.ScaleBase The default linear scale. get_transform()[source]
Return the transform for linear scaling, which is just the IdentityTransform.
name='linear'
set_default_locators_and_formatters(axis)[source]
Set the locators and formatters of axis to instances suitable for this scale.
classmatplotlib.scale.LogScale(axis, *, base=10, subs=None, nonpositive='clip')[source]
Bases: matplotlib.scale.ScaleBase A standard logarithmic scale. Care is taken to only plot positive values. Parameters
axisAxis
The axis for the scale.
basefloat, default: 10
The base of the logarithm.
nonpositive{'clip', 'mask'}, default: 'clip'
Determines the behavior for non-positive values. They can either be masked as invalid, or clipped to a very small positive number.
subssequence of int, default: None
Where to place the subticks between each major tick. For example, in a log10 scale, [2, 3, 4, 5, 6, 7, 8, 9] will place 8 logarithmically spaced minor ticks between each major tick. propertybase
get_transform()[source]
Return the LogTransform associated with this scale.
limit_range_for_scale(vmin, vmax, minpos)[source]
Limit the domain to positive values.
name='log'
set_default_locators_and_formatters(axis)[source]
Set the locators and formatters of axis to instances suitable for this scale.
classmatplotlib.scale.LogTransform(base, nonpositive='clip')[source]
Bases: matplotlib.transforms.Transform Parameters
shorthand_namestr
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True
True if this transform has a corresponding inverse transform.
input_dims=1
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
inverted()[source]
Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
is_separable=True
True if this transform is separable in the x- and y- dimensions.
output_dims=1
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
transform_non_affine(a)[source]
Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters
valuesarray
The input values as NumPy array of length input_dims or shape (N x input_dims). Returns
array
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
classmatplotlib.scale.LogisticTransform(nonpositive='mask')[source]
Bases: matplotlib.transforms.Transform Parameters
shorthand_namestr
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True
True if this transform has a corresponding inverse transform.
input_dims=1
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
inverted()[source]
Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
is_separable=True
True if this transform is separable in the x- and y- dimensions.
output_dims=1
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
transform_non_affine(a)[source]
logistic transform (base 10)
classmatplotlib.scale.LogitScale(axis, nonpositive='mask', *, one_half='\x0crac{1}{2}', use_overline=False)[source]
Bases: matplotlib.scale.ScaleBase Logit scale for data between zero and one, both excluded. This scale is similar to a log scale close to zero and to one, and almost linear around 0.5. It maps the interval ]0, 1[ onto ]-infty, +infty[. Parameters
axismatplotlib.axis.Axis
Currently unused.
nonpositive{'mask', 'clip'}
Determines the behavior for values beyond the open interval ]0, 1[. They can either be masked as invalid, or clipped to a number very close to 0 or 1.
use_overlinebool, default: False
Indicate the usage of survival notation (overline{x}) in place of standard notation (1-x) for probability close to one.
one_halfstr, default: r"frac{1}{2}"
The string used for ticks formatter to represent 1/2. get_transform()[source]
Return the LogitTransform associated with this scale.
limit_range_for_scale(vmin, vmax, minpos)[source]
Limit the domain to values between 0 and 1 (excluded).
name='logit'
set_default_locators_and_formatters(axis)[source]
Set the locators and formatters of axis to instances suitable for this scale.
classmatplotlib.scale.LogitTransform(nonpositive='mask')[source]
Bases: matplotlib.transforms.Transform Parameters
shorthand_namestr
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True
True if this transform has a corresponding inverse transform.
input_dims=1
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
inverted()[source]
Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
is_separable=True
True if this transform is separable in the x- and y- dimensions.
output_dims=1
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
transform_non_affine(a)[source]
logit transform (base 10), masked or clipped
classmatplotlib.scale.ScaleBase(axis)[source]
Bases: object The base class for all scales. Scales are separable transformations, working on a single dimension. Subclasses should override name
The scale's name. get_transform()
A method returning a Transform, which converts data coordinates to scaled coordinates. This transform should be invertible, so that e.g. mouse positions can be converted back to data coordinates. set_default_locators_and_formatters()
A method that sets default locators and formatters for an Axis that uses this scale. limit_range_for_scale()
An optional method that "fixes" the axis range to acceptable values, e.g. restricting log-scaled axes to positive values. Construct a new scale. Notes The following note is for scale implementors. For back-compatibility reasons, scales take an Axis object as first argument. However, this argument should not be used: a single scale object should be usable by multiple Axises at the same time. get_transform()[source]
Return the Transform object associated with this scale.
limit_range_for_scale(vmin, vmax, minpos)[source]
Return the range vmin, vmax, restricted to the domain supported by this scale (if any). minpos should be the minimum positive value in the data. This is used by log scales to determine a minimum value.
set_default_locators_and_formatters(axis)[source]
Set the locators and formatters of axis to instances suitable for this scale.
classmatplotlib.scale.SymmetricalLogScale(axis, *, base=10, linthresh=2, subs=None, linscale=1)[source]
Bases: matplotlib.scale.ScaleBase The symmetrical logarithmic scale is logarithmic in both the positive and negative directions from the origin. Since the values close to zero tend toward infinity, there is a need to have a range around zero that is linear. The parameter linthresh allows the user to specify the size of this range (-linthresh, linthresh). Parameters
basefloat, default: 10
The base of the logarithm.
linthreshfloat, default: 2
Defines the range (-x, x), within which the plot is linear. This avoids having the plot go to infinity around zero.
subssequence of int
Where to place the subticks between each major tick. For example, in a log10 scale: [2, 3, 4, 5, 6, 7, 8, 9] will place 8 logarithmically spaced minor ticks between each major tick.
linscalefloat, optional
This allows the linear range (-linthresh, linthresh) to be stretched relative to the logarithmic range. Its value is the number of decades to use for each half of the linear range. For example, when linscale == 1.0 (the default), the space used for the positive and negative halves of the linear range will be equal to one decade in the logarithmic range. Construct a new scale. Notes The following note is for scale implementors. For back-compatibility reasons, scales take an Axis object as first argument. However, this argument should not be used: a single scale object should be usable by multiple Axises at the same time. propertybase
get_transform()[source]
Return the SymmetricalLogTransform associated with this scale.
propertylinscale
propertylinthresh
name='symlog'
set_default_locators_and_formatters(axis)[source]
Set the locators and formatters of axis to instances suitable for this scale.
classmatplotlib.scale.SymmetricalLogTransform(base, linthresh, linscale)[source]
Bases: matplotlib.transforms.Transform Parameters
shorthand_namestr
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True. has_inverse=True
True if this transform has a corresponding inverse transform.
input_dims=1
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
inverted()[source]
Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
is_separable=True
True if this transform is separable in the x- and y- dimensions.
output_dims=1
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
transform_non_affine(a)[source]
Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters
valuesarray
The input values as NumPy array of length input_dims or shape (N x input_dims). Returns
array
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
matplotlib.scale.get_scale_names()[source]
Return the names of the available scales.
matplotlib.scale.register_scale(scale_class)[source]
Register a new kind of scale. Parameters
scale_classsubclass of ScaleBase
The scale to register.
matplotlib.scale.scale_factory(scale, axis, **kwargs)[source]
Return a scale class by name. Parameters
scale{'function', 'functionlog', 'linear', 'log', 'logit', 'symlog'}
axismatplotlib.axis.Axis | matplotlib.scale_api |
classmatplotlib.scale.FuncScale(axis, functions)[source]
Bases: matplotlib.scale.ScaleBase Provide an arbitrary scale with user-supplied function for the axis. Parameters
axisAxis
The axis for the scale.
functions(callable, callable)
two-tuple of the forward and inverse functions for the scale. The forward function must be monotonic. Both functions must have the signature: def forward(values: array-like) -> array-like
get_transform()[source]
Return the FuncTransform associated with this scale.
name='function'
set_default_locators_and_formatters(axis)[source]
Set the locators and formatters of axis to instances suitable for this scale. | matplotlib.scale_api#matplotlib.scale.FuncScale |
get_transform()[source]
Return the FuncTransform associated with this scale. | matplotlib.scale_api#matplotlib.scale.FuncScale.get_transform |
name='function' | matplotlib.scale_api#matplotlib.scale.FuncScale.name |
set_default_locators_and_formatters(axis)[source]
Set the locators and formatters of axis to instances suitable for this scale. | matplotlib.scale_api#matplotlib.scale.FuncScale.set_default_locators_and_formatters |
classmatplotlib.scale.FuncScaleLog(axis, functions, base=10)[source]
Bases: matplotlib.scale.LogScale Provide an arbitrary scale with user-supplied function for the axis and then put on a logarithmic axes. Parameters
axismatplotlib.axis.Axis
The axis for the scale.
functions(callable, callable)
two-tuple of the forward and inverse functions for the scale. The forward function must be monotonic. Both functions must have the signature: def forward(values: array-like) -> array-like
basefloat, default: 10
Logarithmic base of the scale. propertybase
get_transform()[source]
Return the Transform associated with this scale.
name='functionlog' | matplotlib.scale_api#matplotlib.scale.FuncScaleLog |
get_transform()[source]
Return the Transform associated with this scale. | matplotlib.scale_api#matplotlib.scale.FuncScaleLog.get_transform |
name='functionlog' | matplotlib.scale_api#matplotlib.scale.FuncScaleLog.name |
classmatplotlib.scale.FuncTransform(forward, inverse)[source]
Bases: matplotlib.transforms.Transform A simple transform that takes and arbitrary function for the forward and inverse transform. Parameters
forwardcallable
The forward function for the transform. This function must have an inverse and, for best behavior, be monotonic. It must have the signature: def forward(values: array-like) -> array-like
inversecallable
The inverse of the forward function. Signature as forward. has_inverse=True
True if this transform has a corresponding inverse transform.
input_dims=1
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
inverted()[source]
Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
is_separable=True
True if this transform is separable in the x- and y- dimensions.
output_dims=1
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
transform_non_affine(values)[source]
Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters
valuesarray
The input values as NumPy array of length input_dims or shape (N x input_dims). Returns
array
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input. | matplotlib.scale_api#matplotlib.scale.FuncTransform |
has_inverse=True
True if this transform has a corresponding inverse transform. | matplotlib.scale_api#matplotlib.scale.FuncTransform.has_inverse |
input_dims=1
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass. | matplotlib.scale_api#matplotlib.scale.FuncTransform.input_dims |
inverted()[source]
Return the corresponding inverse transformation. It holds x == self.inverted().transform(self.transform(x)). The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy. | matplotlib.scale_api#matplotlib.scale.FuncTransform.inverted |
is_separable=True
True if this transform is separable in the x- and y- dimensions. | matplotlib.scale_api#matplotlib.scale.FuncTransform.is_separable |
output_dims=1
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass. | matplotlib.scale_api#matplotlib.scale.FuncTransform.output_dims |
transform_non_affine(values)[source]
Apply only the non-affine part of this transformation. transform(values) is always equivalent to transform_affine(transform_non_affine(values)). In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op. Parameters
valuesarray
The input values as NumPy array of length input_dims or shape (N x input_dims). Returns
array
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input. | matplotlib.scale_api#matplotlib.scale.FuncTransform.transform_non_affine |
matplotlib.scale.get_scale_names()[source]
Return the names of the available scales. | matplotlib.scale_api#matplotlib.scale.get_scale_names |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.