How to use Alternative Box Plot
3 次查看(过去 30 天)
显示 更早的评论
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]);
0 个评论
采纳的回答
Sahithi Kanumarlapudi
2019-8-12
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.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!