Code:
input float (x1 y1 x2 y2) 1 1 3 9 1 1 2 4 1 1 1.5 2.25 1 1 1.2 1.44 1 1 1 1 end * graph function, points, secant lines & tangent line graph twoway /// (scatter y2 x2) /// plot points (function y = x^2, range(0 3) aspectratio(1)) /// function f(x) = x^2 (function y = -3 + 4*x, range (0 3)) /// secant line for (1,1) and (3,9) (function y = -2 + 3*x, range(0 3)) /// secant line (1,1) and (2,4) (function y = -1 + 2*x, range(0 3)) /// tangent line for (1,1) , legend(off)
Array
My question is whether it's possible to truncate the range of the y variable in the functions, such that the resulting graph only display the various lines to the extent that they are above the y axis, so that it's easier to see what's going on. Were I graphing only variables, this would be a simple matter of using appropriate if statements, but so far as I've been able to figure out, this doesn't work for the "function" components of the graph twoway command (though, as shown, the range option allows this for the x axis). I'd very much appreciate any guidance that anyone is able to offer.
Best,
Marcus Britton
0 Response to Truncate Y-axis with twoway function graph
Post a Comment