How can I change the size of my figure or the title position so that the title does not overlap my figure anymore?

4 views (last 30 days)
A LL
A LL on 2 Nov 2020
Commented: A LL on 3 Nov 2020
Hello,
I am trying to reduce the size of my figure or to upper the position of my title so that the title doesn't overlap the figure.
(Please see attached figure)
But whenever I try to change the figure or the title position nothing changes on my figure, what am I doing wrong??
I tried both % command below both is doesn't change anything on my figure...
figure(3);
hold on;
%figure('Position',[0.1 0.1 0.4 0.4]);
w=worldmap([20 90],[-180 180]);
p=findobj(w,'Tag','Parallel');
m=findobj(w,'Tag','Meridian');
p.LineWidth=1.5;
m.LineWidth=1.5;
pcolorm(latMat,lonMat,a1);
colormap jet;
cb=colorbar;
set(cb, 'Position',[0.75 0.15 0.03 0.78]);
geoshow('landareas.shp','FaceColor',"none",'LineWidth',1);
title('Task 1.7: PC1');
%set(get(gca,'title'),'Position',[1 1 1]);
hold off;
Thanks

Answers (1)

VBBV
VBBV on 3 Nov 2020
Edited: VBBV on 3 Nov 2020
Try this
% if true
% code
% end
T = title('Task...');
set(T,'Position', [1 1 1 1])
  3 Comments
A LL
A LL on 3 Nov 2020
As I said, even if I change the numbers in the brackets, the title is still stuck behind my figure.
Here is the code I am running:
figure(3);
hold on;
%figure('Position',[0.1 0.1 0.4 0.4]);
w=worldmap([20 90],[-180 180]);
p=findobj(w,'Tag','Parallel');
m=findobj(w,'Tag','Meridian');
p.LineWidth=1.5;
m.LineWidth=1.5;
pcolorm(latMat,lonMat,a1);
colormap jet;
cb=colorbar;
set(cb, 'Position',[0.75 0.15 0.03 0.78]);
ylabel(cb,'ylabel');
geoshow('landareas.shp','FaceColor',"none",'LineWidth',1);
T = title('Title');
set(T,'Position', [0.5 -0.1 0]);
%set(get(gca,'title'),'Position',[1 1 1]);
hold off;
And see the attached figure.
I don't understand what is wrong.
Thanks

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by