I'm struggling to plot data over dateline when centred on the North Pacific using geoscatter.

조회 수: 15 (최근 30일)
Below is some example data and code. I am wanting to use geoscatter to plot the data across the North Pacific, however it cuts off the data at the dateline (180W Figure 2) due to the way the figure is centered. Geobubble does not cut the data off in the same way and centers the plot around the data (the North Pacific see figure 1). How can I achieve this same behaviour seen in Geobubble (figure 1) in Geoscatter (figure 2)? Thanks for any help!
load example.mat
latlim = [30 75];
lonlim = [130 -115];
centre_lat=54.412;
centre_lon=-173.603;
figure
geobubble(tow_data(:,1),tow_data(:,2),tow_data(:,3));%HOW COME GEOBUBBLE ZOOMS IN BEAUTIFULLY??? Figure 1:
figure
geoscatter(tow_data(:,1),tow_data(:,2),50,tow_data(:,3),'filled');%GEOSCATTER doesn't do well going over -180 line : (
geolimits(latlim,lonlim);
colorbar %Figure 2:

채택된 답변

Kevin Holly
Kevin Holly 2023년 6월 7일
편집: Kevin Holly 2023년 6월 7일
load example.mat
As you can see below, the data points are far apart.
figure
geoscatter(tow_data(:,1),tow_data(:,2),50,tow_data(:,3),'filled');
I added 360 degrees to all the datapoints that were negative.
figure
tow_data(tow_data(:,2)<0,2)=tow_data(tow_data(:,2)<0,2)+360;
geoscatter(tow_data(:,1),tow_data(:,2),50,tow_data(:,3),'filled');
colorbar
Alternatively, you could subtract 360 degrees from all of the longitudinal coordinates greater than zero.
figure
tow_data(tow_data(:,2)>0,2)=tow_data(tow_data(:,2)>0,2)-360;
geoscatter(tow_data(:,1),tow_data(:,2),50,tow_data(:,3),'filled');
colorbar
  댓글 수: 1
Clare Ostle
Clare Ostle 2023년 6월 8일
Thank you that is a useful workaround and helpful. I am still curious that the behaviour of geobubble seems to re-organise the data in the way that you have suggested, whereas geoscatter does not. Do you know why this might be?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by