help for scaleruler, northarrow

3 次查看(过去 30 天)
ELISABETTA BILLOTTA
回答: 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