Filter löschen
Filter löschen

map mlabels and plabels with azimuth

12 Ansichten (letzte 30 Tage)
Anders_O
Anders_O am 1 Dez. 2022
Beantwortet: Naren am 23 Mai 2023
I am having problems creating mlabels and plabels along the frame of axesm() when using the 'Origin' with azimuth different from zero.
I am able to place labels inside the frame along the meridian and parallel using plabelmeridian and mlabelparallel, but I can't figure out how to get the labels outside the frame. Is there a trick to this?
Here is my code:
midLat=60;
midLon=15;
bufLon = [-6 6];
bufLat= [-6 6];
midAz=-15;
figure(1)
axesm('mercator',...
'Origin',[midLat midLon midAz],...
'FLonLimit',bufLon,....
'FLatLimit',bufLat,...
'grid', 'on',...
'frame', 'on',...
'meridianlabel', 'on',...
'parallellabel', 'on',...
'plinelocation',5,...
'plabellocation',5,...
'mlinelocation',5,...
'mlabellocation',5,...
'labelrotation','on')

Antworten (1)

Naren
Naren am 23 Mai 2023
Hello Andres,
I understand you are trying to get the labels outside the frame, the meridians and parallels are not always exactly aligned with the boundaries of the map when the 'Origin' feature is used with an azimuth value other than zero, hence unless otherwise provided, the text labels will be put inside the frame along the edges.
Use the 'MLabelParallel' and 'PLabelMeridian' properties to place the text labels outside the frame. The 'MLabelParallel' and 'PLabelMeridian' parameters specify the latitude and longitude, respectively, for putting the parallel and meridian text labels outside the frame.
Here is a sample code for better understanding:
midLat = 60;
midLon = 15;
bufLon = [-6 6];
bufLat = [-6 6];
midAz = -15;
figure(1)
axesm('mercator',...
'Origin',[midLat midLon midAz],...
'FLonLimit',bufLon,....
'FLatLimit',bufLat,...
'grid', 'on',...
'frame', 'on',...
'meridianlabel', 'on',...
'parallellabel', 'on',...
'plinelocation',5,...
'plabellocation',5,...
'mlinelocation',5,...
'mlabellocation',5,...
'labelrotation','on',...
'MLabelParallel', 61,...
'PLabelMeridian', 16);
ml = getm(gca,'mlabellocation');
setm(gca,'mlabelparallel',61,'mlabellocation',ml)
This example code positions the meridian text labels outside the frame along the 15th longitude meridian and the parallel text labels outside the frame along the 60th latitude parallel.
Hope this resolves your issue.

Community Treasure Hunt

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

Start Hunting!

Translated by