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 Center および File ExchangeData Distribution Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by