
zeppelin girl
New User
Nov 5, 2008, 7:56 AM
Post #1 of 1
(266 views)
|
|
yet again a GD::Graph problem
|
Can't Post
|
|
Hey! i'm trying to run the following code: ------------------------ sub ploty { .... my @arr=@_; my $gradient=($Xsum*$Ysum-($size*$multSum))/(($XSum*$XSum)-($size*$XsquareSum)); my $intercept=(($Xsum*$multSum)-($Ysum*$XSquareSum))/(($Xsum*$Xsum)-($size*($XsquareSum))); my (@Xdata1, @Xdata2, @Ydata1, @Ydata2); push (@Xdata1, 0..38); my @Xdata2=@Xdata1; my @Ydata1; for ($i=0; $i<$size; $i++) { $answer=push (@Ydata1, (($gradient*$i)+$intercept)); } @Ydata2=@arr; my @data=(@Xdata1,@Xdata2, @Ydata2); my $graph=GD::Graph::mixed->new (800, 500); $graph->set( types=> ['lines','points'], x_label => 'Experiment', y_label => 'Fold change', title => 'Pearson Correlation for @ARGV[0]', y_max_value => 10, y_tick_number => 10, y_label_skip => 2, legend_placement => 'RC', long_ticks => 1, marker_size => 6, markers => [ 1, 7, 5 ], transparent => 0, ); $graph->set_legend('one', 'two', 'three', 'four'); my $gd = $graph->plot(\@data) or die $graph->error; open(IMG, '>file.gif') or die $!; binmode IMG; print IMG $gd->gif; close IMG; -------------------------------------------- and get the following msg: Invalid data set: 0 at pearson.pl line 66, <IN> line 22. which is the plot line.... } ------------------------------------------------------- what is wrong with my data? it's supposed to be ok... Thanks again..
|