How to change the font size of a map axes (created using the Mapping toolbox) keeping the whole plot within the figure?

17 次查看(过去 30 天)
Greetings,
I am trying to create a map for a publication and I would like to (easily) change the FontSize of my map axes and still have the axes printed inside the figure.
I am using the following code:
latLim = [-53.7 -52];
lonLim = [-41 -39.2];
figure
h = worldmap(latLim, lonLim);
setm(gca, 'FontSize', 20);
This code yields to this figure:
As you might notice, the longitudes are cropped.
PS: I want to keep the following:
get(gcf, 'position')
ans =
560 528 560 420
How can I make sure the map will be plotted in a correct manner inside this figure?

采纳的回答

Ameer Hamza
Ameer Hamza 2020-6-15
Try to reduce the axes size
latLim = [-53.7 -52];
lonLim = [-41 -39.2];
figure
h = worldmap(latLim, lonLim);
setm(gca, 'FontSize', 14);
h.Position(4) = h.Position(4)-0.1;
  3 个评论
Ameer Hamza
Ameer Hamza 2020-6-15
Overall, I find Matlab graphics function to be convenient, however, I never used worldmap() before. I agree that the way worldmap is created, is a real mess. I don't think there is an easy way to rotate the labels. Following shows a workaround, but making any adjustment to the position of labels is quite difficult.
latLim = [-53.7 -52];
lonLim = [-41 -39.2];
figure
h = worldmap(latLim, lonLim);
setm(gca, 'FontSize', 14);
h.Position(4) = h.Position(4)-0.1;
lbls = findobj(h, 'Tag', 'PLabel');
[lbls.HorizontalAlignment] = deal('center');
[lbls.Rotation] = deal(-90);
for i=1:numel(lbls)
lbls(i).Position = lbls(i).Position - 15000;
end

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by