Skip to content

Commit bc0eb0f

Browse files
committed
API changes in matplotlib.pyplot.scatter, added docstring
1 parent 21553ec commit bc0eb0f

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

sfs/plot2d.py

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,38 @@ def level(p, grid, *, xnorm=None, power=False, cmap=None, vmax=3, vmin=-50,
330330

331331

332332
def particles(x, *, trim=None, ax=None, xlabel='x (m)', ylabel='y (m)',
333-
edgecolor='', marker='.', s=15, **kwargs):
334-
"""Plot particle positions as scatter plot"""
333+
edgecolors=None, marker='.', s=15, **kwargs):
334+
"""Plot particle positions as scatter plot.
335+
336+
Parameters
337+
----------
338+
x : triple or pair of array_like
339+
x, y and optionally z components of particle positions. The z
340+
components are ignored.
341+
If the values are complex, the imaginary parts are ignored.
342+
343+
Returns
344+
-------
345+
Scatter
346+
See :func:`matplotlib.pyplot.scatter`.
347+
348+
Other Parameters
349+
----------------
350+
trim : array of float, optional
351+
xmin, xmax, ymin, ymax limits for which the particles are plotted.
352+
ax : Axes, optional
353+
If given, the plot is created on *ax* instead of the current
354+
axis (see :func:`matplotlib.pyplot.gca`).
355+
xlabel, ylabel : str
356+
Overwrite default x/y labels. Use ``xlabel=''`` and
357+
``ylabel=''`` to remove x/y labels. The labels can be changed
358+
afterwards with :func:`matplotlib.pyplot.xlabel` and
359+
:func:`matplotlib.pyplot.ylabel`.
360+
edgecolors, markr, s, **kwargs
361+
All further parameters are forwarded to
362+
:func:`matplotlib.pyplot.scatter`.
363+
364+
"""
335365
XX, YY = [_np.real(c) for c in x[:2]]
336366

337367
if trim is not None:
@@ -348,7 +378,7 @@ def particles(x, *, trim=None, ax=None, xlabel='x (m)', ylabel='y (m)',
348378
ax.set_xlabel(xlabel)
349379
if ylabel:
350380
ax.set_ylabel(ylabel)
351-
return ax.scatter(XX, YY, edgecolor=edgecolor, marker=marker, s=s,
381+
return ax.scatter(XX, YY, edgecolors=edgecolors, marker=marker, s=s,
352382
**kwargs)
353383

354384

0 commit comments

Comments
 (0)