MATLAB Answers

sort boxplot based on 25-75th percentiles

조회 수: 2(최근 30일)
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2020년 6월 27일
댓글: Nikolas Spiliopoulos 2020년 6월 28일
Hi all,
I have a figure with 3 boxplots in it (different colors each of them)
However, I would like to sort them based on the difference between 25th-75th percentile.
Is it possible to do it?
And if yes can I keep the initial colours after they have been sorted?
thanks a lot

채택된 답변

the cyclist
the cyclist 2020년 6월 27일
Yes, it is possible. The algorithm would be something like
  • Find the percentiles on the data, using the prctile command, before plotting them with boxplot
  • Sort those percentiles, and store the sorting order
  • Use a grouping variable (the second argument to the boxplot command), making sure that the grouping variable values are sorted according to the correct order
I could probably give more specific advice if you upload the data and code that you are using now.
  댓글 수: 3
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2020년 6월 28일
Thanks a lot,
that's exactly what I need

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

추가 답변(0개)


Community Treasure Hunt

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

Start Hunting!

Translated by