我正在使用gnuplot創建堆疊直方圖。今天,第一次,其中一列中的所有數據點都是零。這爲gnuplot的一個問題,因爲它現在報告:gnuplot直方圖中整個列爲零的問題
在直方圖內未定義的所有點
這是因爲我的 「使用」 語句的邏輯,如:
使用($ 6 > 0:$ 6:NaN)
當整列由忽略的值組成時,gnuplot扼流圈。有沒有我可以用來讓gnuplot它應該忽略這個特殊的,無害的問題的設置?有時候該列將爲零,並且這是數據中的有效條件。我希望gnuplot能夠處理這個問題。
如果我不能用gnuplot來處理它,我可能不得不使用不同的命令來發布我的圖,以省略缺失的數據集。除非必須,否則我寧願不做這個改變。
有沒有人有任何建議?
編輯(添加和plotscript數據文件):
的plotscript和數據文件在運行時生成,使用模板文件的組合,和腳本的邏輯來確定最終的腳本。通過打開gnuplot命令的命令管道並直接將腳本送入gnuplot,將其直接饋送到gnuplot。
今天發生該問題,因爲圖中的第6列今天全部爲零。這是一件好事(沒有圖像需要超過60分鐘才能處理)。我希望gnuplot能夠簡單地抑制零值(在plotscript中的'plot'行中的每個三元運算符),並且如果所有值都被抑制,那麼沒有該直方圖列的數據。正常和預期;除了gnuplot不喜歡它。
Plotscript:
set terminal 'pngcairo'
set key center under horizontal font ",8"
set style data histogram
set style histogram rowstacked
set style fill solid 1.0
set boxwidth 0.5 relative
set xtics border in scale 0.5,0.25 nomirror rotate by 45 font ",8" offset character -2, -1, 0 right
set xtics autofreq norangelimit
set ytics border in scale 0.5,0.25 nomirror norotate font ",8" offset character 0, 0, 0 autojustify
set ytics autofreq norangelimit
set y2tics border in scale 0.5,0.25 nomirror norotate font ",8" offset character 0, 0, 0 autojustify
set y2tics 1800 norangelimit
set my2tics 6
set title "Image Processing Trends"
set title offset character 0, 0, 0 font ",18" norotate
set timestamp "" bottom offset character 0,-2,0
unset xlabel
set ylabel "Nbr of Images (bars)"
set ylabel offset character 2, 0, 0 font ",8" textcolor lt -1 rotate by -270
set y2label "Avg Time in Seconds (line)"
set y2label offset character 0, 0, 0 font ",8" textcolor lt -1 rotate by -270
set zero 1e-08
set label "Generated by Luna" font ",6" tc rgb "#808080" at graph 1,-0.25 right
plot 'datafile' using (sum [i=2:4] column(i)):xtic(1) title "< 15 min" lc rgb "#00FF50", '' using ($5>0?$5:NaN) title columnhead lc rgb "#F0F000", '' using ($6>0?$6:NaN) title columnhead lc rgb "#FF0000"
Datafile:
"Date" "< 5 min" "5 - 10 min" "10 - 15 min" "15 - 60 min" "> 60 min" "Avg ET"
2012-10-26 1099 71 23 0 0 184
2012-10-29 16 0 0 0 0 81
2012-10-30 5 0 0 0 0 76
2012-10-31 650 41 24 19 0 176
2012-11-01 831 118 11 0 0 169
2012-11-02 671 158 195 91 0 353
2012-11-05 887 127 64 81 0 287
2012-11-06 1343 35 8 0 0 139
2012-11-07 1018 233 201 112 0 334
2012-11-08 1140 433 143 16 0 271
2012-11-09 1192 115 15 0 0 168
2012-11-12 1008 90 17 1 0 173
2012-11-13 911 62 5 0 0 160
2012-11-14 1066 346 219 68 0 317
2012-11-15 754 110 0 0 0 170
什麼版本的gnuplot?你有權使用gnuplot 4.6嗎? – mgilson
gnuplot 4.6 patchlevel 1 –
你可以顯示你使用的plotscript和一個示例數據文件嗎? (如果它不太長?)。另外,如果沒有可用的數據,您希望gnuplot進行繪圖? – mgilson