How to Maximize Figure in MATLAB
In this tutorial, we will discuss how to maximize a figure using the figure()
function in MATLAB.
Maximize a Figure Using the figure()
Function in MATLAB
If you want to maximize a figure, you can use the figure()
function. To maximize a figure, you need to use the units
and outerposition
properties. The units
property sets the figure units, and the outerpostion
property sets the outer position of the figure on the screen. For example, let’s plot a sine wave on a maximized figure. See the code below.
t = 1:0.01:2;
x = sin(2*pi*t);
figure('units','normalized','outerposition',[0 0 1 1])
plot(t,x)
Output:
In the above code, we have plotted a sine wave on a maximized figure. Every plot()
function below a figure()
will plot the data on the same figure. If you want to plot on a new figure, then you have to create it using the figure()
function. You can also give a name to the figure using the Name
property. You can change the position of the figure using the Position
property, and you can change the units of the figure using the Units
property. Check this link for more details about the figure()
function. You can also use the set()
function to maximize your figure anytime in the code. See the code below.
set(gcf,'units','normalized','outerposition',[0 0 1 1])