How to remove horizontal lines as plotting 0-360 degree map
이전 댓글 표시
Hi, I am using following codes to plot a 0-360 degree map, can anyone please help to show me how to remove the horizontal lines on the map created. Athough plot(X,Y,'.') does not show those lines, I wanted to plot the coastlines instead of points. Thanks in advance!Coast=load('Coast.mat');
X=Coast.long;
Y=Coast.lat;
X(X<=0)=X(X<=0)+360;
plot(X,Y);
댓글 수: 2
Chunru
2021년 6월 6일
If you have mapping toolbox:
f= worldmap('world')
plotm(Coast.lat, Coast.lon)
Thao Linh Tran
2021년 6월 6일
답변 (3개)
wentao ma
2021년 12월 1일
2 개 추천
coastlon(abs(diff(coastlon))>180+1)=nan;
댓글 수: 1
Hi! You are right, thank you!
The complete code:
load coastlines
coastlonWrapped = wrapTo360(coastlon);
index=abs(diff(coastlonWrapped))>180+1;
pos=find(index==1) %to be sure
coastlonWrapped(pos)=NaN;
plot(coastlonWrapped,coastlat)
Coast=load('Coast.mat');
X=Coast.long;
Y=Coast.lat;
% X(X<=0)=X(X<=0)+360;
X = X+180 ; Y = Y+180 ;
plot(X,Y);
댓글 수: 5
Thao Linh Tran
2021년 6월 6일
KSSV
2021년 6월 6일
Edited the answer.
Thao Linh Tran
2021년 6월 6일
KSSV
2021년 6월 6일
180 is added to X and Y, lon and lat are also changed.
Thao Linh Tran
2021년 6월 6일
SALAH ALRABEEI
2021년 6월 6일
0 개 추천
Make sure to clear the figure before plotting because the coast.mat does not have these lines.
카테고리
도움말 센터 및 File Exchange에서 Map Display에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

