I'm attempting to get a 2-d plot from rust. It is a toy compartmental model comprised of two compartments and three ode's. I've copied someone else's structure that uses a "stepper" function and stepper.integrate. It appears to work fine. How would I go about saving the results data with each iteration and draw a 2-d graph using gnuplot, or perhaps some better solution? Any close examples would be most welcome. Thx. J
Are you using the gnuplot wrapper?
Apologies for ignorance, do you mean the gnuplot crate?
Perhaps this would help Twocomp ?
I don't know what the program calculates - I see you print data to stdout. Do you want to plot A vs B?
You can of course do that offline (with gnuplot):
set title "Plot of A and B"
plot "data.txt" using 1:2 with linespoints title "A vs B"
pause -1
I see you already have a "gnuplot" hello world example set up using the gnuplot crate (it's the controller I linked to above). That example would work - if you generate x & y rather than hard code them. So I guess that is your question - how to collect this data into a vector/array rather than just print the samples to stdout?
Thanks Jesper, I would like both A and B vs time on the x axis. Obviously time is the dt in the ode solver.