Thanks.
This piece of code at your referred site was able to place the start of the plot at the origin but I am not sure how they did it.
use strict;
use GD::Graph::lines;
require 'save.pl';
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();
$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_graph->plot(\@data);
save_chart($my_graph, 'sample55');
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.