patchwork.plotting
Matplotlib plots for AMR patch layouts and patch-local fields.
Functions
| Name | Description |
|---|---|
plot_patches | Plot patch extents and cell grids, optionally colored by a field. |
plot_patchesfunction#
def plot_patches(hierarchy: AMRHierarchy, *, field: str | None = None, show_grid: bool = True, ax: Any = None, cmap: str = 'viridis', root: int = 0, grid_linewidth: float | None = None, grid_alpha: float | None = None) -> tuple[Any, Any] | NonePlot patch extents and cell grids, optionally colored by a field.
With show_grid=False and no field only the patch outlines are drawn,
e.g. over an image that is already on ax. grid_linewidth and
grid_alpha set the cell lines of every level; by default they are thin
and faint, more so on the base level, which suits a large figure. A small
one, e.g. an animation’s frames, may need stronger lines.
When field is provided, each patch field is gathered collectively and
plotted on root only. Call this function on every rank in the patch
communicator. Layout-only plots are also returned on root only.
Matplotlib is imported only when this function is called.
Returns (figure, axes) on the plotting rank and None elsewhere.