2014-09-05 25 views
0

我有一个看起来像这样的文件:情节从晚上11点到早上9点的时间数据,可以追溯到

[email protected] asc-47$ head -n 2 imp 
23:22:37 23.3769 240.800 581.300  1.000  1.000 -2.839 -0.360  5.114  2.076 
23:23:07 23.3853 240.700 580.300  1.000  1.000 -2.838 -0.358  5.114  2.079 
[email protected] asc-47$ tail -n 2 imp 
09:22:23 9.3731 257.300 636.900  1.000  1.000 -2.867 -0.358  5.103  2.082 
09:22:53 9.3814 257.200 635.800  1.000  1.000 -2.867 -0.358  5.104  2.082 

我想绘制列3列VS 1.

我gnuplot的文件看起来像这样:

#!/bin/gnuplot 
# 
set terminal svg size 1400,1048 enhanced fname 'Verdana' fsize 12 
set output 'curr-imp.svg' 
unset key 
set xlabel 'Tiempo (h)' 
set ylabel 'Corriente (mA)' 
set xdata time 
set timefmt "%H:%M:%S" 
set format x "%H" 
set style line 1 lc rgb '#000000' pt 6 ps 1 lt 1 lw 2 # --- black with empty circles 
set style line 11 lc rgb '#808080' lt 1 
set border 3 back ls 11 
set tics nomirror 
set style line 12 lc rgb '#808080' lt 0 lw 1 
set grid back ls 12 
plot 'imp' u 1:3 ls 1 w lp 

这给了我几乎所需的输出。 current vs time

问题是,线路回来了,因为时间从晚上23点到09点。我在想,也许我应该有时间和日期。或者有另一种方法来解决这个问题?感谢很多您的时间

+3

对于相同的问题,请参阅[python gnuplot读取csv文件以读取顺序或行顺序绘制x轴的时间](http://stackoverflow.com/q/25308739/2604213)。我正在投票重复。我的建议是,虽然,如果你可以控制你的数据输出,写入时间戳:) – Christoph 2014-09-05 06:54:17

回答

0

只是为了清楚起见,我会告诉我如何在最后做的事情。 (提供的链接是不完全的我来说,因为我有在不同的文件不同天的数据。) 首先,添加DATE1到file1和date2与VIM(:%s/^/27-06-14/g:%s/^/28-06-14/g墨西哥到file2我们写一天,为期一个月年)。

[email protected] asc-47$ head -n 1 imp-27 
27-06-14 23:22:37 23.3769 240.800 581.300  1.000  1.000 -2.839 -0.360  5.114  2.076 
[email protected] asc-47$ tail -n 1 imp-28 
28-06-14 09:22:53 9.3814 257.200 635.800  1.000  1.000 -2.867 -0.358  5.104  2.082 

然后,将file1和file2合并到cat中。 之后,只需改变线路:

set timefmt "%d-%m-%y %H:%M:%S" set format x "%H %p" .... plot 'imp' u 1:4 ls 1 w lp

和你做。 :) enter image description here

+1

嗯,你写你的问题这是一个确切的重复,你有没有提到你有每天的一个数据文件。有了gnuplot,你还可以将这些信息作为'plot' Christoph 2014-09-09 06:17:14

相关问题