MATLAB Answers

Robert
0

How to modify font size in a miller projection map?

Asked by Robert
on 18 Sep 2018
Latest activity Commented on by Robert
on 18 Sep 2018
Hi,
Wondering how to modify the font size of the text for the longitudes in a miller projection map?
Thanks!

  0 Comments

Sign in to comment.

1 Answer

Answer by Walter Roberson
on 18 Sep 2018
Edited by Walter Roberson
on 18 Sep 2018

Example,
NewSize = 7; %default is typically 10
landareas = shaperead('landareas.shp','UseGeoCoords',true);
ax = axesm ('miller', 'Frame', 'on', 'Grid', 'on');
geoshow(landareas,'FaceColor',[1 1 .5],'EdgeColor',[.6 .6 .6]);
mlabel on
set( findobj(ax.Children, 'Tag', 'MLabel'), 'FontSize', NewSize)
Note that this will probably end up shifting the positions of the labels. With the default meridian labels at the top of the graph, the text is generated with VerticalAlignment 'bottom', but with positions just outside the axes. Effectively the text position has been set to have its bottom at the top of the box. If you wanted the text to move further away from the top of the axes box, then the Position properties would need to be changed.

  3 Comments

Thanks for the example. It works for me. This adds the longitudes on top of the map. Sorry two more questions: a) How could I fix the step for longitudes to show (e.g. now is every 30° and would like every 60°), and b) Wondering if you know how to remove the longitude labels (old labels) that are in the center of the world map?
Could you give example code that creates the labels at the center of the world map?
To change to every 60 degrees try
mlabel('MLabelLocation', 60)
Thanks! I found that the labels at the center of the world map were created with a pcolor plot. So I was able to remove those. Thanks!

Sign in to comment.