I don't know how much control you have over the software on the server you have, but you might want to check out Gnuplot , which is a more full featured graphing program. Check out the demo galleries for the different versions.

GD is great, but limited in flexibility; but someone may find a solution for you.

As for myself, I always reach for a Tk canvas to do graphing, on which I can do all sorts of tricks and export it to a graphic file. However, this requires an X server running.... a real drawback on a cgi server.

Here is a way to use Arrays of Arrays to plot multiple data sets with GD

#!/usr/bin/perl use warnings; use strict; use GD; use GD::Graph::lines; my @data = ( [1, 2, 3, 4, 5, 6, 7, 8, 9,], [ 8, 8.25, 8.5, 8.35, 8.76, 8.21, 8.6, 8.8, 8.5], [ 57.4, 57.6, 57.8, 57.9, 57.4, 58.5, 57, 57.87, 58.34] ); my $my_graph = new GD::Graph::lines (600, 400); $my_graph->set( title => "My Graph", transparent => '0', bgclr => 'lgray', boxclr => 'white', fgclr => 'white', title => 'Some simple graph', x_label => 'X axis label', y1_label => 'Y1 axis label', y2_label => 'Y2 axis label', #boxclr => '#C0C0C0', two_axes => 1, ); $my_graph->set_legend("data set 1", "data set 2"); my $gd = $my_graph->plot(\@data) or die $my_graph->error; open(IMG, ">$0.png") or die $!; binmode IMG; print IMG $gd->png; close IMG;

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

In reply to Re: Issues graphing multiple data sets on the same graph in GD::Graph by zentara
in thread Issues graphing multiple data sets on the same graph in GD::Graph by SoaponaRope

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.