# iris.plot¶

Iris-specific extensions to matplotlib, mimicking the matplotlib.pyplot interface.

In this module:

iris.plot.citation(text, figure=None, axes=None)

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:

↑ top ↑

iris.plot.contour(cube, *args, **kwargs)

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.
• axes: the matplotlib.axes.Axes to use for drawing.
Defaults to the current axes if none provided.

See matplotlib.pyplot.contour() for details of other valid keyword arguments.

↑ top ↑

iris.plot.contourf(cube, *args, **kwargs)

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.
• axes: the matplotlib.axes.Axes to use for drawing.
Defaults to the current axes if none provided.

See matplotlib.pyplot.contourf() for details of other valid keyword arguments.

↑ top ↑

iris.plot.default_projection(cube)

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))


↑ top ↑

iris.plot.default_projection_extent(cube, mode=0)

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.

↑ top ↑

iris.plot.orography_at_bounds(cube, facecolor='#888888', coords=None, axes=None)

Plots orography defined at cell boundaries from the given Cube.

↑ top ↑

iris.plot.orography_at_points(cube, facecolor='#888888', coords=None, axes=None)

Plots orography defined at sample points from the given Cube.

↑ top ↑

iris.plot.outline(cube, coords=None, color='k', linewidth=None, axes=None)

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

↑ top ↑

iris.plot.pcolor(cube, *args, **kwargs)

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.
• axes: the matplotlib.axes.Axes to use for drawing.
Defaults to the current axes if none provided.
• 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.

↑ top ↑

iris.plot.pcolormesh(cube, *args, **kwargs)

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.
• axes: the matplotlib.axes.Axes to use for drawing.
Defaults to the current axes if none provided.
• 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.

↑ top ↑

iris.plot.plot(*args, **kwargs)

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:

See matplotlib.pyplot.plot() for details of additional valid keyword arguments.

↑ top ↑

iris.plot.points(cube, *args, **kwargs)

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.
• axes: the matplotlib.axes.Axes to use for drawing.
Defaults to the current axes if none provided.

See matplotlib.pyplot.scatter() for details of other valid keyword arguments.

↑ top ↑

iris.plot.quiver(u_cube, v_cube, *args, **kwargs)

Draws an arrow plot from two vector component cubes.

Args:

• u_cube, v_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.

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.
• axes: the matplotlib.axes.Axes to use for drawing.
Defaults to the current axes if none provided.

See matplotlib.pyplot.quiver() for details of other valid keyword arguments.

↑ top ↑

iris.plot.scatter(x, y, *args, **kwargs)

Draws a scatter plot based on the given cube(s) or coordinate(s).

Args:

Kwargs:

See matplotlib.pyplot.scatter() for details of additional valid keyword arguments.

↑ top ↑

iris.plot.symbols(x, y, symbols, size, axes=None, units='inches')

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.
• units: [‘inches’, ‘points’]
The unit for the symbol size.

↑ top ↑

PlotDefn(coords, transpose)

class iris.plot.PlotDefn(_cls, coords, transpose)

Bases: tuple

Create new instance of PlotDefn(coords, transpose)

count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- 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