Perhaps this will help. (It's from PGgraphmacros.pl description. Slightly cleaned up from that description)
$f1 = FEQ( qq! x^2 - 3*x + 45 for x in [0, 45) using color:red and weight:2!);
Usage: ($fn1, $fn2, $fn3) = plot_functions($graph, $f1, $f2, $f3); Synonym: add_functions($graph,$f1,$f2,$f3);
(This isn't has clear as it should be in the original description since
the outputs there were also labeled $f1, $f2 and $f3. The $f1 output
(now called $fn1) is a function object, while the $f1 input is just a
string.
plot_functions was designed as a front end macro which simplies
constructing function objects. The output of plot_functions is a Fun with the methods described in Fun.pm.
To change the number of points in plotting the function you need the following
statement, after the plot_functions statement, but before the "insertGraph" statement. $fn1->steps(100);
This will set the number of steps used in plotting the function to 100.
You might
also try setting it first to 4 steps so that you can clearly see the
effect of changing the number of steps. Note that despite its name,
plot_functions doesn't actually draw
the graph when it is executed, it translates the string into a function
object capable
of drawing the graph, and returns a reference to the function object.
(It also inserts
this function object into the graph.) The graph is not actually
crteated/drawn until the insertGraph command is executed, so changes
made in the function objects before that command will affect the graph.
Hope this helps.
-- Mike
<| Post or View Comments |>
|