MATLAB Answers

0

how to set graph size

Asked by Soni huu on 28 Feb 2013
Latest activity Edited by MathWorks Support Team on 27 Nov 2018
how to set my graphic size to (w:h=550:400) now my graph size is 560:420 (automatic)
[ day_number, daily_rain ] = DailyRain( RainData, 2010, 1);
andemande = plot( day_number, daily_rain,'-ok' );
set(andemande,'LineWidth',1);
day_numbermax = max(day_number);
day_numbermin = min(day_number);
datetick('x','dd-mmm','keepticks')
grid on;
ylabel('Akumulasi Curah Hujan (mm)')
xlabel('Hari')
xlim([day_numbermin day_numbermax])

  1 Comment

code to set..

Sign in to comment.

1 Answer

Answer by Azzi Abdelmalek
on 28 Feb 2013
Edited by MathWorks Support Team on 27 Nov 2018
 Accepted Answer

Set the ‘Position’ property on the current figure (gcf). By default, the position is in pixels.
x0=10;
y0=10;
width=550;
height=400
set(gcf,'position',[x0,y0,width,height])
You can specify other units (inches, centimeters, normalized, points, or characters). For example:
set(gcf,'units','points','position',[x0,y0,width,height])

  4 Comments

Show 1 older comment
Thank you Azzi for short and to the point answer
How can we decide that we are putting position in cms or any other unit ?

Sign in to comment.