How to use Alternative Box Plot

9 ビュー (過去 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