bfieldtools.viz.plot_cross_section

bfieldtools.viz.plot_cross_section(X, Y, data, axes=None, cmap=None, colorbar=False, contours=10, log=False, vmin=None, vmax=None)

Plot scalar data on a plane

Parameters
X: (N_x, N_y)

meshgrid-generated 2D array with X coordinates for each data point

Y: (N_x, N_y) array

meshgrid-generated 2D array with Y coordinates for each data point

data: (N_x, N_y) array

2D array with data for each point in X, Y

axes: matplotlib axes

Optional, if passed plot to existing axes. If None (default), plot to new figure/axes

cmap: str

name of colormap to use for scalar data. If None (default), use viridis for all-positive/-negative data and RdBu otherwise

colorbar: Boolean

If True, plot colorbar for data

contours: None, int or array-like

If None, no contour lines are plotted. If int, plots specific number of equispaced contour lines. If array-like, plot contours at values in array.

log: Boolean

if True, colormap is log-scaled. Else, colormap is linear.

vmin, vmax: float or None

Explicit colormap minimum and maximum values. If not passed, range is according to data

Returns
axes: matplotlib axes with plot