plottools module of useful matplotlib tools¶
See also
Documentation auto-generated from the module docstrings¶
Module with some miscellaneous useful tools.
- clawpack.visclaw.plottools.pcolorcells(X, Y, Z, ax=None, **kwargs)¶
Wraps pcolormesh in a way that works if X,Y are cell centers or edges. X,Y can be 2d or 1d arrays.
if ax==None then the plot is done on a new set of axes, otherwise on ax
X,Y,Z is the data to be plotted. It is assumed to be finite volume data where Z[i,j] is a constant value over a grid cell.
Internally x,y are defined as 1d arrays since it is assumed the grids are Cartesian.
If the length of the 1d arrays x and y match the dimensions of Z then these are assumed to be cell center values. In this case the arrays are expanded by one to obtain x_edge, y_edge as edge values, as needed for proper alignment.
If the length of x,y is already one greater than the corresponding dimension of Z, then it is assumed that these are already edge values.
Notes:
This should work also if x and/or y is decreasing rather than increasing.
Should also work regardless of index order.
- clawpack.visclaw.plottools.plotbox(xy, kwargs={'color': 'b', 'linewidth': 2})¶
Add a box around a region to an existing plot. xy can be a list of [x1, x2, y1, y2] of the corners or a string “x1 x2 y1 y2”.