如果你不想箭头头,那么你可以尝试的冲动风格(与冲动,而不是用线) (如果你仍然想在最上面的线,那么你可以绘制两次)。
如果您确实需要箭头,那么以下几点可能会有所帮助:它使用for循环(或排序)将垂直箭头添加到绘图。
Gnuplot script, for loop within or adding to existing plot
具体做法是:
创建一个文件simloop.gp它看起来像下面这样:
count = count+1
#save the count to count.gp
system 'echo '.count.' > count.gp'
#load the simloop shell
system "./simloop.sh"
#draw the arrow
load 'draw_arrow.gp'
if(count<max) reread
然后创建一个simloop.sh文件,看起来像这样
#!/bin/bash
#read the count
count=$(awk -F, '{print $1}' count.gp)
#read the file
xcoord=$(awk -v count=$count -F, 'BEGIN{FS=" ";}{ if(NR==count) print $1}' simulation.dat)
ycoord=$(awk -v count=$count -F, 'BEGIN{FS=" "}{ if(NR==count) print $2}' simulation.dat)
dir=$(awk -v count=$count -F, 'BEGIN{FS=" "}{ if(NR==count) print $3}' simulation.dat)
#choose the direction of the arrow
if [ \"$dir\" == \"0\" ]; then
echo '' > draw_arrow.gp
fi
if [ \"$dir\" == \"1\" ]; then
echo 'set arrow from ' $xcoord' ,0 to '$xcoord','$ycoord' head' > draw_arrow.gp
fi
if [ \"$dir\" == \"2\" ]; then
echo 'set arrow from '$xcoord',0 to '$xcoord','$ycoord' backhead' > draw_arrow.gp
fi
然后创建一个看起来如此的simulation.gp文件方法如下:
count = 0;
max = 5;
load "simloop.gp"
set yrange[0:*]
plot "simulation.dat" u 1:2 w l
确保shell文件具有可执行权限(chmod + wrx simloop。SH),加载了gnuplot的,并键入
load "./simulation.gp"
这为我工作与数据文件
1 99 0
2 92.7 1
3 100.3 2
4 44.2 0
5 71.23 1
(为了测试我摆脱了时间格式化你应该能够把它放回去,没有太多比较麻烦)
然后我得到这个图:
我认为这或多或少你想要什么。
来源
2011-01-27 13:54:01
Tom
嗨,我想我得到了你的gnuplot问题工作(至少在linux上)我更新了我的答案。 – Tom 2011-01-27 15:40:37