Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gnuplot 在基于时间的线图上绘制布尔值_Gnuplot - Fatal编程技术网

Gnuplot 在基于时间的线图上绘制布尔值

Gnuplot 在基于时间的线图上绘制布尔值,gnuplot,Gnuplot,我正在绘制一个基于时间的折线图,并希望向其中添加一个布尔数据系列 是否可以让布尔数据突出显示值为真的图形画布的整个高度 打印文件: set datafile separator "," set terminal pngcairo size 800,400 set title "Solar charge monitor" set yrange [0:] set ylabel "V" set y2range [0:] set y2label "A" set y2tics set xlabel "Da

我正在绘制一个基于时间的折线图,并希望向其中添加一个布尔数据系列

是否可以让布尔数据突出显示值为真的图形画布的整个高度

打印文件:

set datafile separator ","
set terminal pngcairo size 800,400
set title "Solar charge monitor"
set yrange [0:]
set ylabel "V"
set y2range [0:]
set y2label "A"
set y2tics
set xlabel "Date"
set xdata time
set timefmt "%Y-%m-%dT%H:%M:%SZ"
set key left top
set grid
set output "samplePlot.png"
plot "sampleData.csv" using 1:2 with lines lw 2 title 'Batt (V)', \
     "sampleData.csv" using 1:3 with lines lw 2 title 'Solar (V)', \
     "sampleData.csv" using 1:4 with lines lw 2 title 'Charge (A)' axes x1y2, \
     "sampleData.csv" using 1:5 with lines lw 2 title 'Load (A)' axes x1y2
样本数据:

time,V_Batt,V_SolarV,A_Charge,A_Load,bool_charging
2014-09-25T07:06:03.358Z,13.20,14.38,0.52,0.03,1
2014-09-25T07:05:03.639Z,13.16,14.14,0.52,0.05,1
2014-09-25T07:04:02.856Z,13.18,14.19,0.54,0.03,1
2014-09-25T07:03:03.141Z,13.18,14.24,0.52,0.03,1
2014-09-25T07:02:03.410Z,13.18,14.09,0.52,0.03,1
2014-09-25T07:01:03.604Z,13.20,14.38,0.54,0.03,1
2014-09-25T07:00:02.766Z,13.11,14.28,0.50,0.02,1
2014-09-25T06:59:03.025Z,13.09,14.28,0.48,0.02,1
2014-09-25T06:58:03.302Z,13.11,14.28,0.43,0.02,1
2014-09-25T06:57:03.445Z,13.18,14.28,0.56,0.05,1
2014-09-25T06:56:02.611Z,13.16,14.14,0.52,0.03,1
2014-09-25T06:55:02.901Z,13.09,14.58,0.48,0.01,1
2014-09-25T06:54:03.178Z,13.09,14.48,0.52,0.02,1
2014-09-25T06:53:03.432Z,13.13,14.53,0.54,0.06,1
2014-09-25T06:52:03.630Z,13.11,14.28,0.48,0.03,1
2014-09-25T06:51:02.763Z,13.16,14.14,0.54,0.05,1
2014-09-25T06:50:03.068Z,13.16,14.28,0.54,0.03,1
2014-09-25T06:49:03.388Z,13.07,14.38,0.50,0.03,1
2014-09-25T06:48:02.683Z,13.09,14.33,0.50,0.03,1
2014-09-25T06:47:02.967Z,13.07,14.04,0.48,0.02,1
2014-09-25T06:46:03.249Z,13.05,14.19,0.48,0.02,1
2014-09-25T06:45:03.410Z,13.09,14.24,0.56,0.06,1
2014-09-25T06:44:02.677Z,13.07,14.24,0.52,0.03,1
2014-09-25T06:43:02.973Z,13.05,14.09,0.50,0.03,1
2014-09-25T06:42:03.282Z,13.09,14.24,0.52,0.03,1
2014-09-25T06:41:03.389Z,12.96,14.04,0.46,0.02,1
2014-09-25T06:40:02.702Z,12.76,13.59,0.50,0.00,1
我想添加第6列,它是一个布尔值(0/1)。在此示例数据中,背景将被完全高亮显示,因为布尔值始终为真


任何提示?

根据第6列的值,您可以使用
框打印样式绘制背景框,例如

plot "sampleData.csv" using 1:($6 * 16) with boxes fc rgb '#ccffcc' fillstyle solid,\
     "" using 1:2 lt 1 with lines lw 2 title 'Batt (V)'
但是,这要求您知道y范围的最大值和最小值。如果该值应自动计算,则首先需要使用
未知
终端绘制虚拟图,然后使用
GPVAL\u Y\u MIN
GPVAL\u Y\u MAX

reset
set datafile separator ","
set terminal pngcairo size 800,400
set title "Solar charge monitor"
set yrange [0:]
set ylabel "V"
set y2range [0:]
set y2label "A"
set y2tics
set xlabel "Date"
set xdata time
set timefmt "%Y-%m-%dT%H:%M:%SZ"
set key left center
set grid
set autoscale xfix
set style data lines

set terminal push
set terminal unknown
plot "sampleData.csv" using 1:2, "" using 1:3
set terminal pop

set output "samplePlot.png"
plot "sampleData.csv" using 1:(GPVAL_Y_MIN + $6 * (GPVAL_Y_MAX - GPVAL_Y_MIN)) with boxes fc rgb '#ccffcc' fillstyle solid notitle,\
     "" using 1:2 lt 1 lw 2 title 'Batt (V)', \
     "" using 1:3 lt 2 lw 2 title 'Solar (V)', \
     "" using 1:4 lt 3 lw 2 title 'Charge (A)' axes x1y2, \
     "" using 1:5 lt 4 lw 2 title 'Load (A)' axes x1y2
使用稍微更改的数据文件(我插入了一些零以显示效果),我得到:

如果不希望在边界处使用垂直线,也可以使用
填充曲线

...
plot "sampleData.csv" using 1:(GPVAL_Y_MIN + $6 * (GPVAL_Y_MAX - GPVAL_Y_MIN)) with filledcurves x1 fc rgb '#ccffcc' fillstyle solid notitle,
...

最好在此处包含您的数据样本,并将脚本减少到问题所需的最低限度。当你说“突出”时,你到底是什么意思?