StationPlot

class metpy.plots.StationPlot(ax, x, y, fontsize=10, spacing=None, transform=None, **kwargs)[source]

Make a standard meteorological station plot.

Plots values, symbols, or text spaced around a central location. Can also plot wind barbs as the center of the location.

Initialize the StationPlot with items that do not change.

This sets up the axes and station locations. The fontsize and spacing are also specified here to ensure that they are consistent between individual station elements.

Parameters:
  • ax (matplotlib.axes.Axes) – The Axes for plotting
  • x (array_like) – The x location of the stations in the plot
  • y (array_like) – The y location of the stations in the plot
  • fontsize (int) – The fontsize to use for drawing text
  • spacing (int) – The spacing, in points, that corresponds to a single increment between station plot elements.
  • transform (matplotlib.transforms.Transform (or compatible)) – The default transform to apply to the x and y positions when plotting.
  • kwargs – Additional keyword arguments to use for matplotlib’s plotting functions. These will be passed to all the plotting methods, and thus need to be valid for all plot types, such as clip_on.

Attributes Summary

location_names

Methods Summary

__init__(ax, x, y[, fontsize, spacing, …]) Initialize the StationPlot with items that do not change.
plot_barb(u, v, **kwargs) At the center of the station model plot wind barbs.
plot_parameter(location, parameter[, formatter]) At the specified location in the station model plot a set of values.
plot_symbol(location, codes, symbol_mapper, …) At the specified location in the station model plot a set of symbols.
plot_text(location, text, **kwargs) At the specified location in the station model plot a collection of text.

Attributes Documentation

location_names = {'C': (0, 0), 'E': (1, 0), 'N': (0, 1), 'NE': (1, 1), 'NW': (-1, 1), 'S': (0, -1), 'SE': (1, -1), 'SW': (-1, -1), 'W': (-1, 0)}

Methods Documentation

__init__(ax, x, y, fontsize=10, spacing=None, transform=None, **kwargs)[source]

Initialize the StationPlot with items that do not change.

This sets up the axes and station locations. The fontsize and spacing are also specified here to ensure that they are consistent between individual station elements.

Parameters:
  • ax (matplotlib.axes.Axes) – The Axes for plotting
  • x (array_like) – The x location of the stations in the plot
  • y (array_like) – The y location of the stations in the plot
  • fontsize (int) – The fontsize to use for drawing text
  • spacing (int) – The spacing, in points, that corresponds to a single increment between station plot elements.
  • transform (matplotlib.transforms.Transform (or compatible)) – The default transform to apply to the x and y positions when plotting.
  • kwargs – Additional keyword arguments to use for matplotlib’s plotting functions. These will be passed to all the plotting methods, and thus need to be valid for all plot types, such as clip_on.
plot_barb(u, v, **kwargs)[source]

At the center of the station model plot wind barbs.

Additional keyword arguments given will be passed onto matplotlib’s barbs() function; this is useful for specifying things like color or line width.

Parameters:
  • u (array-like) – The data to use for the u-component of the barbs.
  • v (array-like) – The data to use for the v-component of the barbs.
  • plot_units (pint.unit) – Units to plot in (performing conversion if necessary). Defaults to given units.
  • kwargs – Additional keyword arguments to pass to matplotlib’s barbs() function.
plot_parameter(location, parameter, formatter='.0f', **kwargs)[source]

At the specified location in the station model plot a set of values.

This specifies that at the offset location, the data in parameter should be plotted. The conversion of the data values to a string is controlled by formatter.

Additional keyword arguments given will be passed onto the actual plotting code; this is useful for specifying things like color or font properties.

If something has already been plotted at this location, it will be replaced.

Parameters:
  • location (str or tuple[float, float]) – The offset (relative to center) to plot this parameter. If str, should be one of ‘C’, ‘N’, ‘NE’, ‘E’, ‘SE’, ‘S’, ‘SW’, ‘W’, or ‘NW’. Otherwise, should be a tuple specifying the number of increments in the x and y directions; increments are multiplied by spacing to give offsets in x and y relative to the center.
  • parameter (array_like) – The numeric values that should be plotted
  • formatter (str or callable, optional) – How to format the data as a string for plotting. If a string, it should be compatible with the format() builtin. If a callable, this should take a value and return a string. Defaults to ‘0.f’.
  • kwargs – Additional keyword arguments to use for matplotlib’s plotting functions.
plot_symbol(location, codes, symbol_mapper, **kwargs)[source]

At the specified location in the station model plot a set of symbols.

This specifies that at the offset location, the data in codes should be converted to unicode characters (for our wx_symbol_font) using symbol_mapper, and plotted.

Additional keyword arguments given will be passed onto the actual plotting code; this is useful for specifying things like color or font properties.

If something has already been plotted at this location, it will be replaced.

Parameters:
  • location (str or tuple[float, float]) – The offset (relative to center) to plot this parameter. If str, should be one of ‘C’, ‘N’, ‘NE’, ‘E’, ‘SE’, ‘S’, ‘SW’, ‘W’, or ‘NW’. Otherwise, should be a tuple specifying the number of increments in the x and y directions; increments are multiplied by spacing to give offsets in x and y relative to the center.
  • codes (array_like) – The numeric values that should be converted to unicode characters for plotting.
  • symbol_mapper (callable) – Controls converting data values to unicode code points for the wx_symbol_font font. This should take a value and return a single unicode character. See metpy.plots.wx_symbols for included mappers.
  • kwargs – Additional keyword arguments to use for matplotlib’s plotting functions.
../../_images/metpy-plots-StationPlot-1_01_00.png
../../_images/metpy-plots-StationPlot-1_01_01.png
../../_images/metpy-plots-StationPlot-1_01_02.png
../../_images/metpy-plots-StationPlot-1_01_03.png
../../_images/metpy-plots-StationPlot-1_01_04.png
../../_images/metpy-plots-StationPlot-1_01_05.png
../../_images/metpy-plots-StationPlot-1_01_06.png
plot_text(location, text, **kwargs)[source]

At the specified location in the station model plot a collection of text.

This specifies that at the offset location, the strings in text should be plotted.

Additional keyword arguments given will be passed onto the actual plotting code; this is useful for specifying things like color or font properties.

If something has already been plotted at this location, it will be replaced.

Parameters:
  • location (str or tuple[float, float]) – The offset (relative to center) to plot this parameter. If str, should be one of ‘C’, ‘N’, ‘NE’, ‘E’, ‘SE’, ‘S’, ‘SW’, ‘W’, or ‘NW’. Otherwise, should be a tuple specifying the number of increments in the x and y directions; increments are multiplied by spacing to give offsets in x and y relative to the center.
  • text (list (or array) of strings) – The strings that should be plotted
  • kwargs – Additional keyword arguments to use for matplotlib’s plotting functions.

Examples using metpy.plots.StationPlot