## WeBWorK Problems

### Re: clutter in graphmacros?

by Davide Cervone -
Number of replies: 0
There doesn't seem to be a natural way to do what you are asking. I had thought that the init_graph_no_labels() version would do what you wanted, but it turns out only to remove the label at the origin. The labels on the ends of the axes come from the grid option. Go figure.

You could leave off the grid, but that would make it hard to tell what the coordinates are. But you could generate your own grid, which is just as good. I do that in the example below.

I'm not sure why you are using a different coordinate system for your graph than for your answers. It seems to me that your graph dimensions should be -1 to 11 and then you can enter your points and labels in that coordinate system rather than scaling by hand. I've done that below. It also makes creating the grid trivial, since the lines are at integer values.

Note also that you can combine your labels into a single call to $graph->lb(), and don't need to make variables to hold the label objects; just pass them to$graph->lb() directly. I do this in the example below.

Finally, I have made the points include an actual marker using circle stamps. These are closed circles, but closed_circle() was too big, so I used the underlying Circle object.

Here's my example:

    $graph = init_graph_no_labels(-1,-1,11,11, pixels=>[500,500], axes=>[0,0]);$graph->v_grid('gray',0..10);
$graph->h_grid('gray',0..10);$dx = .075;
$graph->lb( new Label (5+$dx,0,'5','black',('bottom','left')),
new Label (10+$dx,0,'10','black',('bottom','left')), new Label ($dx,5,'5','black',('bottom','left')),
new Label ($dx,10,'10','black',('bottom','left')), new Label ($dx,0,'0','black',('bottom','left')),
);

$dx = .11;$dy = .03;
$graph->lb( new Label(3+$dx,$dy,'A','blue',('bottom','left')), new Label(2+$dx,3+$dy,'B','blue',('bottom','left')), new Label(7+$dx,8+$dy,'C','blue',('bottom','left')), );$graph->stamps(
new Circle(3,0,2.5,'blue','blue'),
new Circle(2,3,2.5,'blue','blue'),
new Circle(7,8,2.5,'blue','blue'),
);

TEXT(image(insertGraph(\$graph),width=>500,height=>500));


it would be possible to use Point objects to do both the point labels and the answer checking (even with the LeadingZero context, I think), rather than checking the individual coordinates by hand, but you may be wanting to do it that way so the students don't have to type parentheses and commas themselves. It depends on what you are testing, I guess.

Davide