WeBWorK Problems

clutter in graphmacros?

clutter in graphmacros?

by Kenneth Appel -
Number of replies: 1
I have been reviewing the results of some 7th grade problems and discovered that
extra information seems to cause many students to avoid trying problems. I am
afraid that I may have copped out in trying to keep the graph clean by just blaming
the system.

What should I have done to avoid showing the many numbers in black that seem to insert
information provided in the initgraph instruction.
Ken Appel

# "MathObjects.pl",
# "compoundProblem.pl",
$showPartialCorrectAnswers = 1;
$graph = init_graph(-.3,-.3,6.7,6.7,pixels=>[700,700],axes=>[.279,.279],grid=>[12,12]);

# the size is 700 by 700 pixels (200 by 200 is default)
# .72 is one unit on the graph
my $im = $graph->im;
# $graph->moveTo(0,0);
# $graph->lineTo(2,0,'black');
$new_label1= new Label (3.14,.162,'5','red',('bottom','left'));
$graph -> lb($new_label1);
$label2= new Label (6,.162,'10','red',('bottom','left'));
$graph -> lb($label2);
$label3= new Label (.19,3.14,'5','red',('bottom','left'));
$graph -> lb($label3);
$label4= new Label (.15,6.07,'10','red',('bottom','left'));
$graph -> lb($label4);
$label5= new Label (.19,.166,'0','red',('bottom','left'));
$graph -> lb($label5);
$label6= new Label (1.45,1.97,'B','blue',('bottom','left'));
$graph -> lb($label6);
$label7= new Label (2.03,.2,'A','blue',('bottom','left'));
$graph -> lb($label7);
$label8= new Label (4.33,4.9,'C','blue',('bottom','left'));
$graph -> lb($label8);



A flaw in the graphing software puts some small black numbers to the below
and to the left of the axes. For this reason, all numbers on the graph
related to problems will be in colors other than black and the black numbers
should be ignored.
The coordinates of the point labelled A are (\{ans_rule(1)\},\{ans_rule(1)\}).
The coordinates of the point labelled B are (\{ans_rule(1)\},\{ans_rule(1)\}).
The coordinates of the point labelled C are (\{ans_rule(1)\},\{ans_rule(1)\}).



In reply to Kenneth Appel

Re: clutter in graphmacros?

by Davide Cervone -
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]);

    $dx = .075;
      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;
      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')),
      new Circle(3,0,2.5,'blue','blue'),
      new Circle(2,3,2.5,'blue','blue'),
      new Circle(7,8,2.5,'blue','blue'),


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.