# ParametricPlots

## Plotting Parametric Functions: PG Code Snippet

*This code snippet shows the essential PG code to graph parametrically defined functions. Note that these are insertions, not a complete PG file. This code will have to be incorporated into the problem file on which you are working.*

PG problem file | Explanation |
---|---|

loadMacros("PGgraphmacros.pl"); |
As with any dynamically generated graph, we need to include |

$gr = init_graph(-1.5,-1.5,1.5,1.5,axes=>[0,0]); $xfunc = sub { my $t = shift(); return cos($t); }; $yfunc = sub { my $t = shift(); return sin($t); }; $fn = new Fun( $xfunc, $yfunc, $gr ); $fn->domain(0,6.2832); |
To set up the parametric graph, we first define a graph object as for any dynamically generated graph. Then, we specify rules to generate the
Finally, we can set the Note that this does not set up any default axis labels, so you may need to do that by adding labels. |

BEGIN_TEXT \{ image( insertGraph($gr) ) \} END_TEXT |
The graph is then inserted into the problem in the usual manner. |