[Math] Octave Graph Plotting: Axis when x and y = 0

graphing-functionsmath-software

By default, when I plot a graph, the axis seems to be at the lower limit

x=linspace(-10,10,20)
y=4*x+2
plot(x,y)

How can I have the axis when x=0 & y=0, for example below

http://www.regentsprep.org/Regents/math/algtrig/ATP8b/inversegraph.gif

UPDATE

If its not possible to use real "axis", I am thinking of plotting the graphs x=0 & y=0 for the y & x axis respectively, how might I do that?

Then isit possble to show where they intersect? like in format like (x, y) eg. (0, 2)

Best Answer

try this:

set (gca, "xaxislocation", "zero");

set (gca, "yaxislocation", "zero");

It works only for Octave, not Matlab. Would be interesting also to know how do this with matlab.

Related Question