xoa.plot.plot_section#
- xoa.plot.plot_section(da, x=None, ax=None, method=None, title=None, add_colorbar=True, cbar_kwargs=None, **kwargs)[source]#
Plot a vertical section
The vertical coordinate, either z or depth, is found with
xoa.coords.get_vertical()and may vary with the horizontal dimension, like with terrain-following coordinates. The vertical axis is inverted when depths are positive down, according toxoa.coords.get_positive_attr().- Parameters:
da (xarray.DataArray) – Array with a vertical and a horizontal dimension only
x (None, str, xarray.DataArray) –
Horizontal axis as one of:
None: longitude or latitude, according to the largest extent"lon","lat": the coordinate found withxoa.coords"distance": the distance in km along the sectiona data array that is broadcastable to the horizontal dimension
ax (None, matplotlib.axes.Axes)
method (None, {"pcolormesh", "contourf", "contour"}) – Plot method of
matplotlib.axes.Axes, which defaults to theplot.section_methodoptiontitle (None, str)
add_colorbar (bool)
cbar_kwargs (None, dict) – Parameters passed to
matplotlib.figure.Figure.colorbar(). The colorbar is shrunk by default (shrink=0.7).kwargs – Extra parameters are passed to the plot method.
- Returns:
matplotlib.cm.ScalarMappable
Example
plot_section(ds.temp.isel(time=0, eta_rho=10), cmap="Spectral_r")