| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/local/lib/python3.9/dist-packages/matplotlib/__pycache__/ |
Upload File : |
a
���ha� � @ s� d Z ddlZddlZddlmZ ddlmZmZmZ ddl m
Z ddlm
Z ddlmZ ddlmZ ddlmZ dejj Zejjed� G dd � d ej�Zd
d�dd
�Zdd� ZG dd� dej�Zdejj Z ejje d� G dd� dej�Z!dS )a�
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.
� N)�ma)�_api�cbook�
_docstring)�
CirclePolygonu-
Plot a 2D field of arrows.
Call signature::
quiver([X, Y], U, V, [C], **kwargs)
*X*, *Y* define the arrow locations, *U*, *V* define the arrow directions, and
*C* optionally sets the color.
**Arrow length**
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 arrow shape is determined by *width*, *headwidth*, *headlength* and
*headaxislength*. See the notes below.
**Arrow styling**
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*, *edgecolor*,
*facecolor*, etc. act accordingly.
Parameters
----------
X, Y : 1D 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, V : 1D or 2D array-like
The x and y direction components of the arrow vectors. The interpretation
of these components (in data or in screen space) depends on *angles*.
*U* and *V* must have the same number of elements, matching the number of
arrow locations in *X*, *Y*. *U* and *V* may be masked. Locations masked
in any of *U*, *V*, and *C* will not be drawn.
C : 1D 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.
angles : {'uv', 'xy'} or array-like, default: 'uv'
Method for determining the angle of the arrows.
- 'uv': Arrow direction in screen coordinates. Use this if the arrows
symbolize a quantity that is not based on *X*, *Y* data coordinates.
If *U* == *V* the orientation of the arrow on the plot is 45 degrees
counter-clockwise from the horizontal axis (positive to the right).
- 'xy': Arrow direction in data coordinates, i.e. the arrows point from
(x, y) to (x+u, y+v). Use this e.g. for plotting a gradient field.
- 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'``.
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'.
scale : float, optional
Scales the length of the arrow inversely.
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``.
units : {'width', 'height', 'dots', 'inches', 'x', 'y', 'xy'}, default: 'width'
Affects the arrow size (except for the length). In particular, the shaft
*width* is measured in multiples of this unit.
Supported values are:
- 'width', 'height': The width or height of the Axes.
- 'dots', 'inches': Pixels or inches based on the figure dpi.
- 'x', 'y', 'xy': *X*, *Y* or :math:`\sqrt{X^2 + Y^2}` in data units.
The following table summarizes how these values affect the visible arrow
size under zooming and figure size changes:
================= ================= ==================
units zoom figure size change
================= ================= ==================
'x', 'y', 'xy' arrow size scales —
'width', 'height' — arrow size scales
'dots', 'inches' — —
================= ================= ==================
width : float, optional
Shaft width in arrow units. All head parameters are relative to *width*.
The 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.
headwidth : float, default: 3
Head width as multiple of shaft *width*. See the notes below.
headlength : float, default: 5
Head length as multiple of shaft *width*. See the notes below.
headaxislength : float, default: 4.5
Head length at shaft intersection as multiple of shaft *width*.
See the notes below.
minshaft : float, 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!
minlength : float, 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.
color : :mpltype:`color` or list :mpltype:`color`, 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.
Other Parameters
----------------
data : indexable object, optional
DATA_PARAMETER_PLACEHOLDER
**kwargs : `~matplotlib.collections.PolyCollection` properties, optional
All other keyword arguments are passed on to `.PolyCollection`:
%(PolyCollection:kwdoc)s
Returns
-------
`~matplotlib.quiver.Quiver`
See Also
--------
.Axes.quiverkey : Add a key to a quiver plot.
Notes
-----
**Arrow shape**
The arrow is drawn as a polygon using the nodes as shown below. The values
*headwidth*, *headlength*, and *headaxislength* are in units of *width*.
.. image:: /_static/quiver_sizes.svg
:width: 500px
The defaults give a slightly swept-back arrow. Here are some guidelines how to
get other head shapes:
- 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 proportionally.
- To remove the head completely, set all *head* parameters to 0.
- To get a diamond-shaped head, make *headaxislength* larger than *headlength*.
- Warning: For *headaxislength* < (*headlength* / *headwidth*), the "headaxis"
nodes (i.e. the ones connecting the head with the shaft) will protrude out
of the head in forward direction so that the arrow head looks broken.
)Z
quiver_docc s� e Zd ZdZddddd�Zddddd�Zddd d
d�Zddd
ddd
d
d�� fdd�
Zedd� �Z dd� Z
dd� Zej
dd� �Zdd� Z� fdd�Zdd � Z� ZS )!� QuiverKeyz2Labelled arrow for use as a quiver plot scale key.�center�left�right��N�S�E�WZbottom�top�middle�tip�tailr �axesN皙�����?r )�angle�coordinates�color�labelsep�labelpos�
labelcolor�fontpropertiesc s� t � �� || _|| _|| _|| _|| _|| _|| _|| _ | | _
|
| _|| _|pTt
� | _|
| _tj|| j| j | j| j | jd�| _| jdur�| j�| j� d| _|jd | _dS )a�
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
----------
Q : `~matplotlib.quiver.Quiver`
A `.Quiver` object as returned by a call to `~.Axes.quiver()`.
X, Y : float
The location of the key.
U : float
The length of the key.
label : str
The key label (e.g., length and units of the key).
angle : float, default: 0
The angle of the key arrow, in degrees anti-clockwise from the
horizontal 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.
color : :mpltype:`color`
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.
labelsep : float, default: 0.1
Distance in inches between the arrow and the label.
labelcolor : :mpltype:`color`, default: :rc:`text.color`
Label color.
fontproperties : dict, optional
A dictionary with keyword arguments accepted by the
`~matplotlib.font_manager.FontProperties` initializer:
*family*, *style*, *variant*, *size*, *weight*.
**kwargs
Any additional keyword arguments are used to override vector
properties taken from *Q*.
)�textZhorizontalalignmentZverticalalignmentr Nr )�super�__init__�Q�X�Y�Ur �coordr �label�_labelsep_inchesr r �dictr �kw�mtext�Text�halign�valignr � set_color�_dpi_at_last_initZzorder)�selfr r! r"