How to use Alternative Box Plot

조회 수: 2 (최근 30일)
Blue
Blue 2019년 8월 7일
댓글: Blue 2019년 8월 13일
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
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.
  댓글 수: 1
Blue
Blue 2019년 8월 13일
Thank you kindly.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by