How to remove horizontal lines as plotting 0-360 degree map
4 ビュー (過去 30 日間)
古いコメントを表示
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/643335/image.png)
Coast=load('Coast.mat');
X=Coast.long;
Y=Coast.lat;
X(X<=0)=X(X<=0)+360;
plot(X,Y);
2 件のコメント
回答 (3 件)
wentao ma
2021 年 12 月 1 日
coastlon(abs(diff(coastlon))>180+1)=nan;
1 件のコメント
Cristina Radin
2022 年 2 月 2 日
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)
SALAH ALRABEEI
2021 年 6 月 6 日
Make sure to clear the figure before plotting because the coast.mat does not have these lines.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!