Azzera filtri
Azzera filtri

Change figure size without changing plot size

59 visualizzazioni (ultimi 30 giorni)
Tal Levy
Tal Levy il 7 Set 2022
Risposto: vamshi sai yele il 14 Set 2022
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 Commento
Adam
Adam il 7 Set 2022
Modificato: Adam il 7 Set 2022
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'

Accedi per commentare.

Risposte (1)

vamshi sai yele
vamshi sai yele il 14 Set 2022
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.

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by