Why does gscatter create extra groups that are already represented?

2 ビュー (過去 30 日間)
Heidi Hirsh
Heidi Hirsh 2019 年 3 月 18 日
コメント済み: Heidi Hirsh 2019 年 3 月 18 日
I am using gscatter to plot data and then color the data by site. I have 6 sites (PK, PO, EK, EO, LK, LO) to plot but I get 9 groups from gscatter. I am working around it for now by coloring redundant groups the same but I would like to understand what is happening. Does anyone have any insight about this?
This is my code for plotting the data (I have also attached a .mat file with the data in question).
h=gscatter(DIC,TA,SiteID);
EKgroup = h(1); EKgroup.Color = [0 0 1]
EOgroup = h(2); EOgroup.Color = [0 0.8 1]
PKgroup = h(3); PKgroup.Color = [0 .4 .2]
POgroup = h(4); POgroup.Color = [0 .8 .2]
LKgroup = h(6); LKgroup.Color = [.8 0 .6]
LOgroup = h(7); LOgroup.Color = [1 .4 .8]
EOextra = h(5); EOextra.Color = [0 0.8 1]
LOextra = h(8); LOextra.Color = [1 .4 .8]
EKextra = h(9); EKextra.Color = [0 0 1]
set(gca,'fontsize',16);
xlabel('DIC');
ylabel('TA');

採用された回答

Walter Roberson
Walter Roberson 2019 年 3 月 18 日
編集済み: Walter Roberson 2019 年 3 月 18 日
The reason will be obvious if you unique(SiteID)
h = gscatter(DIC, TA, strtrim(SiteID));
  1 件のコメント
Heidi Hirsh
Heidi Hirsh 2019 年 3 月 18 日
Thank you Walter! It turns out that some of the IDs had extra spaces!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeApp Building についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by