"How would I plot a line with a slope of one that goes infinitely until it hits the y axis"
I'm interpreting this as a line that extends from point (xClic,yClic) to the point that crosses the vertical line at x=0, with a slope of 1.
If that interpretation is correct, all you need to so is compute the y intercept.
xClic = -2;
yClic= -5;
plot(xClic, yClic,'bo')
xlim([-8 8])
ylim([-8,8])
hold on
b = yClic-1*xClic;
plot([xClic,0],[yClic,b],'b-')
A similar approach is to use refline() but that extends to your axis limits.
h = refline(1,b)
h.LineStyle = ':'
Best Answer