Graph gnuplot:标记/突出显示区域(线条图的一部分)

Graph gnuplot:标记/突出显示区域(线条图的一部分),graph,gnuplot,highlight,area,Graph,Gnuplot,Highlight,Area,我的数据非常简单,只有一个时间戳和一个如下数字: 2013-01-23 08:27:55 2801 2013-01-23 08:33:13 2801 2013-01-23 08:38:31 2660 2013-01-23 08:43:49 2785 2013-01-23 08:49:07 2785 我从另一个系统获取数据。日期和时间之间的间距,以及“日期-时间”和数字之间的制表符 整个时间窗口只有几个小时。。几天。这个总的时间窗口包含一个或多个有趣的部分(通常是几个小时),我想以某种方式标记

我的数据非常简单,只有一个时间戳和一个如下数字:

  • 2013-01-23 08:27:55 2801
  • 2013-01-23 08:33:13 2801
  • 2013-01-23 08:38:31 2660
  • 2013-01-23 08:43:49 2785
  • 2013-01-23 08:49:07 2785
我从另一个系统获取数据。日期和时间之间的间距,以及“日期-时间”和数字之间的制表符

整个时间窗口只有几个小时。。几天。这个总的时间窗口包含一个或多个有趣的部分(通常是几个小时),我想以某种方式标记或突出显示这些有趣的部分,以便更容易、更快地分析图表

需要手动指定测试时间窗口,例如,从2014-01-23 10:00:00到2013-01-24 12:00:00为2小时窗口

在线条图的背景上绘制矩形是一种可能性,而更改线条颜色(或类似的东西)则是另一种可能性

如何从手动/单独定义的时间戳执行此操作?我所能找到的最好的方法是用空行分割数据,并使用类似以下内容(从):

但是分割数据有点困难(?);我正在寻找优雅的gnuplot方法来实现目标。如果这真的是最好的选择,那么健壮的拆分也是可能的

下面是绘图功能,运行良好,但我想标记/突出显示图形的选定部分

-帕沃

function my_gnuplot {
  if [ $# -ne 3 -o -z "$1" -o -z "$2" -o -z "$3" ]
  then
    echo $0 $FUNCNAME Invalid parameters, exiting
    exit 3
  fi

  sid="$1" ; shift
  stime="$1" ; shift
  etime="$1" ; shift

  if [ $sid -gt 0 -a $sid -lt 10 ]
  then
    title=0$sid
  else
    title=$sid
  fi

  gnuplot <<- EOF
  reset
  set terminal png size 1800,900 enhanced font myfont.ttf 10

  set xdata time
  set timefmt "%Y-%m-%d %H:%M:%S"
  set format x "%Y-%m-%d %H:%M"

  set title "SID=$title from $stime to $etime"
  set grid

  set xrange [ "$stime" : "$etime" ]
  set yrange [ -2000 : 6000 ]
  set style data linespoints

  plot "sid_data_$sid.txt" using 1:9 notitle
        EOF
}
函数my\u gnuplot{
如果[$#-ne 3-o-z“$1”-o-z“$2”-o-z“$3”]
然后
echo$0$FUNCNAME无效参数,正在退出
出口3
fi
sid=“$1”移位
stime=“$1”移位
etime=“$1”班次
如果[$sid-gt 0-a$sid-lt 10]
然后
title=0$sid
其他的
title=$sid
fi

gnuplot您可以很容易地使用矩形填充空间:

set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set object 1 rectangle from "2013-01-23 08:33:13",graph 0 to "2013-01-23 08:43:49",graph 1 fs solid fc rgb "red" behind
plot 'test.dat' u 1:3 w lines ls -1

非常感谢!正是我想要的!
set xdata time
set timefmt '%Y-%m-%d %H:%M:%S'
set object 1 rectangle from "2013-01-23 08:33:13",graph 0 to "2013-01-23 08:43:49",graph 1 fs solid fc rgb "red" behind
plot 'test.dat' u 1:3 w lines ls -1