I am plotting some discrete values with a stem plot in MATLAB. I found that if the value is zero, the stem plot will put a circle on the x axis to show the zeros. Is there a way to have a stem NOT showing the circles if the value is zero?
Y = [1;2;3;0;3;2;4;0;1];
Y(Y == 0) = NaN;
stem(Y);
The 4th and 8th index will still exist on the x-axis, but if the observation is set to NaN, no line or circle will be plotted.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more