| carcassone_fr@yahoo.com 2004-10-02, 8:57 am |
| Is there a way to get rid of the leading gap to the left of a line
graph? Therefore, I want the graph line to start on the Y-axis, not
the position of the first X tick. Or, make the first X tick be
located on the Y-axis.
Here is a simple example:
#!/usr/local/bin/perl
use strict;
use GD;
use GD::Graph::lines;
my @months = ( "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" );
my @rainfall = ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 );
my @array = (\@months, \@rainfall);
my $graph = new GD::Graph::lines(768, 896);
$graph->set( y_long_ticks => "1", x_tick_offset => "2" );
my $gd_image = $graph->plot( \@array );
open(IMG, ">./test.png") or die $!;
binmode IMG;
print IMG $gd_image->png;
exit 0;
This graph will have a gap between the Y-axis and the first X tick
"Jan".
Thanks in advance for your help.
|