Question: Help about a X-Y graphics

Hello,

I have some difficulties to create an X-Y chart and what data structure I should use.

I have a loop, I set the maximum number of iteration to nmax.

At the end of each iteration, I will retrieve two information (variables):

-iteration number, 1 by 1 until nmax, integer: n
-an value associated with this iteration, integer: v

I will store iteratively these values (at least v) at the end of each loop in a data structure, this is an example of the filling of the data:

Example after iteration 1 and before iteration 2:
(1,v1)
(2,0)
(3,0)
.....
(nmax,0)

Example after iteration 2 and before iteration 3:
(1,v1)
(2,v2)
(3,0)
.....
(nmax,0)



Then, I would like to plot these data when nmax is reached:

- X axis would be the number of iteration (from 1 to nmax, 1 by 1).
- Y axis would be the value at each iteration.
- Draw a line between these points

My questions are:

1. What data structure should I use to recursively store the iteration number (n) and each associated value (v) ? How can I create the data structure knowing nmax ? 
2. How can I plot an X-Y graph from this structure ?

Regards,

RedVivi

Please Wait...