How to remove horizontal lines as plotting 0-360 degree map
4 views (last 30 days)
Show older comments
![](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 Comments
Answers (3)
wentao ma
on 1 Dec 2021
coastlon(abs(diff(coastlon))>180+1)=nan;
1 Comment
Cristina Radin
on 2 Feb 2022
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
on 6 Jun 2021
Make sure to clear the figure before plotting because the coast.mat does not have these lines.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!