MATLAB: Semilogy plot does not have a continuous line going through zero values

log log plotsemilog

Hi I have the following data
x = 1:24 y = [0 0 0 0 2 6 11 15 22 25 27 27 25 20 14 9 4 1 0 0 0 0 0 0]'
I want to use the semilogy plot to only have a log plot on the y axis. However, the line going through the data disappears when y=0. Is there a way to avoid this and show the line going through zero.
thank you

Best Answer

What should appear for the zero? A logarithmic scale has no suitable value for a zero. Try this:
x = 1:24;
y = [0 0 0 0 2 6 11 15 22 25 27 27 25 20 14 9 4 1 0 0 0 0 0 0];
figure;
semilogy(x, y);
figure;
semilogy(x, max(eps, y));
In the second figure, the EPS values appear as 2e-16 (of course). To get a real zero, the scale must be infinitely large.
Related Question