【发布时间】:2013-12-28 13:05:30
【问题描述】:
我有一个这样的逗号分隔文本文件:
1386708463,830
1386708473,830
1386708484,830
1386708497,-830
1386708508,-830
1386708518,-840
1386708528,-840
1386708538,-840
1386708686,-950
1386708696,-960
1386708706,-960
1386708716,-940
1386708726,-940
当第 2 列中的值为负时,颜色必须为红色,否则为绿色。
我试过了:
plot "< tail -10 meterstanden.txt" using (-100):1:2:0 title "", \
"< tail -11 meterstanden.txt" using (0):1:($2>0 ? $2:0/0):(0) title "Watt/uur " with vectors arrowstyle 2, \
"< tail -11 meterstanden.txt" using (0):1:($2<=0 ? $2:0/0):(0) title "Watt/uur " with vectors arrowstyle 1, \
"< tail -11 meterstanden.txt" using 2:1:2 with labels font "arial, 8" offset 1.5,0.4
但我收到此错误:
plot "< tail -10 meterstanden.txt" using (-100):1:2:0 title "", "< tail -11 meterstanden.txt" using (0):1:($2>0 ? $2:0/0):(0) title "Watt/uur " with vectors arrowstyle 2, "< tail -11 meterstanden.txt" using (0):1:($2<=0 ? $2:0/0):(0) title "Watt/uur " with vectors arrowstyle 1, "< tail -11 meterstanden.txt" using 2:1:2 with labels font "arial, 8" offset 1.5,0.4
^
"figure02_temp.plt", line 37: warning: Skipping data file with no valid points
我无法弄清楚问题是什么,我做错了什么?
完整的脚本是:
set output "gnu.png"
set datafile separator ","
set style arrow 1 lw 3 lc rgb "#ff0000"
set style arrow 2 lw 3 lc rgb "#008000"
set style arrow 1 head size screen 0.02,90 # 0.02 is de breedte van het streepje, 90 is een platte streep.
set style arrow 2 head size screen 0.02,90 # 0.02 is de breedte van het streepje, 90 is een platte streep.
set linetype 1 lw 1 pointtype 0 lc rgb"#ff0000"
set bmargin 4 # witruimte onder grafiek
set label font "arial, 8" # grootte font tbv labels in het grafiek
set terminal png notransparent truecolor enhanced
set term png size 500, 450 background rgb "#ffffff"
set ydata time
set timefmt "%s"
set format y "%H:%M:%S" # dit is de opmaak zoals je hem gaat zien
#set key outside bot center
#set key maxrows 1 # aantal regels onder het grafiek (met Watt/uur erin)
set title "Energiestroom" font "arial bold, 14"
set xtics font "arial, 10"
set ytics font "arial, 10"
set ylabel "T i j d - a s" offset 3,1 font "helvetica bold, 14"
set xlabel "W a t t / u u r" offset 0,0.5 font "arial bold, 14"
set grid xtics lc rgb "#dddddd" linewidth 2 lt 1
set grid ytics
set boxwidth 10
set style fill transparent solid 1
unset key
plot "< tail -10 meterstanden.csv" u (-100):1:2:0 title "", \
"< tail -8 meterstanden.csv" u (0):1:($2<0 ?$2:0/0):(0) notitle with vectors arrowstyle 1, \
"< tail -8 meterstanden.csv" u (0):1:($2>0 ?$2:0/0):(0) notitle with vectors arrowstyle 1, \
"< tail -8 meterstanden.csv" u 2:1:2 with labels font "arial, 8" offset 1.5,0.4
情节是; http://ccvd.eu/downloads/gnu.png
在情节之后我得到了错误。
我很高兴您的解决方案。当 Gnuplot 给我时 Linux 给我一封邮件 麻烦。现在就结束了,非常感谢。
这是结果,一个水平的“直方图”。 . .用红色和绿色。 http://ccvd.eu/downloads/gnu1.png
【问题讨论】:
标签: conditional-statements gnuplot