MATLAB Answers

Adjust my Figure Size

1 view (last 30 days)
Tertius Poolman
Tertius Poolman on 27 Nov 2020
I'm plotting a figure and upon wanting to add text and and a textarrow, I realise I would want my actual figure to be displayed smaller on the screen to allow for the title and textarrow to display decently. Refer to the picture and my code below. Please point me in the right direction to adjust my figure size.
figure
hold on;
axis on;
SE505_NodesPlot(n1,'1',0.25,'ok');
SE505_NodesPlot(n2,'2',0.25,'ok');
SE505_NodesPlot(n3, '3', 0.25, 'ok');
SE505_NodesPlot(n4, '4', 0.25, 'ok');
SE505_NodesPlot(n5, '5', 0.25, 'ok');
SE505_NodesPlot(n6, '6', 0.25, 'ok');
SE505_NodesPlot(n7, '7', 0.25, 'ok');
SE505_NodesPlot(n8, '8', 0.25, 'ok');
SE505_NodesPlot(n9, '9', 0.25, 'ok');
SE505_NodesPlot(n10, '10', 0.25, 'ok');
SE505_LinesPlot(n1,n2,'k');
SE505_LinesPlot(n2,n4,'k');
SE505_LinesPlot(n3,n4,'k');
SE505_LinesPlot(n4,n6,'k');
SE505_LinesPlot(n5,n6,'k');
SE505_LinesPlot(n6,n8,'k');
SE505_LinesPlot(n7,n8,'k');
SE505_LinesPlot(n8,n10,'k');
SE505_LinesPlot(n9,n10,'k');
title('Testing')
set(get(gca,'title'),'Position',[8 6 1.00011])
annotation('textarrow' , [0.13 0.13],[1 0.8],'string','Test');
The Nodesplot and Linesplot command are as follows:
function y = SE505_NodesPlot(n,no,disp,sty)
% This function plots a node with coordinates n = [x;y], node number no and
% adds no above and to the right of each node with distance disp.
plot(n(1),n(2),sty,'linewidth',16 );
text(n(1)+disp,n(2)+disp, no, 'fontsize',24);
y = n;
function y = LinesPlot(n1,n2,sty)
x = [n1(1);n2(1)];
y = [n1(2);n2(2)];
plot(x,y, sty,'linewidth', 4);

Answers (1)

Community Treasure Hunt

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

Start Hunting!