MetPy - ArrowPlot()#

Make plots of wind barbs on a map with traits to refine the look of plotted elements.

ArrowPlot()#

Attribute

Description

arrowkey

Set the characteristics of an arrow key using a tuple of values representing (value, xloc, yloc, position, string).

arrowscale

Number of data units per arrow length unit, e.g., m/s per plot width; a smaller scale parameter makes the arrow longer.

color

A string value that controls the color of the vectors.

data

Xarray dataset that contains the field to be plotted.

earth_relative

A boolean value to indicate whether the vector to be plotted is earth- or grid-relative.

field

A tuple containing the two components of the vector field from the dataset in the form (east-west component, north-south component).

level

The level of the field to be plotted.

pivot

A string setting the pivot point of the vector.

plot_units

The desired units to plot the field in.

plotdata

Return the data for plotting.

scale

Scale the field to be plotted by the value given.

skip

A tuple of integers to indicate the number of grid points to skip between plotting vectors.

time

Set the valid time to be plotted as a datetime object.

mpl_args

Supply a dictionary of valid Matplotlib keyword arguments to modify how the plot variable is drawn.

Attribute Descriptions#

arrowkey#

  • Set the characteristics of an arrow key using a tuple of values representing (value, xloc, yloc, position, string). Default is None.

    If None, no vector key will be plotted.

    value default is 100 xloc default is 0.85 yloc default is 1.02 position default is ‘E’ (options are ‘N’, ‘S’, ‘E’, ‘W’) label default is an empty string

    If you wish to change a characteristic of the arrowkey you’ll need to have a tuple of five elements, fill in the full tuple using None for those characteristics you wish to use the default value and put in the new values for the other elements. This trait corresponds to the keyword length in matplotlib.pyplot.quiverkey.

arrowscale#

  • 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 key_length attribute.

    This trait corresponds to the keyword length in matplotlib.pyplot.quiver.

color#

  • A string value that controls the color of the vectors. Default value is black.

    This trait can be set to any named color from Matplotlibs Colors

data#

  • Xarray dataset that contains the field to be plotted.

earth_relative#

  • A boolean value to indicate whether the vector to be plotted is earth- or grid-relative. Default value is True, indicating that vectors are earth-relative.

Common gridded meteorological datasets including GFS and NARR output contain wind components that are earth-relative. The primary exception is NAM output with wind components that are grid-relative. For any grid-relative vectors set this trait to False. This value is ignored for 2D vector fields not in the plane of the plot (e.g., cross sections).

field#

  • A tuple containing the two components of the vector field from the dataset in the form (east-west component, north-south component).

    For a wind barb plot each component of the wind must be specified and should be of the form (u-wind, v-wind).

level#

  • The level of the field to be plotted.

    This is a value with units to choose a desired plot level. For example, selecting the 850-hPa level, set this parameter to 850 * units.hPa. Note that this requires your data to have a vertical dimension coordinate.

pivot#

  • A string setting the pivot point of the vector. Default value is ‘middle’.

    This trait takes the values of the keyword argument from matplotlin.pyplot.barbs: ‘tip’ or ‘middle’.

plot_units#

  • The desired units to plot the field in.

    Setting this attribute will convert the units of the field variable to the given units for plotting using the MetPy Units module.

scale#

  • Scale the field to be plotted by the value given.

    This attribute will scale the field by multiplying by the scale. For example, to scale vorticity to be whole values for contouring you could set the scale to 1e5, such that the data values will be multiplied by 10^5.

skip#

  • A tuple of integers to indicate the number of grid points to skip between plotting vectors. Default is (1, 1).

    This trait is to be used to reduce the number of vectors plotted in the (east-west, north-south) components. The two values can be set to the same or different integer values depending on what is desired.

time#

  • Set the valid time to be plotted as a datetime object.

    If a forecast hour is to be plotted the time should be set to the valid future time, which can be done using the datetime and timedelta objects from the Python standard library. Note that this requires your data to have a time dimension coordinate.

mpl_args#

  • This attribute can be set to a dictionary containing keyword arguments (kwarg) valid for the various Matplotlib plotting functions to enhance how a plot is created. For example, you can use this attribute to set the zorder kwarg to alter what aspects of the your plot are on top of one another. NOTE: Setting the mpl_args trait will override any other trait that corresponds to a specific kwarg for the particular plot type (e.g., linecolor, linewidth).