home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

Perl CookbookPerl CookbookSearch this book

15.18. Graphing Data

15.18.3. Discussion

The GD::Graph module requires you to have the GD module installed, which itself depends on a C library available from http://www.boutell.com/gd/. Early versions of this library created GIF images, but since the owners of the GIF patent are cracking down, the library now emits PNG and JPEG images:

$png_data = $plot->png;
$jpg_data = $plot->jpeg;

The documentation for GD::Graph lists a large number of options you can fine-tune (colors, fonts, placement), but the most important ones are labels and the image title. There are no axes to label in pie charts, so the x_label and y_label options are not available. By default, pie charts are drawn with a pseudo-3D look, which you can disable by setting the 3d option to a false value.

Recipe 15.23 contains a program that (crudely) extracts the day of the week on which each mail message in a mailbox was sent, and then graphs that data.

15.18.4. See Also

Documentation for the GD and GD::Graph modules; Perl Graphics Programming, by Shawn Wallace (O'Reilly)

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.