How to remove horizontal lines as plotting 0-360 degree map
Mostrar comentarios más antiguos
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 comentarios
Chunru
el 6 de Jun. de 2021
If you have mapping toolbox:
f= worldmap('world')
plotm(Coast.lat, Coast.lon)
Thao Linh Tran
el 6 de Jun. de 2021
Respuestas (3)
wentao ma
el 1 de Dic. de 2021
2 votos
coastlon(abs(diff(coastlon))>180+1)=nan;
1 comentario
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 comentarios
Thao Linh Tran
el 6 de Jun. de 2021
KSSV
el 6 de Jun. de 2021
Edited the answer.
Thao Linh Tran
el 6 de Jun. de 2021
KSSV
el 6 de Jun. de 2021
180 is added to X and Y, lon and lat are also changed.
Thao Linh Tran
el 6 de Jun. de 2021
SALAH ALRABEEI
el 6 de Jun. de 2021
0 votos
Make sure to clear the figure before plotting because the coast.mat does not have these lines.
Categorías
Más información sobre Geographic Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

