How to remove horizontal lines as plotting 0-360 degree map

4 vues (au cours des 30 derniers jours)
Thao Linh Tran
Thao Linh Tran le 6 Juin 2021
Commenté : Cristina Radin le 2 Fév 2022
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 commentaires
Chunru
Chunru le 6 Juin 2021
If you have mapping toolbox:
f= worldmap('world')
plotm(Coast.lat, Coast.lon)
Thao Linh Tran
Thao Linh Tran le 6 Juin 2021
Thank you but I wanted to use plot instead of plotm.

Connectez-vous pour commenter.

Réponses (3)

wentao ma
wentao ma le 1 Déc 2021
coastlon(abs(diff(coastlon))>180+1)=nan;
  1 commentaire
Cristina Radin
Cristina Radin le 2 Fév 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
pos = 9×1
371 4311 4420 4991 4994 4998 5076 8063 8077
coastlonWrapped(pos)=NaN;
plot(coastlonWrapped,coastlat)

Connectez-vous pour commenter.


KSSV
KSSV le 6 Juin 2021
Modifié(e) : KSSV le 6 Juin 2021
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 commentaires
KSSV
KSSV le 6 Juin 2021
180 is added to X and Y, lon and lat are also changed.
Thao Linh Tran
Thao Linh Tran le 6 Juin 2021
But the Western North Pacific is splitted into two parts by that way.

Connectez-vous pour commenter.


SALAH ALRABEEI
SALAH ALRABEEI le 6 Juin 2021
Make sure to clear the figure before plotting because the coast.mat does not have these lines.
  2 commentaires
Thao Linh Tran
Thao Linh Tran le 6 Juin 2021
Thanks, but the purpose is to not split the Western North Pacific into two parts as in your fig.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Geographic Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by