MATLAB: How to draw a line from the variable y-axis

axisplot

Hi
I am making a 2D plot. The x-axis is located at y = 0, but I do not know the position of the y-axis, it depends on the results. Is there a way to find the x position of the y-axis? (I do not want a fixed location of the y-axis, as it should depend on the results.)
Regards

Best Answer

You can use xlim() and ylim() to determine the limits of the axes that MATLAB used and drew on your graph
xLimits = xlim();
yLimits = ylim();