开发者

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:

  1. It sets the offset, so that you can see the left and right vector, so that it is not hidden by the axis.
  2. Remove the label, since it has no use in this example
  3. Plots vectors with no head (a single vertical line). The "parameters" are as stated here the x y dx dy. The (0) stands for dx=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:

how to plot with vectical lines with gnuplot?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜