Property of gscatter information needed

3 ビュー (過去 30 日間)
SatyaPrakash Gupta
SatyaPrakash Gupta 2019 年 11 月 27 日
コメント済み: SatyaPrakash Gupta 2019 年 11 月 28 日
Hi Team,
i am new to matlab and i know about the property of scatter as "XDATA, YDATA , ZDATA etc
question :
  1. could you please do help me out what is the 3rd property of gscatter ?
Regards,
Satya

回答 (2 件)

Luna
Luna 2019 年 11 月 27 日
編集済み: Luna 2019 年 11 月 27 日
Have you read that?
you don't have to mention a 'Name','Value' pair argument inputs for gscatter. It works like that:
gscatter(x,y,g). x and y is a same size vector and g is a grouping vector already.
Here is a demo:
x = rand(10,1);
y = rand(10,1);
g = [ones(5,1); ones(5,1)*2]; % first 5 values group number 1, last 5 values group number 2;
figure;
gscatter(x,y,g)
  10 件のコメント
SatyaPrakash Gupta
SatyaPrakash Gupta 2019 年 11 月 28 日
it did this as well but may be it did not work for me because when i call the axes inside the gscatter function , it throws an error saying the X and Y did not match.
Can you provide some example how you did for axes to update gscatter ?
thank you
Walter Roberson
Walter Roberson 2019 年 11 月 28 日
You said this question came because , i want to gscatter to the existing figure instaed of opening new figure each time.
If you are having an issue where it keeps opening new figure() objects to plot into, then the difficulty is that it is not finding a current figure. (It is possible to end up with no figure in focus even though there are multiple figures.)
However, if the problem is that for reasons such as efficiency, you want to update the graphics created by gscatter() without calling gscatter() again, then if you want to change the grouping, there is no way to do that. There is no gscatter() object that holds the grouping information: gscatter() creates line() objects and puts all of the points that belong to the same group in the same line() object. You would have to manipulate the line object to change the groupings.

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


Image Analyst
Image Analyst 2019 年 11 月 28 日
There is no "Z" or third dimension for gscatter(). It's only x and y, NOT z.
The third input is what "group" the (x,y) points belong to, and that determines what color they get plotted in. For example group 1 appears with red markers and group 2 appears with green markers, or whatever.
If you want color with 3 dimensions (x, y, and z), I suggest you use plot3().
  3 件のコメント
Image Analyst
Image Analyst 2019 年 11 月 28 日
There is a difference, of course. plot3 can have 3 axes (x, y, and z) whereas gscatter can only have x and y as far as I can tell. Also plot3() can connect markers with lines whereas gscatter does only markers.
What is your "z"? Is it your group number? Do you even have groups? If so, what do the groups represent?
Attach the data you want to plot in a .mat file with the paper clip icon along with a screenshot of what you'd like to achieve.
SatyaPrakash Gupta
SatyaPrakash Gupta 2019 年 11 月 28 日
I have resolved it with the help of set(groot,'CurrentFigure',spawning_figure)
as i wanted to gscatter into the same figure.
thank you very very much for your support and quick response.
thank you again

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

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by