Change figure size without changing plot size

68 次查看(过去 30 天)
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