MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / violin_stats

Function violin_stats

lib/matplotlib/cbook.py:1485–1619  ·  view source on GitHub ↗

Return a list of dictionaries of data which can be used to draw a series of violin plots. See the ``Returns`` section below to view the required keys of the dictionary. Users can skip this function and pass a user-defined set of dictionaries with the same keys to `~.axes.A

(X, method=("GaussianKDE", "scott"), points=100, quantiles=None)

Source from the content-addressed store, hash-verified

1483
1484
1485def violin_stats(X, method=("GaussianKDE", "scott"), points=100, quantiles=None):
1486 """
1487 Return a list of dictionaries of data which can be used to draw a series
1488 of violin plots.
1489
1490 See the ``Returns`` section below to view the required keys of the
1491 dictionary.
1492
1493 Users can skip this function and pass a user-defined set of dictionaries
1494 with the same keys to `~.axes.Axes.violin` instead of using Matplotlib
1495 to do the calculations. See the *Returns* section below for the keys
1496 that must be present in the dictionaries.
1497
1498 Parameters
1499 ----------
1500 X : 1D array or sequence of 1D arrays or 2D array
1501 Sample data that will be used to produce the gaussian kernel density
1502 estimates. Non-finite and masked values are ignored.
1503 Possible values:
1504
1505 - 1D array: Statistics are computed for that array.
1506 - sequence of 1D arrays: Statistics are computed for each array in the sequence.
1507 - 2D array: Statistics are computed for each column in the array.
1508
1509 method : (name, bw_method) or callable,
1510 The method used to calculate the kernel density estimate for each
1511 column of data. Valid values:
1512
1513 - a tuple of the form ``(name, bw_method)`` where *name* currently must
1514 always be ``"GaussianKDE"`` and *bw_method* is the method used to
1515 calculate the estimator bandwidth. Supported values are 'scott',
1516 'silverman' or a float or a callable. If a float, this will be used
1517 directly as `!kde.factor`. If a callable, it should take a
1518 `matplotlib.mlab.GaussianKDE` instance as its only parameter and
1519 return a float.
1520
1521 - a callable with the signature ::
1522
1523 def method(data: ndarray, coords: ndarray) -> ndarray
1524
1525 It should return the KDE of *data* evaluated at *coords*.
1526
1527 .. versionadded:: 3.11
1528 Support for ``(name, bw_method)`` tuple.
1529
1530 points : int, default: 100
1531 Defines the number of points to evaluate each of the gaussian kernel
1532 density estimates at.
1533
1534 quantiles : array-like, default: None
1535 Defines (if not None) a list of floats in interval [0, 1] for each
1536 column of data, which represents the quantiles that will be rendered
1537 for that column of data. Must have 2 or fewer dimensions. 1D array will
1538 be treated as a singleton list containing them.
1539
1540 Returns
1541 -------
1542 list of dict

Callers

nothing calls this directly

Calls 5

_reshape_2DFunction · 0.85
delete_masked_pointsFunction · 0.85
methodFunction · 0.85
minMethod · 0.80
maxMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…