Boxplot with groups and overlaid with scatter data

조회 수: 8 (최근 30일)
Yemi Ajayi
Yemi Ajayi 2020년 10월 22일
댓글: Yemi Ajayi 2020년 10월 22일
Hello all,
I am having some trouble overlaying scatter data onto box plots when both the scatter and box data are grouped by categorical data.
Here's a summary of the issue:
I have data that is grouped by two different variables (lets call them A and B). Each of the variables have different categorical data.
A has 3 categories (A1, A2 and A3), while B has 6 (B1:B6). As you can imagine, not all the groups of A have accompanying data matching the "sub-group" B. For instance, there is no overlap between A1 and B4 (which is okay in my dataset).
Now I am able to create a boxplot of my data grouped A1 and B and get five box categories.
Similarly, I am able to plot the scatter data and get 5 scatter categories.
The issue arises when I attempt to overlap the data (ie. hold on/off).
As you can see, categories 1,2 and 3 overlap properly, but the others do not. I have a workaround in mind for "fixing" this which involves pretty much re-indexing my categories from (1:5) with command loops for both plots but I imagined there may be a better way to do this if I ask the experts on here.
Please let me know if any additional information is needed to help.
Thanks.
  댓글 수: 2
Adam Danz
Adam Danz 2020년 10월 22일
Can't you just rename the categories 6 and 7 of the scatterplot data to match categories 5 & 6 of the boxplot data?
Yemi Ajayi
Yemi Ajayi 2020년 10월 22일
Hi Adam,
You're correct. And this is pretty much the concept behind my "workaround" that I mentioned. I just wanted to make sure there wasn't a more sophisticated (or perhaps efficient) solution that I hadn't considered.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by