iris.plot¶
Iris-specific extensions to matplotlib, mimicking the matplotlib.pyplot
interface.
See also: matplotlib.
In this module:
-
iris.plot.
citation
(text, figure=None, axes=None)[source]¶ Add a text citation to a plot.
Places an anchored text citation in the bottom right hand corner of the plot.
Args:
- text:
Citation text to be plotted.
Kwargs:
- figure:
Target
matplotlib.figure.Figure
instance. Defaults to the current figure if none provided.
- axes: the
matplotlib.axes.Axes
to use for drawing. Defaults to the current axes if none provided.
- axes: the
-
iris.plot.
contour
(cube, *args, **kwargs)[source]¶ Draws contour lines based on the given Cube.
Kwargs:
- coords: list of
Coord
objects or coordinate names. Use the given coordinates as the axes for the plot. The order of the given coordinates indicates which axis to use for each, where the first element is the horizontal axis of the plot and the second element is the vertical axis of the plot.
- coords: list of
- axes: the
matplotlib.axes.Axes
to use for drawing. Defaults to the current axes if none provided.
- axes: the
See
matplotlib.pyplot.contour()
for details of other valid keyword arguments.
-
iris.plot.
contourf
(cube, *args, **kwargs)[source]¶ Draws filled contours based on the given Cube.
Kwargs:
- coords: list of
Coord
objects or coordinate names. Use the given coordinates as the axes for the plot. The order of the given coordinates indicates which axis to use for each, where the first element is the horizontal axis of the plot and the second element is the vertical axis of the plot.
- coords: list of
- axes: the
matplotlib.axes.Axes
to use for drawing. Defaults to the current axes if none provided.
- axes: the
See
matplotlib.pyplot.contourf()
for details of other valid keyword arguments.
-
iris.plot.
default_projection
(cube)[source]¶ Return the primary map projection for the given cube.
Using the returned projection, one can create a cartopy map with:
import matplotlib.pyplot as plt ax = plt.ax(projection=default_projection(cube))
-
iris.plot.
default_projection_extent
(cube, mode=0)[source]¶ Return the cube’s extents
(x0, x1, y0, y1)
in its default projection.- Keyword Arguments
mode - Either iris.coords.POINT_MODE or iris.coords.BOUND_MODE. (*) – Triggers whether the extent should be representative of the cell points, or the limits of the cell’s bounds. The default is iris.coords.POINT_MODE.
-
iris.plot.
orography_at_bounds
(cube, facecolor='#888888', coords=None, axes=None)[source]¶ Plots orography defined at cell boundaries from the given Cube.
-
iris.plot.
orography_at_points
(cube, facecolor='#888888', coords=None, axes=None)[source]¶ Plots orography defined at sample points from the given Cube.
-
iris.plot.
outline
(cube, coords=None, color='k', linewidth=None, axes=None)[source]¶ Draws cell outlines based on the given Cube.
Kwargs:
- coords: list of
Coord
objects or coordinate names. Use the given coordinates as the axes for the plot. The order of the given coordinates indicates which axis to use for each, where the first element is the horizontal axis of the plot and the second element is the vertical axis of the plot.
- coords: list of
- color: None or mpl color The color of the cell outlines. If
None, the matplotlibrc setting patch.edgecolor is used by default.
- linewidth: None or number The width of the lines showing the
cell outlines. If None, the default width in patch.linewidth in matplotlibrc is used.
- axes: the
matplotlib.axes.Axes
to use for drawing. Defaults to the current axes if none provided.
- axes: the
-
iris.plot.
pcolor
(cube, *args, **kwargs)[source]¶ Draws a pseudocolor plot based on the given 2-dimensional Cube.
The cube must have either two 1-dimensional coordinates or two 2-dimensional coordinates with contiguous bounds to plot the cube against.
Kwargs:
- coords: list of
Coord
objects or coordinate names. Use the given coordinates as the axes for the plot. The order of the given coordinates indicates which axis to use for each, where the first element is the horizontal axis of the plot and the second element is the vertical axis of the plot.
- coords: list of
- axes: the
matplotlib.axes.Axes
to use for drawing. Defaults to the current axes if none provided.
- axes: the
- contiguity_tolerance: The absolute tolerance used when checking for
contiguity between the bounds of the cells. Defaults to None.
See
matplotlib.pyplot.pcolor()
for details of other valid keyword arguments.
-
iris.plot.
pcolormesh
(cube, *args, **kwargs)[source]¶ Draws a pseudocolor plot based on the given 2-dimensional Cube.
The cube must have either two 1-dimensional coordinates or two 2-dimensional coordinates with contiguous bounds to plot against each other.
Kwargs:
- coords: list of
Coord
objects or coordinate names. Use the given coordinates as the axes for the plot. The order of the given coordinates indicates which axis to use for each, where the first element is the horizontal axis of the plot and the second element is the vertical axis of the plot.
- coords: list of
- axes: the
matplotlib.axes.Axes
to use for drawing. Defaults to the current axes if none provided.
- axes: the
- contiguity_tolerance: The absolute tolerance used when checking for
contiguity between the bounds of the cells. Defaults to None.
See
matplotlib.pyplot.pcolormesh()
for details of other valid keyword arguments.
-
iris.plot.
plot
(*args, **kwargs)[source]¶ Draws a line plot based on the given cube(s) or coordinate(s).
The first one or two arguments may be cubes or coordinates to plot. Each of the following is valid:
# plot a 1d cube against its dimension coordinate plot(cube) # plot a 1d coordinate plot(coord) # plot a 1d cube against a given 1d coordinate, with the cube # values on the y-axis and the coordinate on the x-axis plot(coord, cube) # plot a 1d cube against a given 1d coordinate, with the cube # values on the x-axis and the coordinate on the y-axis plot(cube, coord) # plot two 1d coordinates against one-another plot(coord1, coord2) # plot two 1d cubes against one-another plot(cube1, cube2)
Kwargs:
- axes: the
matplotlib.axes.Axes
to use for drawing. Defaults to the current axes if none provided.
- axes: the
See
matplotlib.pyplot.plot()
for details of additional valid keyword arguments.
-
iris.plot.
points
(cube, *args, **kwargs)[source]¶ Draws sample point positions based on the given Cube.
Kwargs:
- coords: list of
Coord
objects or coordinate names. Use the given coordinates as the axes for the plot. The order of the given coordinates indicates which axis to use for each, where the first element is the horizontal axis of the plot and the second element is the vertical axis of the plot.
- coords: list of
- axes: the
matplotlib.axes.Axes
to use for drawing. Defaults to the current axes if none provided.
- axes: the
See
matplotlib.pyplot.scatter()
for details of other valid keyword arguments.
-
iris.plot.
quiver
(u_cube, v_cube, *args, **kwargs)[source]¶ Draws an arrow plot from two vector component cubes.
Args:
- u_cube, v_cube(
Cube
) u and v vector components. Must have same shape and units. If the cubes have geographic coordinates, the values are treated as true distance differentials, e.g. windspeeds, and not map coordinate vectors. The components are aligned with the North and East of the cube coordinate system.
- u_cube, v_cube(
Kwargs:
- coords: (list of
Coord
or string) Coordinates or coordinate names. Use the given coordinates as the axes for the plot. The order of the given coordinates indicates which axis to use for each, where the first element is the horizontal axis of the plot and the second element is the vertical axis of the plot.
- coords: (list of
- axes: the
matplotlib.axes.Axes
to use for drawing. Defaults to the current axes if none provided.
- axes: the
See
matplotlib.pyplot.quiver()
for details of other valid keyword arguments.
-
iris.plot.
scatter
(x, y, *args, **kwargs)[source]¶ Draws a scatter plot based on the given cube(s) or coordinate(s).
Args:
Kwargs:
- axes: the
matplotlib.axes.Axes
to use for drawing. Defaults to the current axes if none provided.
- axes: the
See
matplotlib.pyplot.scatter()
for details of additional valid keyword arguments.
-
iris.plot.
symbols
(x, y, symbols, size, axes=None, units='inches')[source]¶ Draws fixed-size symbols.
See
iris.symbols
for available symbols.Args:
- x: iterable
The x coordinates where the symbols will be plotted.
- y: iterable
The y coordinates where the symbols will be plotted.
- symbols: iterable
The symbols (from
iris.symbols
) to plot.
- size: float
The symbol size in units.
Kwargs:
- axes: the
matplotlib.axes.Axes
to use for drawing. Defaults to the current axes if none provided.
- axes: the
- units: [‘inches’, ‘points’]
The unit for the symbol size.
PlotDefn(coords, transpose)
- class
iris.plot.
PlotDefn
(_cls, coords, transpose)¶Create new instance of PlotDefn(coords, transpose)
count
(value, /)¶Return number of occurrences of value.
index
(value, start=0, stop=9223372036854775807, /)¶Return first index of value.
Raises ValueError if the value is not present.
coords
¶Alias for field number 0
transpose
¶Alias for field number 1