MATLAB Answers

how to set graph size

6 388 views (last 30 days)
Soni huu
Soni huu on 28 Feb 2013
Commented: Ravn Michael on 23 Oct 2019
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

Soni huu
Soni huu on 28 Feb 2013
code to set..

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 28 Feb 2013
Edited: MathWorks Support Team on 27 Nov 2018
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])

  5 Comments

Show 2 older comments
Dariush Ashtiani
Dariush Ashtiani on 14 Jul 2018
Thank you Azzi for short and to the point answer
ANKIT KUMAR
ANKIT KUMAR on 12 Oct 2018
How can we decide that we are putting position in cms or any other unit ?
Ravn Michael
Ravn Michael on 23 Oct 2019
I am sorry but it does not work... Do you know an another way?

Sign in to comment.

More Answers (0)

Sign in to answer this question.