Search code examples
gnuplot

Gnuplot - plot array over second array


I've been really struggling for a simple task. I have two arrays defined as such:

array dt[3] 
array e[3]

I would like to plot the values e with respect to dt. When I run. plot dt, e, I get:

[4.9999999999999e-11,1.00000000000001e-10,2.49999999999999e-10]
 [181128.855275673,212726.153802402,308803.296183617]

I know this is possible but I haven't found a single example online. Please help


Solution

  • There are at least two forms of plot command possible. The first is an implicit enumeration over elements of dt

    plot dt using (dt[$1]):(e[$1]) with linespoints
    

    The second is an explicit iteration used to generate samples for the pseudofile '+'

    plot sample [i=1:|dt|:1]  '+' using (dt[i]) : (e[i]) with linespoints