How to determine the different colour in scatter plot?
1 次查看(过去 30 天)
显示 更早的评论
Ara
2012-12-13
Hi Everybody,
Could you please help me how I can show it with different color? refer to the below code? this code show in one color while I need to determine different satellite by different color.
17 个评论
Walter Roberson
2012-12-13
Why are you bothering to compute y, as you are not using it?
You are placing the circles in the same place each time, just with different sizes.
Ara
2012-12-13
编辑:Walter Roberson
2012-12-13
Ok, thanks. But still the problem is they plot all of the in a same color.
hold on
scatter (longi, lati, s4_0*2500, 'r')
hold on
scatter (longi, lati, s4_0*2500, 'g')
still plot it in a same color. It shows 5 different separated circle plot and the interesting thing is plot the second color. I mean green one as if can noot read the first line.
Azzi Abdelmalek
2012-12-13
编辑:Azzi Abdelmalek
2012-12-13
You are just erasing the previous scatter. What you can do is to scatter the biggest circle then the smallest
Walter Roberson
2012-12-13
You are plotting two circles of the same size at the same location. Only the second one is going to show up.
Ara
2012-12-17
编辑:Ara
2012-12-17
Thank you both, but still was not able to plot it with different color. I have another question, how can I try making plots with different threshold values. Since Walter helped me how to plot a point for each x value to calculated. Then draw a circle around x point. But NOW I want to get ride of small circle and just draw a circle for x data greater than some threshold value. For ex., x >=0.2. Could you please help me how?
Walter Roberson
2012-12-17
idx = s4_0(1,:) >= 0.2;
scatter(longi(idx), lati(idx), s4_0(1,idx)*2500,'r');
Ara
2012-12-17
Thank you, Walter. This code is good but the plot shows the same size for all of the circle while I am sure the column include the range of data between 0.2 to 0.5 and I would like to show it this range by different radius of the circles. As for color plot, I try this code and plot it colourful which is nice but I am not sure is correct so I put it here if it's possible for you to check it please. This code shows different trajectory of satellite in different color but still don't know which color is for which satellite or (prn) since legend also just show one data. I would really appreciate for your help.
scatter(longi, lati, s4_0*2500,prn(:,1));
Ara
2012-12-19
Thank you, but the problem is when I use it both figure are same which means there is no different between min and max. You know, the data are huge so I am just try to get rid of the small circle and just show the biggest (range 0.2, 0.3 and 0.4) one that was why I think to put some threshold and I expected to have a figure with some circle at least 6 circles and of course with different radius that I can show in this figure the different location of the biggest and smallest circles. But the below code just show me the same size and still lots of circles. could you please help me again if its possible?
idx = s4_0(1,:) >= 0.2;
scatter(longi, lati, max (s4_0(1,:))*2500,prn);
figure;scatter (longi, lati, min (s4_0(1,:))*2500,prn);
Walter Roberson
2012-12-19
My previous code
idx = s4_0(1,:) >= 0.2;
scatter(longi(idx), lati(idx), s4_0(1,idx)*2500,'r');
does use different radius of the circle. The s4_0(1,idx)*2500 expression is in the point-size parameter location, and the idx is selecting only those locations with the minimum radius.
But are you sure that the min() and max() are the same value ? Please show
format long g
min(S4_0(1,:))
max(S4_0(1,:))
Ara
2012-12-19
Yes, exactly same value...Do you remembered I upload a figure that shows some circle with different radius and it was about 6 circles. But in my data shows many many circles and when I show the point of each circle they look as if line so I prefer to reduce it and make the figure more clear.
ans =
0.0688228888887992
ans =
0.0688228888887992
Walter Roberson
2012-12-19
If all of your values are the same, then what value should be used to figure out the size of the circle? Or are the values just all the same for each column, but different between the columns? Are all the values in any one column certain to be the same?
Ara
2012-12-19
All the value are just for one column (one day data). Just imagine one column with different values and it might just 5 values (may one 0.2 and two 0.3 and two 0.4) in one column which are important to show.So I want to show by circle to clarify the exact value.I am also wondering cause when I plot it without threshold, it shows me some circles with different sizes so I want to extend it for whole month and I need to reduce extra circle just the significant one is important to me.
Walter Roberson
2012-12-19
I am confused.
Oh wait, row vs column. S4_0(1,:) is a row, not a column. Okay, so are all the values for one row the same, but the values might differ between rows??
Ara
2012-12-19
Sorry to make you confused. I am work just with column not row.I want Matlab read column s4 which I wrote and show different value by circle.
data=xlsread('1615_0.xls');
data_filterr=find(data(:,25)>60);
data_filtered=data(data_filterr,:);
elev_cutof20=find(data_filtered(:,6)>30);
data_cutoff15=data_filtered(elev_cutof20,:);
r=data_cutoff15(:,2);
time=(r./3600)-(24*0);
s4r=data_cutoff15(:,8);
s4cor=data_cutoff15(:,9);
s4=sqrt(s4r.^2-s4cor.^2);
Walter Roberson
2012-12-19
I'm not sure how s4_0 fits into this? Your s4 here would be a single column, but your s4_0 in your previous code was multiple columns.
Presuming that lati and longi are filtered the same way as data_filter, then it looks like you would want
idx = s4 >= 0.2;
scatter(longi(idx), lati(idx), s4(idx)*2500,'r');
Ara
2012-12-19
Thank you. It works. Just please let me ask another question regarding to different color. Assume all are filtered the same way. Each PRN in the column has different value and repeated by time and s4 column relevant to those number. I mean PRN shows number of satellite and I want to determine the circle by color to show come from which number. PRN=data_cutoff15(:,3);
采纳的回答
Walter Roberson
2012-12-19
Are the PRN numbers simple integers such as 1, 2, 3, 4, 5, 6 ?
numsat = max(PRN);
cmap = jet(numsat); %use any handy colormap
idx = s4 >= 0.2;
scatter(longi(idx), lati(idx), s4(idx)*2500, cmap(PRN(idx),:) );
1 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Mapping Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)