Colour coding based on the number of data points in each grid?
이전 댓글 표시
Hi everyone,
I have created a grid map and place data points in different bins based on its x, y co-ordinates. I want to allot a red color for bins with less than 100 data points and blue color for bins with more than 100 data points.
May someone suggets me how can, I fix this.
Here is my script (if someone need data please let me know)
Thank you!
x = -130.05:0.01:-129.95;
y = 45.90:0.01:46.00;
n = length(x ) ;
m = length(y ) ;
[X,Y] = meshgrid(x,y ) ;
x = axil_long ; y = axil_lat ; z = time_axil(:,1) ;
plot(X,Y,'r',X',Y','r ')
hold on
for i = 1:m-1
for j = 1:n-1
P = [X(i,j) Y(i,j ) ;
X(i,j+1) Y(i,j+1 ) ;
X(i+1,j+1) Y(i+1,j+1 ) ;
X(i+1,j) Y(i+1,j )] ;
idx = inpolygon(x,y,P(:,1),P(:,2 )) ;
iwant = [ z(idx )] ;
plot(x(idx),y(idx ),'.', color='blue') % this line is tricky, may be we need some changes here
zStore{i,j} = z(idx);
end
end
axis([-130.05 -129.95 45.90 46.00])
Here, is my grid map.

채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Axis Labels에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
