Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: GD::graph: layout Question.

by zentara (Archbishop)
on Aug 06, 2007 at 12:32 UTC ( [id://630804]=note: print w/replies, xml ) Need Help??


in reply to GD::graph: layout Question.

Help With GD::Graph::lines was just asked a few days ago,

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

Replies are listed 'Best First'.
Re^2: GD::graph: layout Question.
by Excentis_Perl (Initiate) on Aug 06, 2007 at 13:31 UTC
    Thx for the fast reply, it's the same problem indeed, but unanswered for my use, don't wanne use bars for the application.
    I think there's no direct option in the module to do shift the line to the edge...
      Well the last reply in that node DID get the axis to shift to 0.
      #!/usr/bin/perl use warnings; use strict; use GD::Graph::lines; # See: http://perlmonks.org?node_id=629955 use constant PI => 4 * atan2(1,1); print STDERR "Processing sample55\n"; my @x = map {$_ * 3 * PI/100} (0 .. 100); my @y = map sin, @x; my @z = map cos, @x; my @data = (\@x,\@y,\@z); my $my_graph = new GD::Graph::lines(400,400); $my_graph->set( x_label => 'Angle (Radians)', y_label => 'Trig Function Value', x_tick_number => 'auto', y_tick_number => 'auto', title => 'Sine and Cosine', line_width => 1, x_label_position => 1/2, r_margin => 15, transparent => 0, ); $my_graph->set_legend('Thanks to Scott Prahl'); my $gd = $my_graph->plot(\@data); open (IMG, ">$0.png") or die $!; binmode IMG; print IMG $gd->png; close IMG;
      However, I tried to put your data into the exact same script, and it wouldn't go to 0...... I think GD::Graph::lines is buggy about this. I tried mapping your data, tried changing your text axis marks to numeric... (0,1,2,3).... and it still wouldn't shift. Very aggravating.

      I'm not really a human, but I play one on earth. Cogito ergo sum a bum
        Hey, I also need the exactly same thing. so I tried your sample. I think, the sample also doesn't start from 0 (Y axis), just it looks like it due to 100 data. The interval between ticks is a very small, it look like none but actually there is. You can reduce the data by changing from: my @x = map {$_ * 3 * PI/100} (0 .. 100); To: my @x = map {$_ * 3 * PI/100} (0 .. 10); You will see it also has the space before drawing the line. Thanks,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://630804]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-25 18:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found