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

조회 수: 12 (최근 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