필터 지우기
필터 지우기

meridian label for geographical map with mercator projection

조회 수: 6 (최근 30일)
Bayes
Bayes 2017년 4월 25일
편집: Bayes 2017년 4월 25일
I was trying to plot sea surface temperature data with lat/lon coordinates on a map with mercator projection. The data is a region between 40S to 40N in latitude and 140E to 20W in longitude. The data named testdata.mat can be downloaded at data file. I would like to set the origin to be 180E in longitude. The question is how I can make the meridian label correctly?. Here are the steps I tried:
Step 1: Here, I setup the projection and ploted the data. I got the following figure named "plot1.png".
figure(5);clf;
% map projection
ax=axesm('MapProjection', 'mercator', 'Frame', 'off');
setm(ax,'meridianlabel', 'on')
setm(ax, 'parallellabel', 'on')
setm(ax, 'Origin', [0 180 0]);
lat_lim = [-40, 40];
lon_lim = [140, -20];
setm(ax, 'MapLatLimit', lat_lim, 'MapLonLimit', lon_lim);
hold on;
scatterm(locs(:,1), locs(:,2), 50, Z+273.15, '.');
Step 2: Here I colored the land to be gray, and adjust the the position of labels. I got the following figure named "plot2.png". As you can see that the labels with longitude less than 0 are all labeled as positive longitude easterward, i.e.,280E, 340E. I would like to label them as 80W, 20W. In addition, I would also like to label "180E" as "180".
load coast
plotm(lat, long, 'k-')
lightgrey = [.8,.8,.8];
patchm(lat,long,lightgrey)
setm(ax,'mlabelparallel',-90) % change the position of lon labels
%setm(ax, 'LabelFormat', 'none');
setm(ax, 'Grid', 'off')
setm(ax, 'LabelRotation', 'on');
setm(ax, 'MLabelLocation', [140, 180, 360-80, 360-20]);
setm(ax, 'PLabelLocation', [-40, 0, 40]);
hc=colorbar('peer', ax, 'East');
set(ax, 'CLim', [270 305]);
set(hc, 'Position', [0.88, 0.348, 0.025, 0.34], 'YAxisLocation','right')
title(ax, 'SST');
axis off

답변 (0개)

카테고리

Help CenterFile Exchange에서 Map Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by