matplotlib.quiver.QuiverKey

class matplotlib.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.

__init__(self, Q, X, Y, U, label, *, angle=0, coordinates='axes', color=None, labelsep=0.1, labelpos='N', labelcolor=None, fontproperties=None, **kw)[source]

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.

__module__ = 'matplotlib.quiver'
contains(self, 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(self, 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'}
property quiverkey_doc
remove(self)[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_figure(self, 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