gnuplot:获取错误的列标题?
我在Linux上使用GNUPLOT 4.6,代码如下:gnuplot:获取错误的列标题?,gnuplot,Gnuplot,我在Linux上使用GNUPLOT 4.6,代码如下: set datafile separator "," set style data linespoint set xdata time;set timefmt "%Y/%m/%d %H:%M";set autoscale plot 'PHY_Long_CHA_CMPK.csv' every ::7 using 2:3 title columnheader(3),\ 'PHY_Long_CHA_CMPK.csv' eve
set datafile separator ","
set style data linespoint
set xdata time;set timefmt "%Y/%m/%d %H:%M";set autoscale
plot 'PHY_Long_CHA_CMPK.csv' every ::7 using 2:3 title columnheader(3),\
'PHY_Long_CHA_CMPK.csv' every ::7 using 2:4 title columnheader(4),\
'PHY_Long_CHA_CMPK.csv' every ::7 using 2:5 title columnheader(5),\
pause -1
我没有得到正确的列标题(第一、第二、第三个),只是filename.csv。
有人能帮我吗?
我不应该更改filename.csv文件的数据。所以我尝试使用GNUPLOT函数
filename.csv的示例:
filename.csv
Serial number
From : 2015/12/09 13:15
To : 2016/06/09 23:30
sampling rate : 15
No.,"time","First","Second","Third"
1,"2015/12/09 13:30",0,0,0
2,"2015/12/09 13:45",0,0,0
3,"2015/12/09 14:00",0,0,0
4,"2015/12/09 14:15",0,0,0
因为现在,所有的列标题都是“filename.csv”;-)您必须注释掉注释行
#filename.csv
#Serial number
#From : 2015/12/09 13:15
#To : 2016/06/09 23:30
#sampling rate : 15
#
No.,"time","First","Second","Third"
1,"2015/12/09 13:30",0,0,0
2,"2015/12/09 13:45",0,0,0
3,"2015/12/09 14:00",0,0,0
4,"2015/12/09 14:15",0,0,0
并且不应在最后一条打印线上使用“,\”。因为现在,所有列标题都是“filename.csv”;-)您必须注释掉注释行
#filename.csv
#Serial number
#From : 2015/12/09 13:15
#To : 2016/06/09 23:30
#sampling rate : 15
#
No.,"time","First","Second","Third"
1,"2015/12/09 13:30",0,0,0
2,"2015/12/09 13:45",0,0,0
3,"2015/12/09 14:00",0,0,0
4,"2015/12/09 14:15",0,0,0
并且不应在最后一个打印行使用“,\”。您的列标题实际上是
filename.csv
,因为这是文件中的第一行。every::7
没有做您期望它做的事情,即跳过前7行。它所做的是跳过前7个数据条目。如果要跳过标题,可以使用注释符号#
或管道输入,用awk
删除前几行:
set datafile separator ","
set style data linespoint
set xdata time;set timefmt "%Y/%m/%d %H:%M";set autoscale
plot "< awk '(NR > 6){print $0}' PHY_Long_CHA_CMPK.csv" using 2:3 title columnheader(3),\
"< awk '(NR > 6){print $0}' PHY_Long_CHA_CMPK.csv" using 2:4 title columnheader(4),\
"< awk '(NR > 6){print $0}' PHY_Long_CHA_CMPK.csv" using 2:5 title columnheader(5)
pause -1
设置数据文件分隔符“,”
设置样式数据线点
设置扩展数据时间;设置时间“%Y/%m/%d%H:%m”;设置自动缩放
使用2:3标题列标题(3)绘制“6){print$0}”PHY_Long_CHA_CMPK.csv”\
“6){print$0}”PHY_Long_CHA_CMPK.csv”,使用2:4标题列标题(4)\
“6){print$0}”PHY_Long_CHA_CMPK.csv”,使用2:5标题列标题(5)
暂停-1
您的列标题实际上是filename.csv
,因为这是文件的第一行。every::7
没有做您期望它做的事情,即跳过前7行。它所做的是跳过前7个数据条目。如果要跳过标题,可以使用注释符号#
或管道输入,用awk
删除前几行:
set datafile separator ","
set style data linespoint
set xdata time;set timefmt "%Y/%m/%d %H:%M";set autoscale
plot "< awk '(NR > 6){print $0}' PHY_Long_CHA_CMPK.csv" using 2:3 title columnheader(3),\
"< awk '(NR > 6){print $0}' PHY_Long_CHA_CMPK.csv" using 2:4 title columnheader(4),\
"< awk '(NR > 6){print $0}' PHY_Long_CHA_CMPK.csv" using 2:5 title columnheader(5)
pause -1
设置数据文件分隔符“,”
设置样式数据线点
设置扩展数据时间;设置时间“%Y/%m/%d%H:%m”;设置自动缩放
使用2:3标题列标题(3)绘制“6){print$0}”PHY_Long_CHA_CMPK.csv”\
“6){print$0}”PHY_Long_CHA_CMPK.csv”,使用2:4标题列标题(4)\
“6){print$0}”PHY_Long_CHA_CMPK.csv”,使用2:5标题列标题(5)
暂停-1
+1在我写答案的时候你打了我。我会留下它,因为OP对每个的工作方式存在进一步的误解,并且因为我提出了一个awk替代方案,如果OP无法编辑文件(无论出于何种原因),该方案也会起作用@Miguel你说得对:我没想过为什么OP每次都使用:)+1在我写答案的时候你打了我。我会留下它,因为OP对每个
的工作方式存在进一步的误解,并且因为我提出了一个awk替代方案,如果OP无法编辑文件(无论出于何种原因),该方案也会起作用@Miguel你说得对:我没有想过为什么OP会使用每一个:)我会awk'NR>6'
我会awk'NR>6'