YJc @ s! d Z d d k Z d d k l Z d d k i Z d d k i Z d d k i Z d d k i Z d d k l Z d d k i Z d d k l Z d d k l Z d d k Z d e i Z d Z d e i f d YZ d Z d e i f d YZ d e i Z d e i f d YZ d S( s 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. iN( t ma( t allow_rasterization( t delete_masked_points( t CirclePolygons Plot a 2-D field of arrows. call signatures:: quiver(U, V, **kw) quiver(U, V, C, **kw) quiver(X, Y, U, V, **kw) quiver(X, Y, U, V, C, **kw) Arguments: *X*, *Y*: The x and y coordinates of the arrow locations (default is tail of arrow; see *pivot* kwarg) *U*, *V*: give the *x* and *y* components of the arrow vectors *C*: an optional array used to map colors to the arrows All arguments may be 1-D or 2-D arrays or sequences. If *X* and *Y* are absent, they will be generated as a uniform grid. If *U* and *V* are 2-D arrays but *X* and *Y* are 1-D, and if len(*X*) and len(*Y*) match the column and row dimensions of *U*, then *X* and *Y* will be expanded with :func:`numpy.meshgrid`. *U*, *V*, *C* may be masked arrays, but masked *X*, *Y* are not supported at present. Keyword arguments: *units*: ['width' | 'height' | 'dots' | 'inches' | 'x' | 'y' ] arrow units; the arrow dimensions *except for length* are in multiples of this unit. * 'width' or 'height': the width or height of the axes * 'dots' or 'inches': pixels or inches, based on the figure dpi * 'x' or 'y': *X* or *Y* 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 the window is resized; for 'dots' or 'inches', resizing does not change the arrows. *angles*: ['uv' | 'xy' | array] With the default 'uv', the arrow aspect ratio is 1, so that if *U*==*V* the angle of the arrow on the plot is 45 degrees CCW from the *x*-axis. With 'xy', the arrow points from (x,y) to (x+u, y+v). Alternatively, arbitrary angles may be specified as an array of values in degrees, CCW from the *x*-axis. *scale*: [ None | float ] data units per arrow unit, e.g. m/s per plot width; a smaller scale parameter makes the arrow longer. If *None*, a simple autoscaling algorithm is used, based on the average vector length and the number of vectors. *width*: 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. *headwidth*: scalar head width as multiple of shaft width, default is 3 *headlength*: scalar head length as multiple of shaft width, default is 5 *headaxislength*: scalar head length at shaft intersection, default is 4.5 *minshaft*: scalar length below which arrow scales, in units of head length. Do not set this to less than 1, or small arrows will look terrible! Default is 1 *minlength*: scalar minimum length as a multiple of shaft width; if an arrow length is less than this, plot a dot (hexagon) of this diameter instead. Default is 1. *pivot*: [ 'tail' | 'middle' | 'tip' ] The part of the arrow that is at the grid point; the arrow rotates about this point, hence the name *pivot*. *color*: [ color | color sequence ] This is a synonym for the :class:`~matplotlib.collections.PolyCollection` facecolor kwarg. If *C* has been set, *color* has no effect. 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. linewidths and edgecolors can be used to customize the arrow outlines. Additional :class:`~matplotlib.collections.PolyCollection` keyword arguments: %(PolyCollection)s s Add a key to a quiver plot. call signature:: quiverkey(Q, X, Y, U, label, **kw) Arguments: *Q*: The Quiver instance returned by a call to quiver. *X*, *Y*: The location of the key; additional explanation follows. *U*: The length of the key *label*: a string with the length and units of the key Keyword arguments: *coordinates* = [ 'axes' | 'figure' | 'data' | 'inches' ] 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*: 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*: Distance in inches between the arrow and the label. Default is 0.1 *labelcolor*: defaults to default :class:`~matplotlib.text.Text` color. *fontproperties*: A dictionary with keyword arguments accepted by the :class:`~matplotlib.font_manager.FontProperties` initializer: *family*, *style*, *variant*, *size*, *weight* Any additional keyword arguments are used to override vector properties taken from *Q*. 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. t QuiverKeyc B s e Z d Z h d d 6d d 6d d 6d d 6Z h d d 6d d 6d d 6d d 6Z h d d 6d d 6d d 6d d 6Z d Z e e _ d Z d Z d Z e d Z d Z d Z d Z e Z RS( s8 Labelled arrow for use as a quiver plot scale key. t centert Nt St leftt Et rightt Wt bottomt topt midt tipt tailc s t i i | _ | _ | _ | _ | i d d _ | i d d _ | _ | i d d _ i | i i i _ f d } | i i i i d | | i d d _ | i d d _ | i d t _ | _ i } t i d | d i i d i i d t i | _ i d j o i i i n t _! | i" d _" d S( Nt coordinatest axest colort labelsepg?c s i | i _ t _ d S( N( t _labelsep_inchest dpiR t Falset _initialized( t fig( t self( s7 /usr/lib64/python2.6/site-packages/matplotlib/quiver.pyt on_dpi_change s t dpi_changedt labelposR t labelcolort fontpropertiest textt horizontalalignmentt verticalalignment(# t martistt Artistt __init__t Qt Xt Yt Ut popt coordt NoneR t labelR t axt figureR R t callbackst connectR R t dictR t kwt mtextt Textt halignt valignt font_managert FontPropertiesR t set_colorR R t zorder( R R&