hello,
I have data like this.
file1 date1 1 76.09
date10 10 87.09
date11 11 89.89
date2 2 66.5
date3 3 78.89
date4 4 87.98
date5 5 57
date6 6 57.98
date7 7 34.32
date8 8 45.76
date9 9 34.99
file2 date1 1 82.45
date2 2 86.23
file3 date1 1 65.76
date10 10 34.89
date11 11 23.79
date12 12 86.23
date2 2 23.78
date3 3 45.78
date4 4 34.78
date5 5 67.89
date6 6 34.78
date7 7 78.45
date8 8 67.89
date9 9 86.23
I am storing the column 3 and column 4 values in array.
@x = [1,10,11,12,13,2,3,4,5,6,7,8,9]
and corresponding column 4 values in array @y
Now I plot the graph as folllows:
my @data = ([@x], [@y]);
my $mygraph = GD::Graph::lines->new(500, 300);
$mygraph->set(
x_label => 'X axis',
y_label => 'Y axis',
title => "stats",
) or warn $mygraph->error;
my $myimage = $mygraph->plot(\@data) or die $mygraph->error;
My problem is...
In the graph the X-axis has values displayed as 1,10,11,12,13,2,3,4,5,6,7,8,9 and corresponding y values plotted. I cannot hard code the x -axis values as I extract these data from a file into these arrays. How do I make sure that X-axis has values 1,2,3,4,5,6,7,8,9,10,11,12,13 and has corresponding y values plotted.
Also I have abother file which has data like:
file1 date1 1 1
date10 10 2
date11 11 2
date2 2 2
date3 3 3
date4 4 3
date5 5 3
date6 6 4
date7 7 4
date8 8 4
date9 9 4
file2 date1 1 3
date2 2 2
file3 date1 1 2
date10 10 3
date11 11 3
date12 12 3
date2 2 3
date3 3 1
date4 4 2
date5 5 5
date6 6 1
date7 7 1
date8 8 2
date9 9 2
I can plot graohs for datasets in both of these files separately. But what I want to do is, I want to show a single graph with column 3 and column 4 of first file plotted along with the column 3 and column 4 of 2nd file plotted in single graph.
Can somebody please help me with these two issues.
Thank you.