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,zorder=None,**kwargs)[source]#

Bases:Artist

Labelled arrow for use as a quiver plot scale key.

Add a key to a quiver plot.

The positioning of the key depends onX,Y,coordinates, andlabelpos. Iflabelpos is 'N' or 'S',X,Y give the position ofthe middle of the key arrow. Iflabelpos is 'E',X,Y positionsthe head, and iflabelpos is 'W',X,Y positions the tail; ineither of these two cases,X,Y is somewhere in the middle of thearrow+label key object.

Parameters:
QQuiver

AQuiver object as returned by a call toquiver().

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 thehorizontal axis.

coordinates{'axes', 'figure', 'data', 'inches'}, default: 'axes'

Coordinate system and units forX,Y: 'axes' and 'figure' arenormalized 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 thelower left corner.

colorcolor

Overrides face and edge colors fromQ.

labelpos{'N', 'S', 'E', 'W'}

Position the label above, below, to the right, to the left of thearrow, 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 theFontProperties initializer:family,style,variant,size,weight.

zorderfloat

The zorder of the key. The default is 0.1 aboveQ.

**kwargs

Any additional keyword arguments are used to override vectorproperties taken fromQ.

contains(mouseevent)[source]#

Test whether the artist contains the mouse event.

Parameters:
mouseeventMouseEvent
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 theindividual 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_visiblereturns False).

Parameters:
rendererRendererBase subclass.

Notes

This method is overridden in the Artist subclasses.

halign={'E':'left','N':'center','S':'center','W':'right'}#
propertylabelsep#
pivot={'E':'tip','N':'middle','S':'middle','W':'tail'}#
set(*,agg_filter=<UNSET>,alpha=<UNSET>,animated=<UNSET>,clip_box=<UNSET>,clip_on=<UNSET>,clip_path=<UNSET>,gid=<UNSET>,in_layout=<UNSET>,label=<UNSET>,mouseover=<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 and two offsets from the bottom left corner of the image

alpha

float or None

animated

bool

clip_box

BboxBase or None

clip_on

bool

clip_path

Patch or (Path, Transform) or None

figure

unknown

gid

str

in_layout

bool

label

object

mouseover

bool

path_effects

list ofAbstractPathEffect

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 theFigure orSubFigure instance the artist belongs to.

Parameters:
figFigure orSubFigure
valign={'E':'center','N':'bottom','S':'top','W':'center'}#

Examples usingmatplotlib.quiver.QuiverKey#

Advanced quiver and quiverkey functions

Advanced quiver and quiverkey functions