How to use boxchart()?
조회 수: 80 (최근 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');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/412433/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/412438/image.png)
댓글 수: 0
채택된 답변
Cris LaPierre
2020년 11월 13일
편집: Cris LaPierre
2020년 11월 13일
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.
boxchart(___,'GroupByColor',cgroupdata)
Therefore, try changing your code to
boxchart(data_dB1,'GroupByColor',dates_concatenated)
댓글 수: 12
Cris LaPierre
2021년 12월 16일
boxchart was introduced in R2020a. If you have the Statistics and Machine Learning toolbox, you can use boxplot instead. Otherwise, you will need to update your MATLAB version to at least R2020a.
Fuqiang Guo
2021년 12월 23일
Thank you very much, your advice is very helpful, I'll update my software version
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!