Inverting the y-axis is a bit of a fudge, but this appears to fulfill your reqs:

#!/usr/bin/perl use strict; use warnings; # running-times 15-05-05 # # Graphing all my running times. # I will just insert the data # directly into this program for now, # but when it becomes too much, Ill # move it into another file/dbm use GD::Graph::linespoints; use Getopt::Std; my %times; # running times my $chart; # the GD::Graph::linespoints object my $plot; # the GD object containing the actual graph my @DAYS = qw(Mon Tue Wed Thu Fri Sat Sun); # process options my %Opt; getopts('ho:', \%Opt); if ($Opt{h} or !$Opt{o}) { die "Usage:\n\t$0 -o outfile.png \n"; } # Running times %times = ( "Mon" => "25.40", "Tue" => "24.20", "Wed" => "22.50", "Thu" => "23.30", "Fri" => "21.10", "Sat" => "24.30", "Sun" => "25.19", ); # build graph $chart = GD::Graph::linespoints->new( 480, 320, 1); $chart->set( x_label => "Day", y_label => "Time (mins)", y_min_value => -26, y_max_value => -20, markers => [ 4 ], show_values => 1, y_number_format => sub{ return abs $_[ 0 ] }, values_format => sub{ return abs $_[ 0 ] }, title => "Running Times for 5km - W/E May 15th 2005" ); $plot = $chart->plot( [ [ @DAYS ], [ map{ -$_ } @times{@DAYS} ], ] ); # save it open(F, "> $Opt{o}") or die "Can't open $Opt{o} for writing: $!\n"; print F $plot->png; close F; # Create html page with png in it open H, ">times.html" or die "Can not create webpage: $!\n"; use CGI; my $query = CGI->new( ); print H $query->start_html(-title=>'Gavins Weekly Running Times'); print H $query->p("Here are your times:"); print H "<table><tr><td><img src=$Opt{o}></a></td></tr></table>"; print H $query->end_html( ); close H;

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

In reply to Re: GD::Graph::linespoints - Various questions by BrowserUk
in thread GD::Graph::linespoints - Various questions by ghenry

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.