我在这个表示中有数据文件:
07/06/2011 19,06 08/06/2011 31,9099 09/06/2011 31,5 10/06/2011 35 11/06/2011 30 12/06/2011 24,99 13/06/2011 24,5 14/06/2011 20,99 15/06/2011 20 etc. ( I have 1900 records in datafile... )我正在使用这些操作:
set title "financial data" set grid x y set lmargin 9 set rmargin 2 plot 'data.dat' using 2我想在x轴日期看到,但我只在x轴上看到一些来自datafile的记录(没有日期)。 我不想在x轴上看到每个日期。 我想在x轴上定期看到大约10个日期:
example 10 dates: x-axis = Jun 2011, Jul 2011, Aug 2011, Sep 2011,...我怎样才能做到这一点?
I have data file in this represetation:
07/06/2011 19,06 08/06/2011 31,9099 09/06/2011 31,5 10/06/2011 35 11/06/2011 30 12/06/2011 24,99 13/06/2011 24,5 14/06/2011 20,99 15/06/2011 20 etc. ( I have 1900 records in datafile... )I'm using these operations:
set title "financial data" set grid x y set lmargin 9 set rmargin 2 plot 'data.dat' using 2I would like to see on the x-axis dates, but I only see on the x-axis some count of records from datafile ( no dates ). I wouldn't like to see each date on x-axis. I want to see about 10 dates regularly on the x-axis:
example 10 dates: x-axis = Jun 2011, Jul 2011, Aug 2011, Sep 2011,...How can I do this?
最满意答案
您必须将x数据解释为时间。 这是完成的
set xdata time set timefmt '%d/%m/%Y' set xtics 30*24*60*60 set grid plot 'data.dat' using 1:2零件set xtics 30*24*60*60设置两个主要抽动之间的距离为一个月。 我不知道如何在内部完成,但使用以下示例文件data.dat
01/01/2012 2 01/02/2012 4 01/03/2012 3 01/04/2012 5结果似乎是正确的:
根据您的要求,您可能需要更改x轴的格式,例如
set format x '%b %Y'显示Jun 2011 ...
You must have your x-data interpreted as time. This is done with
set xdata time set timefmt '%d/%m/%Y' set xtics 30*24*60*60 set grid plot 'data.dat' using 1:2The part set xtics 30*24*60*60 sets the distance between two major tics to be one month. I don't exactly know, how this is done internally, but with the following example file data.dat
01/01/2012 2 01/02/2012 4 01/03/2012 3 01/04/2012 5the results seems to be correct:
For your requirements you may want to change the format of the x-axis with e.g.
set format x '%b %Y'to display Jun 2011 ...
更多推荐
发布评论