help for scaleruler, northarrow

조회 수: 3 (최근 30일)
ELISABETTA BILLOTTA
ELISABETTA BILLOTTA 2023년 7월 2일
답변: Arun 2023년 11월 10일
within a map with these coordinates
longrd=0:0.1:40;
latgrd=30:0.1:55;
I have to make this changes:
1) introduce the kilometric scale in the image
2) introduce north into the image
3) remove the values on the axes
4) insert the title inside the image and not above it.
I keep getting a bunch of errors like this:
Error using assert
Not an axesm-based map.
Error in gcm (line 26)
assert(isstruct(mstruct), ...
Error in northarrow (line 41)
gcm(hndl);
Anyone can help me?
  댓글 수: 1
ProblemSolver
ProblemSolver 2023년 7월 13일
@ELISABETTA BILLOTTA -- Could you show your work, and provide a sample image on which you want these variables.

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

답변 (1개)

Arun
Arun 2023년 11월 10일
Hey Elisabetta,
I understand that you are facing difficulty in producing a map for some given latitude/longitude range values with kilometric scale, north introduction, title inside the map and without axes values.
Here is a sample code and some references which might be of help:
% Load a map
latlim = [0 40];
lonlim = [30 55];
load coastlines;
axesm('MapProjection','mercator', 'MapLatLimit',latlim,'MapLonLimit',lonlim)
%use this if you want values on the
%worldmap(latlim,lonlim)
% Plot the map ( in accordance with the point number 3)
geoshow(coastlat, coastlon, 'Color', 'blue') % plot the map
% 1. Introduce the Kilometric scale
gs1 = scaleruler;
setm(gs1,"MajorTick",0:500:1000);
% 2.Add Direction arrow
northarrow('latitude', 38, 'longitude', 32);
% 4.Add Title On the Map
textm(40, 37, ' Image Title', 'VerticalAlignment', 'top'); %latitude, longitute values
MATLAB help resources:
I hope this helps.

Community Treasure Hunt

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

Start Hunting!

Translated by