how to plot multiple geoscatter plots together

Hello, I'm trying to plot two sets of scatter points with geoscatter, but the second set just overrides the first. I've tried using geoaxes, but it doesn't work. Does anyone know how to solve this problem?
% Plot map
figure('color','w')
geoscatter(stlatNew,stlonNew,20,'^')
geoaxes('NextPlot','add');
geoscatter(evlat,evlon,20,'o')

 채택된 답변

Payas Bahade
Payas Bahade 2020년 5월 26일

0 개 추천

Hi Jing,
You can use ‘hold on’ after plotting the initial sets of scatter points with ‘geoscatter’ to add next set of points to existing plotted points. Below mentioned code illustrates use of ‘hold on’ :
%Set up latitude and longitude data.
lon = (-170:10:170);
lat1 = 50 * cosd(3*lon);
lat2 = 20 * cosd(3*lon);
%Define data that controls the area of each marker.
A = 101 + 100*(sind(2*lon));
%Define data to control the color of each marker.
C = cosd(4*lon);
%Plotting first set of points
geoscatter(lat1,lon,A,C,'^')
%Using hold to retain plotted points
hold on
%Plotting second set of points
geoscatter(lat2,lon,A,C,'o')
Kindly refer this documentation link to know more details on using ‘hold’ command.
Hope this helps!

댓글 수: 2

Ah okay, for some reason putting the hold on before the first geoscatter generates an error so I thought 'hold on' doesn't work for geoscatter. Thanks!
Caglar Temiz
Caglar Temiz 2021년 6월 6일
편집: Caglar Temiz 2021년 6월 6일
Does the 'hold on' comment work only the same longitude (or latitude)?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Geographic Plots에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2020년 5월 23일

편집:

2021년 6월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by