Dear Monks,
I want to plot a simple graph and have decided to use DBD::Chart::Graph mainly because of the number of colours available and because you can plot scatter graphs.
I have basically copied code from the cpan web-site for this module but I can't get it to work but I don't get errors either. Can anyone spot the problem?
Thanks!
#!/biol/programs/perl580/bin/perl
use DBD::Chart::Plot;
my $img = DBD::Chart::Plot->new();
my @k = ('1','1','3','5');
my @h = ('0.1','0.5','0.4','0.9');
$img->setPoints(\@k, \@h, 'blue line nopoints');
$img->setOptions (
title => 'My Graph Title',
xAxisLabel => 'my X label',
yAxisLabel => 'my Y label' );
print $img->plot;
open (WR,'>plot3.png') or die ("Failed to write file: $!");
binmode WR; # for DOSish platforms
print WR $img->plot();
close WR;
Formatting repaired by davido
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.