I am writing a program that takes in an input file from the user. The file has bunch of numbers in it and I will read the numbers in the file and create a plot based on those numbers using GD::Graph.
The first line of the file is X axis, second line of the file is Y values corresponding to X axis and third, fourth, …, etc For example:
1 2 3 4 5 2 4 5 10 14 5 6 8 12 13
So in the above, first line is x-axis, second is y values corresponding to xaxis so this will fetch 10 points. (1, 2) (1, 5) (2, 4) (2, 6)….(4,10) (4,12) (5,14) (5, 13)
I plan on reading each line of the array and then splitting the line on spaces or tabs and storing the values in an array. So, array 1 will have x-axis, array2 will have y-axis, but how should I store 3rd, 4th, 5th, …, etc lines in an array so they become (x,y)?
Furthermore, how can I find the largest value for the first and second lines (2 arrays) so I can create a limit for my X and Y axes?
Whoops, misread the question, you want either an AoAoH or an AoH, depending on whether each line after the first represents a line or the are all just points to be plotted respectively. Here is how I would write it if each line in the file was to become a line in the graph:
And here is how I would handle it if they are just points to be ploted: