Markers in a stairstep graph


I am trying to set markers for data points in a stairstep graph. What I want to get is similar to what is given in Matlab documentation:

enter image description here

By running this what I get is however:

enter image description here

So also non-data points are marked. Any idea what is wrong?


Answers:


To get the desired plot in old versions, you can add markers after plotting the stairs:

X = linspace(0,4*pi,20);
Y = sin(X);

figure
stairs(X, Y, '--r');
hold on;
plot(X, Y, 'or');
hold off;

enter image description here