how to set graph size

조회 수: 6,845(최근 30일)
Soni huu
Soni huu 2013년 2월 28일
편집: Amirhossein Sadeghi Manesh 2021년 7월 22일
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' );
day_numbermax = max(day_number);
day_numbermin = min(day_number);
grid on;
ylabel('Akumulasi Curah Hujan (mm)')
xlim([day_numbermin day_numbermax])
  댓글 수: 1
Soni huu
Soni huu 2013년 2월 28일
code to set..

댓글을 달려면 로그인하십시오.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 28일
편집: MathWorks Support Team 2021년 3월 16일
Set the ‘Position’ property on the current figure (gcf). Specify the position as a vector of the form “[x0 y0 width height]”, where “x0” and “y0” define the distance from the lower-left corner of the screen to the lower-left corner of the figure. By default, the position is in pixels.
You can specify other units (inches, centimeters, normalized, points, or characters). For example:
You can also save a handle to your figure and set the Position property using dot notation:
f = figure;
f.Position = [10 10 550 400];
  댓글 수: 7
Oséias Farias
Oséias Farias 2021년 7월 4일

댓글을 달려면 로그인하십시오.

추가 답변(1개)

Amirhossein Sadeghi Manesh
Amirhossein Sadeghi Manesh 2021년 7월 22일
편집: Amirhossein Sadeghi Manesh 2021년 7월 22일
Resizing the figure is mentioned at Matlab's documentation.
doc figure
Scroll down to the Change Figure Size section.
If you hadn't assigned a name for your figure, then use gcf (cf in gcf stands for current figure).
And put these two lines before your plot of interest.
If your aim is to just change the width and height of your figure as your question sounds like that, then you don't need to change the first and second entries of position. The first two entries are about the position of the figure window in your screen which you can drag and drop that window and has no effect on the size of the figure (and thus no effect on what you put into your paper/book ^_^).

Community Treasure Hunt

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

Start Hunting!

Translated by