Skip to content

Commit 8a2022a

Browse files
committed
DOC: Clarify data inputs for boxplot() and violinplot()
1 parent ca3a030 commit 8a2022a

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

lib/matplotlib/axes/_axes.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4325,10 +4325,12 @@ def boxplot(self, x, notch=None, sym=None, vert=None,
43254325
43264326
Parameters
43274327
----------
4328-
x : Array or a sequence of vectors.
4329-
The input data. If a 2D array, a boxplot is drawn for each column
4330-
in *x*. If a sequence of 1D arrays, a boxplot is drawn for each
4331-
array in *x*.
4328+
x : 1D array or sequence of 1D arrays or 2D array
4329+
The input data.
4330+
4331+
- If a 1D array, a single box is drawn.
4332+
- If a sequence of 1D arrays, a box is drawn for each array in the sequence.
4333+
- If a 2D array, a box is drawn for each column in the array.
43324334
43334335
notch : bool, default: :rc:`boxplot.notch`
43344336
Whether to draw a notched boxplot (`True`), or a rectangular
@@ -8862,9 +8864,13 @@ def violinplot(self, dataset, positions=None, vert=None,
88628864
88638865
Parameters
88648866
----------
8865-
dataset : Array or a sequence of vectors.
8867+
dataset : 1D array or sequence of 1D arrays or 2D array
88668868
The input data.
88678869
8870+
- If a 1D array, a single box is drawn.
8871+
- If a sequence of 1D arrays, a box is drawn for each array in the sequence.
8872+
- If a 2D array, a box is drawn for each column in the array.
8873+
88688874
positions : array-like, default: [1, 2, ..., n]
88698875
The positions of the violins; i.e. coordinates on the x-axis for
88708876
vertical violins (or y-axis for horizontal violins).

lib/matplotlib/cbook.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,14 @@ def violin_stats(X, method=("GaussianKDE", "scott"), points=100, quantiles=None)
14631463
14641464
Parameters
14651465
----------
1466-
X : array-like
1466+
X : 1D array or sequence of 1D arrays or 2D array
1467+
Sample data that will be used to produce the gaussian kernel density
1468+
estimates. Must have 2 or fewer dimensions.
1469+
1470+
- If a 1D array, statistics are computed for that array.
1471+
- If a sequence of 1D arrays, statistics are computer for array in the sequence.
1472+
- If a 2D array, statistics are computed for each column in the array.
1473+
14671474
Sample data that will be used to produce the gaussian kernel density
14681475
estimates. Must have 2 or fewer dimensions.
14691476

0 commit comments

Comments
 (0)