how to plot with vectical lines with gnuplot?
I study for sometime but didn't get the answer yet.
The data is like:
#X0, Y0_0, Y0_1
1 1 2
3 2 4
7 1 3
....
I need to draw vectical lin开发者_运维问答e from (X0, Y0_0) to (X0, Y0_1). gnuplot has financebar and candlesticks but they are too much.
I just want a single vectical line for each record.
Appreciate for any help.
If I understand correctly what you are after, the following script should do the job:
set offsets 1, 1, 1, 1
set key off
plot "-" u 1:2:(0):($3) w vectors nohead
1 1 2
3 2 4
7 1 3
e
What it does:
- It sets the offset, so that you can see the left and right vector, so that it is not hidden by the axis.
- Remove the label, since it has no use in this example
- Plots vectors with no head (a single vertical line). The "parameters" are as stated here the
x y dx dy
. The(0)
stands fordx=0
and the brackets are important. Otherwise the column 0 would be used which in gnuplot is the index of the data (line number).
Below the plot you will get with the script above:
精彩评论