gnuplot:只使用最后n行 [英] gnuplot: Use only last n line

查看:303
本文介绍了gnuplot:只使用最后n行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用python脚本将两个温度传感器的数据记录到.csv文件。对于每次读取(每5分钟),一个新行被添加到文件的结尾。



谢谢!

$ b如何使gnuplot只使用最后288行?
$ b



感谢@Istvan Chung的提示。 b
$ b

一个简单的

  tail -n 288 datafile.csv'using ... 

似乎做到了。

解决方案

一个简单的解决方案是使用unix tail 命令选择最后288行。



我在评论中建议

  tail -n 288< file& | gnuplot -p -eset datafile separator \,\; plot' - '

应该工作。根据对原始问题的编辑,这里正确的语法是

的形式

  plot'< tail -n 288 datafile.csv'using ... 


I'm using a python script to record data from two temperature sensors to a .csv file. For every reading (every 5 mins) a new line is added to the end of the file. How can I get gnuplot to only use the last 288 lines, so I will end up with a graph for the last 24 hrs?

Thanks!

:Edit:

Got it, thanks for the hint @Istvan Chung.

A simple

plot '< tail -n 288 datafile.csv' using ...

seems to do the trick.

解决方案

An easy solution here is to use the unix tail command to select the last 288 lines.

I suggested in a comment that

tail -n 288 <file> | gnuplot -p -e "set datafile separator \",\"; plot '-'"

should work. According to an edit on the original question, the correct syntax here was of the form

plot '< tail -n 288 datafile.csv' using ...

这篇关于gnuplot:只使用最后n行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆