フィルターのクリア

How do I create this scatter plot?

1 回表示 (過去 30 日間)
Z
Z 2013 年 7 月 24 日
Hi guys, I have a really big matrix and I am trying to create a scatter plot out of two parameters. However, I want to make t customized based on the value of the number in the 11th column. I want my matrix, X, to have a normal scatter plot (e.g. parameters 1 and 2) and if the value in the 11th column is 1 for the row, it will be a + sign and if that value is zero, it will be plotted as a . sign
Also, the two parameters should already be distinguished by color. Here is a snippet that DOESN'T work:
X = mydata(:,1:10);
X (mydata (:,24) == 200,11) = 1;
hold on
gscatter(X(X(:,11)==1,1),X(X(:,11)==1,2),'b+','Markersize',13)
gscatter(X(X(:,11)==0,1),X(X(:,11)==0,2),'b.','Markersize',13)
gscatter(X(X(:,11)==1,1),X(X(:,11)==1,2),'g+','Markersize',13)
gscatter(X(X(:,11)==0,1),X(X(:,11)==0,2),'g.','Markersize',13)
Thanks!!

採用された回答

dpb
dpb 2013 年 7 月 24 日
gscatter(mydata(:,1),mydata(:,2),ordinal(X(:,11)),'bg','+.');
doc gscatter
Caution--air code but should be close. Order of color and/or symbols may not match desired, etc., ...
  2 件のコメント
Z
Z 2013 年 7 月 24 日
Thanks! So I just realized the colors already distinguished the two. Thanks!
dpb
dpb 2013 年 7 月 24 日
Don't guess I follow the comment -- the ordinal variable should cause the color and markers to change accordingly as given in the vectors--so you should from the above get 'b+' and 'g.' for the two categories.
It's just that the input is expected to be a list of CLR,SYM properties, not mixed.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscrete Data Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by