Adjust my Figure Size
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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);
0 commentaires
Réponses (1)
Sulaymon Eshkabilov
le 27 Nov 2020
You'd need to adjust your figure window (POsition, location and drawable area) sizes, respectively.
Here is the help doc: https://www.mathworks.com/help/matlab/ref/figure.html?searchHighlight=plot%20figure%20size&s_tid=srchtitle#bvjs6el-1
Another nice doc: https://www.mathworks.com/help/matlab/ref/matlab.ui.figure-properties.html#d122e383283
0 commentaires
Voir également
Catégories
En savoir plus sur Graphics Object Programming dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!