我正在尝试绘制从数据记录器获得的数据,但我不确定为什么会收到 xrange 无效错误。
\n\n下面是我的最小脚本和我试图绘制的数据示例。它们都有相似的标题,我认为这是问题所在,但我尝试#commenting它们或删除它们,但这不起作用。如果解决方案可以包括一种让我在不弄乱标题的情况下执行此操作的方法,那就太好了,可以节省我很多时间。
\n\n为了数据保护,我已将标题更改为字母 A,但它给出了相同的错误。
\n\n最小代码
\n\n    #!/gnuplot\n\nset datafile sep ','\nset xdata time\nset timefmt '%d/%m/%Y,%H:%M:%S'\n\n\n\n#DATA FILES\nplot 'PAS.csv'   using 2:4 title 'Passive'  with points pt 5 lc rgb 'red'   axes x1y1,\\\n     'ACT.csv'   using 2:4 title 'Active'   with points pt 5 lc rgb 'blue'  axes x1y1,\\\n     'RISK.csv'  using 2:4 title 'Risk'     with points pt 5 lc rgb 'black' axes x1y2\n数据
\n\nAAAAAAAAA   \nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n\nTimestamp,Date,Time,Value,Units  \n1415879007,13/11/2014,11:43:27,0.011,\xc2\xb5A \n1415878407,13/11/2014,11:33:27,0.045,\xc2\xb5A \n1415877807,13/11/2014,11:23:27,0.003,\xc2\xb5A\n1415877207,13/11/2014,11:13:27,0.056,\xc2\xb5A\n1415876607,13/11/2014,11:03:27,-0.036,\xc2\xb5A\n1415876007,13/11/2014,10:53:27,-0.046,\xc2\xb5A \n1415875407,13/11/2014,10:43:27,-0.039,\xc2\xb5A \n1415874807,13/11/2014,10:33:27,-0.050,\xc2\xb5A \n1415874207,13/11/2014,10:23:27,0.051,\xc2\xb5A \n1415873607,13/11/2014,10:13:27,-0.014,\xc2\xb5A \n1415873007,13/11/2014,10:03:27,0.035,\xc2\xb5A \n1415872407,13/11/2014,09:53:27,0.054,\xc2\xb5A \n1415871807,13/11/2014,09:43:27,-0.006,\xc2\xb5A \n1415871207,13/11/2014,09:33:27,-0.049,\xc2\xb5A \n1415870607,13/11/2014,09:23:27,0.000,\xc2\xb5A \n1415870007,13/11/2014,09:13:27,0.048,\xc2\xb5A \n1415869407,13/11/2014,09:03:27,-0.029,\xc2\xb5A\n谢谢你!
\n如果您有权访问命令行工具,例如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'
这将删除所有不以至少八位数字开头的行。经测试可与 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'