Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4d2d1e

Browse files
authored
Merge pull request #30936 from timhoffm/doc-violinplot-boxplot
DOC: Clarify data inputs for boxplot() and violinplot()
2 parents ca3a030 + 5a245ba commit f4d2d1e

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

lib/matplotlib/axes/_axes.py

Lines changed: 12 additions & 6 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. Possible values:
4330+
4331+
- 1D array: A single box is drawn.
4332+
- sequence of 1D arrays: A box is drawn for each array in the sequence.
4333+
- 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,8 +8864,12 @@ def violinplot(self, dataset, positions=None, vert=None,
88628864
88638865
Parameters
88648866
----------
8865-
dataset : Array or a sequence of vectors.
8866-
The input data.
8867+
dataset : 1D array or sequence of 1D arrays or 2D array
8868+
The input data. Possible values:
8869+
8870+
- 1D array: A single violin is drawn.
8871+
- sequence of 1D arrays: A violin is drawn for each array in the sequence.
8872+
- 2D array: A violin is drawn for each column in the array.
88678873
88688874
positions : array-like, default: [1, 2, ..., n]
88698875
The positions of the violins; i.e. coordinates on the x-axis for

lib/matplotlib/cbook.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,9 +1463,13 @@ 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
14671467
Sample data that will be used to produce the gaussian kernel density
1468-
estimates. Must have 2 or fewer dimensions.
1468+
estimates. Possible values:
1469+
1470+
- 1D array: Statistics are computed for that array.
1471+
- sequence of 1D arrays: Statistics are computed for each array in the sequence.
1472+
- 2D array: Statistics are computed for each column in the array.
14691473
14701474
method : (name, bw_method) or callable,
14711475
The method used to calculate the kernel density estimate for each

0 commit comments

Comments
 (0)