Skip to content

Commit db0d34e

Browse files
authored
Merge pull request #82 from Laetitia1402/PR-Laetitia
Add field option to plot_iso
2 parents 5154ca2 + 8c039f9 commit db0d34e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

stagpy/field.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,27 @@ def plot_scalar(step: Step, var: str, field: Optional[ndarray] = None,
259259
return fig, axis, surf, cbar
260260

261261

262-
def plot_iso(axis: Axes, step: Step, var: str, **extra: Any) -> None:
262+
def plot_iso(axis: Axes, step: Step, var: str,
263+
field: Optional[ndarray] = None, **extra: Any) -> None:
263264
"""Plot isocontours of scalar field.
264265
265266
Args:
266267
axis: the :class:`matplotlib.axes.Axes` of an existing matplotlib
267268
figure where the isocontours should be plotted.
268269
step: a :class:`~stagpy._step.Step` of a StagyyData instance.
269270
var: the scalar field name.
271+
field: if not None, it is plotted instead of step.fields[var]. This is
272+
useful to plot a masked or rescaled array. Note that if
273+
conf.scaling.dimensional is True, this field will be scaled
274+
accordingly.
270275
extra: options that will be passed on to
271276
:func:`matplotlib.axes.Axes.contour`.
272277
"""
273278
xmesh, ymesh, fld, _ = get_meshes_fld(step, var)
279+
280+
if field is not None:
281+
fld = field
282+
274283
if conf.field.shift:
275284
fld = np.roll(fld, conf.field.shift, axis=0)
276285
extra_opts: Dict[str, Any] = dict(linewidths=1)

0 commit comments

Comments
 (0)