Reputation: 167
Hello everyone does anyone have any idea how to do this type of graph.
I tried to plot the combination of lines and points but it still fails.
I think I have put a range to plot point to get the example I 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 Plot
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 ''
example of how it should be plotted
Upvotes: 1
Views: 1363
Reputation: 1078
If you use vectors you can probably achieve what you want. A 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 last two c
and d
are relative coordinates of the 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 a custom arrow style that can be used:
set style arrow 1 head back filled linetype 1 linecolor rgb "red"
set xrange [0.88:0.94]
Then define functions to compute the previous x, y values and the deltas
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 plot them using the 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 ''
After OP provided complete data 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:
Upvotes: 2