【问题标题】:gnuplot drawing multiple plots in same chartgnuplot 在同一个图表中绘制多个图
【发布时间】:2021-02-05 16:31:35
【问题描述】:

我正在尝试按照此处找到的在 gnuplot 上绘制财务数据的指南:

http://gnuplot.sourceforge.net/demo/finance.html

我生成了一些数据并尝试使用以下脚本进行绘图:

  1 set datafile separator ","
  2 set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb"#cccccc" behind
  3 
  4 set xdata time
  5 set timefmt "%Y-%M-%dT%H:%M:%S"
  6 set format x "%d-%H"
  7 
  8 set ylabel "Price"
  9 set xlabel 'Time'
 10 
 11 set style line 100 lt 1 lc rgb "grey" lw 0.5
 12 set style line 101 lt 1 lc rgb "orange" lw 1
 13 
 14 set grid ls 100
 15 set key off
 16 
 17 plot "lastrun.dat" using 1:2 with lines, '' using 1:3 with lines ls 101, '' using 1:4 with lines ls 101

但是生成的图表似乎没有正确地将数据拼接在一起,所以我在同一个空间中有三个图表,而不是一张图表。

我确定我犯了一个简单的错误,但我一直不知道那是什么。

【问题讨论】:

  • 请不要显示行号,请显示几行示例数据。好的,现在我明白了,这个月应该是 %m 而不是 %M,即 set timefmt "%Y-%m-%dT%H:%M:%S"

标签: gnuplot


【解决方案1】:

查看help time_specifiers:

%d day of the month, 01–31 
%H hour, 00–23 (always two digits) 
%m month, 01–12 
%M minute, 0–60 
%S second, integer 0–60 on output, (double) on input 
%Y year, 4-digit

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-08
    • 1970-01-01
    相关资源
    最近更新 更多