I like the data.
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 do 2 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 column 3 and column 4 values in the array.
@x = [1,10,11,12,13,2,3,4,5,6,7,8,9] and related column4 value in the array @ y < / Code> Now I paint the article as fluke:
my @data = ([xx], [yy]); My $ mygraph = gd :: graph :: line-> new (500, 300); $ Mygraph- & gt; Set (x_label = & gt; 'x axis', y_label = & gt; 'Y axis', title = & gt; "statistics",) or $ mygraph-> warning; Error; My $ myimage = $ mygraph- & gt; Plot (\ @ data) or $ mygraph-> error; My problem is ...
The value of X-X in the graph is 1,10,11,12,13,2,3,4,5,6 , 7,8,9 and related y values were plotted. I can not make the X-axis code a hard code because I remove these files in these arrays. How do I know that the X-axis has 1,2,3,4,5,6,7,8,9,10,11,12,13 values and the related y values are plotted.
In addition to this I have a file containing data:
file1 date1 1 1 date 10 10 2 date 11 11 2 date 2 2 date 3 3 date 4 4 3 Date 5 5 Date 6 6 4 Date 7 7 4 Date 8 8 4 date 9 9 4 Do 2 DATE1 1 to 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 date 2 5 of 5 date6 6 1 date7 7 1 date8 8 2 date9 9 2 I can conspirate the customers for different datasets in these two files. But what I have to do, I want to show a single graph with column 3 and column 4 in column 3 and column 4 in a flat plot of another file.
Anyone please help me on these two issues?
Thank you.
Here's another attempt. I will not use the GD :: graph , because I have started this answer in my answer with the Graphics :: GnuplotIF .
Your
Correct:
Use graphics: GnuplotIF; My last $ last; My% data_per_file; Load: while (<- chmp; & lt; & gt;) My ($ file, $ label, $ x, $ y) = partition / \ s + /; $ Last = $ file if file $; Push @ {$ data_per_file {$ last}}, [$ label, $ x, $ y]; } Sort: My $ file (keys% data_per_file) {@ {$ data_per_file {$ file}} = Sort {$ a-> gt; [1] & lt; = & Gt; $ B- & gt; [1]} @ {$ data_per_file {$ file}}; } My @all_data_in_pairs; PLOT_SINGLE: For my $ file (key% data_per_file) {my @labels = map {$ _- & gt; [0]} @ {$ data_per_file {$ file}}; My @x = map {$ _- & gt; [1]} @ {$ data_per_file {$ file}}; My @ y = Map {$ _- & gt; [2]} @ {$ data_per_file {$ file}}; My $ plot = graphics :: GnuplotIF-> New (persist = & gt; 1, style = & gt; 'digit'); $ Plot- & gt; Gnuplot_set_title ($ file); $ Plot- & gt; Gnuplot_plot_xy (\ @x, \ @y); Push @all_data_in_pairs, \ @x, \ @y; } My $ plot = graphics :: gnplotif-> gt; New (constant = gt; 1, style = & gt; 'line'); $ Plot- & gt; Gnuplot_Set_Exchange (0, 10); $ Plot- & gt; Gnuplot_HardCopy ('Output.PS', 'PostScript', 'Color LW3') if $ wants Hurdcopy; $ Plot- & gt; Gnuplot_set_title ('all'); $ Plot- & gt; Gnuplot_plot_many (@all_data_in_pairs); $ Conspiracy & gt; Gnuplot_restore_terminal ();
Comments
Post a Comment