%% Create Graph in New Figure Window
% This example shows how to create a graph in a new figure window, instead of plotting into the current figure.
% Define x and y.

x = linspace(0,2*pi,25);
y = sin(x);

%
% Create a stairstep plot of y versus x. Open a new figure window using the figure command. If you do not open a new figure window, then by default, MATLAB® clears existing graphs and plots into the current figure.

figure % new figure window
stairs(x,y)

% Copyright 2015 The MathWorks, Inc.