naqvia
09-18-2007, 06:38 PM
I am trying to impose to line graphs together that share the same Y-values. I have three arrays and I am making the array to plot like this:
my @values_to_plot = [[@position],[@rep],[@nrep]];
And here is my create gaph object decl. and initialization:
sub create_graph{
my $graph = new GD::Graph::mixed();
$graph->set(
x_label => 'Chr. Positions',
y_label => 'Num. Repeats',
title => 'Chr'.$chr.' Repeats',
bgclr =>'white',
types => [qw(lines lines)],
dclrs => ['green', 'blue'],
transparent =>'0',
x_label_skip=> 100000,
y_label_skip=> 10,
y_tick_number=>10,
) or die $graph->error;
return $graph;
}
However, when the final graph is displayed... it comes out funny with the same graph (x-values) on top of graph and then the same thing on bottom. I plot like this:my $gd = $graph->plot(@plotting_values) or die $graph->error;
## create a png of the graph
open(IMG, ">chr".$chr."_repeats.png") or die $!;
binmode IMG;
print IMG $gd->png;
close IMG;
Why isnt this working?
my @values_to_plot = [[@position],[@rep],[@nrep]];
And here is my create gaph object decl. and initialization:
sub create_graph{
my $graph = new GD::Graph::mixed();
$graph->set(
x_label => 'Chr. Positions',
y_label => 'Num. Repeats',
title => 'Chr'.$chr.' Repeats',
bgclr =>'white',
types => [qw(lines lines)],
dclrs => ['green', 'blue'],
transparent =>'0',
x_label_skip=> 100000,
y_label_skip=> 10,
y_tick_number=>10,
) or die $graph->error;
return $graph;
}
However, when the final graph is displayed... it comes out funny with the same graph (x-values) on top of graph and then the same thing on bottom. I plot like this:my $gd = $graph->plot(@plotting_values) or die $graph->error;
## create a png of the graph
open(IMG, ">chr".$chr."_repeats.png") or die $!;
binmode IMG;
print IMG $gd->png;
close IMG;
Why isnt this working?