我正在尝试绘制从数据记录器获取的数据,我不确定为什么我得到xrange是无效的错误。
下面是我的最小脚本和我试图绘制的数据样本。他们都有类似的标题,我认为这是问题,但我尝试#commenting他们或删除它们,这是行不通的。如果解决方案可以包含一种让我这样做而不会弄乱标题的方法,那就太棒了,节省了我很多时间。
我已将标题更改为字母A以进行数据保护,它会产生相同的错误。
最小代码
#!/gnuplot
set datafile sep ','
set xdata time
set timefmt '%d/%m/%Y,%H:%M:%S'
#DATA FILES
plot 'PAS.csv' using 2:4 title 'Passive' with points pt 5 lc rgb 'red' axes x1y1,\
'ACT.csv' using 2:4 title 'Active' with points pt 5 lc rgb 'blue' axes x1y1,\
'RISK.csv' using 2:4 title 'Risk' with points pt 5 lc rgb 'black' axes x1y2
DATA
AAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Timestamp,Date,Time,Value,Units
1415879007,13/11/2014,11:43:27,0.011,µA
1415878407,13/11/2014,11:33:27,0.045,µA
1415877807,13/11/2014,11:23:27,0.003,µA
1415877207,13/11/2014,11:13:27,0.056,µA
1415876607,13/11/2014,11:03:27,-0.036,µA
1415876007,13/11/2014,10:53:27,-0.046,µA
1415875407,13/11/2014,10:43:27,-0.039,µA
1415874807,13/11/2014,10:33:27,-0.050,µA
1415874207,13/11/2014,10:23:27,0.051,µA
1415873607,13/11/2014,10:13:27,-0.014,µA
1415873007,13/11/2014,10:03:27,0.035,µA
1415872407,13/11/2014,09:53:27,0.054,µA
1415871807,13/11/2014,09:43:27,-0.006,µA
1415871207,13/11/2014,09:33:27,-0.049,µA
1415870607,13/11/2014,09:23:27,0.000,µA
1415870007,13/11/2014,09:13:27,0.048,µA
1415869407,13/11/2014,09:03:27,-0.029,µA
谢谢!
答案 0 :(得分:4)
如果您可以访问grep
等命令行工具,则可以在绘制数据文件之前对其进行过滤:
set datafile sep ','
set xdata time
set timefmt '%d/%m/%Y,%H:%M:%S'
#DATA FILES
plot '< grep -E ''^[0-9]{8,}'' PAS.csv' using 2:4 title 'Passive' with points pt 5 lc rgb 'red'
这将删除所有不以8位数字开头的行。经测试可与4.6.3一起使用。
或者,如果较旧的gnuplot版本在timefmt
中的逗号有问题,您还可以在x轴的第一列中使用时间戳:
set datafile sep ','
set xdata time
set timefmt '%s'
plot '< grep -E ''^[0-9]{8,}'' PAS.csv' using 1:4 title 'Passive' with points pt 5 lc rgb 'red'