Here is a simple example. The domain and codomain are often computed
in terms of your (variable) function, so I have left them as the
variables $xmin, $xmax, $ymin, $ymax. The axes
option puts the axes in the usual place; the grid option
indicates there will be 12 vertical grid lines and 20 horizontal ones.
These too can be given by variables. When graphs are displayed they
are usually displayed as a
thumbnail image (though
this can be changed with the height and width
options. In general, this seems to work well since you often have
four graphs on a line. On the other hand, the thumbnail often does
not display enough detail for a student to be able to answer the
question, so for each thumbnail there is the original image which will
pop up when you click on the thumbnail. Actually, a new browser
window opens (often right on top of your existing one), with only the
enlarged image displayed. The default size of this enlargement is
pixels; I have selected a somewhat larger image
specifying
via the pixels option.
# Set the domain of f $xmin = -6; $xmax = 6; ## Set the visible range $ymin = -20; $ymax = 20; $graph_object = init_graph($xmin, $ymin, $xmax, $ymax, 'axes' => [0,0], 'grid' => [12,20], 'pixels' => [300,300] );