【问题标题】:Cannot plot candlestick data in Gnuplot with a date/time field无法在 Gnuplot 中使用日期/时间字段绘制烛台数据
【发布时间】:2012-12-19 14:27:14
【问题描述】:

说这令人沮丧是客气的。我的示例数据如下所示:

2012-04-30 20:00,1.32412,1.32412,1.32376,1.3239
2012-04-30 20:15,1.3239,1.32416,1.32378,1.32388
2012-04-30 20:30,1.32388,1.3241,1.32388,1.324
2012-04-30 20:45,1.324,1.32405,1.32385,1.32385
...

字段在哪里:

Date/Time,Open,High,Low,Close

我的 Gnuplot 脚本很简单:

set xdata time
set timefmt "%y-%m-%d %H:%M"
set format x "%m/%d\n%H:%M"
set xrange ["2012-05-01 00:00":"2012-05-01 08:00"]
set yrange [*:*]
set grid
set key left
set datafile separator ","
plot 'data.csv' using 1:2:4:3:5 notitle with candlesticks

如您所见,我正在调整列数据以匹配烛台图预期的顺序。我的数据范围从 2012 年 4 月 30 日到 2012 年 5 月 31 日,所以我只想绘制 8 小时的数据来开始。我试图将 xrange 设置为[*:*],但这只会导致事情变得更糟。任何帮助将不胜感激。

【问题讨论】:

    标签: datetime gnuplot candlestick-chart


    【解决方案1】:

    所以问题出在timefmt 部分。由于我使用的是 4 位数年份,因此我需要使用 %Y 而不是 %y,即大小写很重要。希望这将为遇到这种奇怪情况的其他人澄清问题。

    【讨论】:

    • 好收获:)。很高兴您发现了问题。
    猜你喜欢
    • 1970-01-01
    • 2016-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-03
    • 2018-12-16
    相关资源
    最近更新 更多