Boxplot with groups and overlaid with scatter data
8 views (last 30 days)
Show older comments
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 Comments
Adam Danz
on 22 Oct 2020
Can't you just rename the categories 6 and 7 of the scatterplot data to match categories 5 & 6 of the boxplot data?
Answers (0)
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!