Note that there are some explanatory texts on larger screens.

plurals
  1. POperl plotting using GD:Graph
    primarykey
    data
    text
    <p>I have data like this.</p> <pre><code>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 </code></pre> <p>I am storing the column 3 and column 4 values in array.</p> <pre><code>@x = [1,10,11,12,13,2,3,4,5,6,7,8,9] and corresponding column 4 values in array @y </code></pre> <p>Now I plot the graph as folllows:</p> <pre><code>my @data = ([@x], [@y]); my $mygraph = GD::Graph::lines-&gt;new(500, 300); $mygraph-&gt;set( x_label =&gt; 'X axis', y_label =&gt; 'Y axis', title =&gt; "stats", ) or warn $mygraph-&gt;error; my $myimage = $mygraph-&gt;plot(\@data) or die $mygraph-&gt;error; </code></pre> <p>My problem is...</p> <p>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.</p> <p>Also I have abother file which has data like:</p> <pre><code>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 </code></pre> <p>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.</p> <p>Can somebody please help me with these two issues.</p> <p>Thank you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload