## WeBWorK Main Forum

### Filled Disks

by Andrew Dabrowski -
Number of replies: 3
What's the best way to make a filled disk in a graph? I haven't seen any documentation on shading regions, just on plotting curves.

For that matter, what's the best way to draw a circle? I've been using the kludge

 my $funstr = "sqrt($r^2 - (x - $x)^2) for x in [$a,$b]";  my @circles = ("$y + " . $funstr,"$y - " . $funstr);  add_functions($pic,@circles);

but that's kind of ugly. In fact the sqrt function doesn't play nice with graphs, as it sometimes returns values near 0 in scientific notation which it seems the graphing utilities can't understand.

### Re: Filled Disks

by Paul Pearson -
Hi Andrew,

Webwork, which uses GD to generate dynamic graphs, does have a "paint bucket" utility.  The graphing category on the Subject Area Templates wiki

http://webwork.maa.org/wiki/Category:Subject_Area_Templates

has several examples

http://webwork.maa.org/wiki/PolarGraph1
http://webwork.maa.org/wiki/ContourPlot1

and the Index of Problem Coding Techniques

http://webwork.maa.org/wiki/Problem_Techniques

has some (perhaps slightly different and slightly older) examples

http://webwork.maa.org/wiki/DynamicImages3
http://webwork.maa.org/wiki/ContourPlots

The things I use most when writing webwork problems are usually found on the Subject Area Templates page, the Problem Techniques page, and in Davide Cervone's documentation.  Usually, google does a good job of finding what you want (e.g., google "webwork filled graph").

Best regards,

Paul Pearson

### Re: Filled Disks

by Andrew Dabrowski -