Boxplot with groups and overlaid with scatter data

6 次查看(过去 30 天)
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