# How to use Alternative Box Plot

13 views (last 30 days)
Blue on 7 Aug 2019
Commented: Blue on 13 Aug 2019
Hi,
I dont have the Statistics and Machine Learning Toolbox and I was wondering if anyone knew how to use the alternative box plot function (pick of the week: https://blogs.mathworks.com/pick/2016/07/08/alternative-box-plot/) ? I dont dont quite understand how the data is supposed to be structured. The following snippet yield the following error: Data are plotted for each column. Each column in the input has only one data point.
import iosr.statistics.*
Hour = 0:23
Power = 1:1000
y = tab2box(Hour, Power); % reshapes to be boxPlot compliant
bp = boxPlot(0:23, y, 'Notch', true, 'Percentile', [10 90]);

Sahithi Kanumarlapudi on 12 Aug 2019
In order to use boxPlot(x,y) the number of elements in ‘x’ should be equal to the number of columns in ‘y’.
In your code y is of dimensions 9x9. boxPlot didn’t work because x is of dimension (1x24) and number of columns in y are 9.
y' is of dimensions 9x9 because tab2box(Xin,Yin) prepares data, in tabular form, for use in the BOX_PLOT function. Specifically, XIN and YIN are vectors (for example column vectors from a results table). Y is an N-by-P numeric array, where P is the number of unique elements in XIN, and N is the maximum number of occurrences of any individual element of XIN. In cases where elements in XIN do not occur an equal number of times, columns in YIN are padded with NaNs as per the documentation of the function.

#### 1 Comment

Blue on 13 Aug 2019
Thank you kindly.