MATLAB Answers

How to use boxchart()?

조회 수: 141(최근 30일)
I am trying to use a boxchart for the first time as opposed to a boxplot, as it looks to have better functionality for what I want to do.
But, it's not working and I can't understand what's wrong...
On the x axis I would like to have 22 different dates, represented on the y by a box plot of 22*144 data points.
boxchart(data_dB1,dates_concatenated)
Error using boxchart
Expected ydata to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64
Error in boxchart (line 95)
validateattributes(ydata,{'numeric'},{'2d','real'},mfilename,'ydata');

채택된 답변

Cris LaPierre
Cris LaPierre 13 Nov 2020
편집: Cris LaPierre 13 Nov 2020
I think the error is because you are using the syntax boxchart(xgroupdata,ydata), but your inputs are reversed. You put the grouping variable second. Also, your grouping data is not valid for use as xgroupdata.
From the documentation, if you want to use a cell array of characters, you must use the syntax
boxchart(___,'GroupByColor',cgroupdata)
Therefore, try changing your code to
boxchart(data_dB1,'GroupByColor',dates_concatenated)
  댓글 수: 9
Louise Wilson
Louise Wilson 17 Nov 2020
Hi Chris, this is fantastic. Thank you so much for your help, this is exactly what I was looking for. I hadn't seen that example either.

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

추가 답변(0개)

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by