Graphic lines and vectors in graphic gnuplot
Hi everyone, does anyone know how to do this.
I tried to plot a combination of lines and dots, but it still fails.
I think I put a range to plot the point to get the example below.
dat.txt
0.936 1.735E-5
0.9317 1.682E-5
0.9274 1.633E-5
0.9232 1.588E-5
0.9189 1.545E-5
0.9146 1.504E-5
0.9103 1.466E-5
0.9061 1.431E-5
0.9018 1.396E-5
0.8975 1.364E-5
0.8932 1.333E-5
0.889 1.304E-5
0.8847 1.277E-5
For schedule
set xl 'Potential / V'
set yl 'Current / A'
plot 'dat.txt' u 1:2 w l lw 2 lt -1,\
'dat.txt' u 1:2 w p pt 2 ti ''
an example of how this should be built
source to share
If you're using vectors, you can probably achieve what you want. The vector takes the following type of argument:
plot 'mydata.dat' a:b:c:d with vectors
The first two columns a
and b
are the starting point and the last two c
and d
are relative coordinates vectors
Hence, if you can compute these values ββfrom your data, you should be able to achieve the desired result.
set xl 'Potential / V'
set yl 'Current / A'
Define your own arrow style that you can use:
set style arrow 1 head back filled linetype 1 linecolor rgb "red"
set xrange [0.88:0.94]
Then define functions to calculate previous x, y and delta values
prev_x = NaN prev_y = NaN dx(x) = (x_delta = x-prev_x, prev_x = ($0 > 0 ? x : 1/0), x_delta) dy(y) = (y_delta = y-prev_y, prev_y = ($0 > 0 ? y : 1/0), y_delta)
Finally, build them using vectors command
plot 'stats.dat' u 1:2 w l lw 2 lt -1, '' u (prev_x):(prev_y):(dx($1)):(dy($2)) every 2 w vectors arrowstyle 1 ti ''
Edit
After the OP provided the complete details here , the script was changed to the following:
set xl 'Potential / V'
set yl 'Current / A'
set style arrow 1 head back filled size screen 0.015,20,35 linetype 1 linecolor rgb "red"
prev_x = NaN
prev_y = NaN
dx(x) = (xd = x-prev_x, prev_x = ($0 > 0 ? x : 1/0), xd)
dy(y) = (yd = y-prev_y, prev_y = ($0 > 0 ? y : 1/0), yd)
plot 'data.dat' u 1:2 w l lw 2 lt -1, '' u (prev_x):(prev_y):(dx($1)):(dy($2)) every 10 w vectors arrowstyle 1 ti ''
With the following graph:
source to share