How to design the stairs plot in MATLAB?

 

Syntax:

stairs(x,y)
stairs(x,y,'colourmarkerlinspec')

MATLAB Code:

Here, I am writing the MATLAB code of stairs plot with the black (k) color function.

x=[0 1 2 4 5 7 8];
y=[1 3 4 6 8 12 13];
stairs(x,y,'k')
title('Stairs Plot')
xlabel('X axis')
ylabel('Y axis')

Output in MATLAB:

Stairs plot is shown in the below diagram. You can design as per your MATLAB code.

It more looks like stairs. Isn’t it?