Click here to get back home

GD::Graph - how to get rid of leading gap in line graph?

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
GD::Graph - how to get rid of leading gap in line graph? carcassone_fr 10-01-2004
Posted by carcassone_fr on October 1, 2004, 10:56 am
Please log in for more thread options
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.


Similar ThreadsPosted
Graph.0.69 Module---how to get a DAG from graph with cycles January 23, 2006, 2:50 pm
GD::GRAPH two_axes December 8, 2004, 6:01 pm
GD::Graph isn't numeric etc. January 26, 2005, 7:43 pm
GD graph, Several Colors per Bar? May 30, 2005, 6:52 pm
Name for a new Tk Graph module April 4, 2007, 6:17 am
Perl GD::Graph module: bug? August 3, 2004, 8:42 pm
GD::Graph => How to set maximum value manually on Y ? October 6, 2004, 6:35 pm
Do we need Graph::Clique module? November 10, 2004, 2:58 pm
ANNOUNCE: Graph-ReadWrite 2.00 January 2, 2005, 9:17 pm
Creating spokes with SVG::TT::Graph::Pie November 15, 2006, 4:29 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap