필터 지우기
필터 지우기

Change figure size without changing plot size

조회 수: 59 (최근 30일)
Tal Levy
Tal Levy 2022년 9월 7일
답변: vamshi sai yele 2022년 9월 14일
Hello,
How can i change the size of a figure without changing the inside plot?
I want to create a large figure window with a small plot at a specific position (to make room for a slider for exmple)
Thanks
  댓글 수: 1
Adam
Adam 2022년 9월 7일
편집: Adam 2022년 9월 7일
If you mean you want to change the size of an existing figure without changing the size of a plot that is a little more complicated (but still involves the same idea as below, explicitly setting the axes properties).
But if you just want to create one then create the figure of whatever size you want, using the 'Position' property in the call to figure. Then do the same with the axes function, also using 'Position' (and also 'Parent') e.g.
hFig = figure( 'Position',... )
hAxes = axes( hFig, 'Position',... )
Depending if you want the axes to be fixed size or relative to the figure you can also change the 'Units' property of the axes between e.g. 'pixels' and 'normalized'

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

답변 (1개)

vamshi sai yele
vamshi sai yele 2022년 9월 14일
Hi Tal,
As per my understanding you want to change the size of the figure without changing the inside plot.
I have tried to reproduce it from my end the solution attached bellow
x5=0:0.1:10;
x1 = x5*2
y1 = cos(x5)
x2 = x5*3
y2 = sin(x5)
a= figure;
b= axes(a,"Units","pixels","Position",[30 30 200 200])
plot(x5,y1)
Here, in this code, the dimensions of the inner plot is mentioned in [left bottom width height] fashion.
For better understanding, kindly refer to this link. Hope, you find it helpful.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by