【问题标题】:Gnuplot plotting timelime cuts xtics at certain pointGnuplot 绘制 timelime 在某个点切割 xtics
【发布时间】:2013-06-19 20:42:48
【问题描述】:

当我尝试绘制显示国债收益率的时间线时,Gnuplot 并未在 x 轴上列出所有日期。 看下面的情节图片: Gnuplot 在 1995-Jun 之后删除了 xtics,并且没有显示任何进一步的日期。我的数据如下:

1993-01-04 5.9
1993-01-05 5.9
1993-01-06 5.94
1993-01-07 6.05
..
1996-12-27 6.09
1996-12-30 6.1
1996-12-31 6.21

这是我的 gnuplot 配置文件:

set terminal latex
set xdata time
set timefmt "%Y-%m-%d"
set output "5yr-yields.tex"

set xrange ["1993-01-04":"1996-12-31"]
set yrange [4:8]
set xtics format "%Y-%b"

unset mxtics
set xtics ("1993-06", "1992-12", "1993-06", "1993-12", "1994-06", "1994-12", "1995-06", "1995-12", "1996-06", "1996-12")

set size 1.4,1 
set xlabel "date"
set ylabel "\\rotatebox{90}{5-year treasury yield}" rotate by 270
plot "5yr-yields.dat" using 1:2 index 0 notitle with lines smooth csplines

我希望 gnuplot 也列出 1995-Dec、1996-Jun 和 1996-Dec。有什么想法吗?

【问题讨论】:

    标签: plot gnuplot


    【解决方案1】:

    你可以试试:

    plot "5yr-yields.dat" using 2:xtic(1) index 0 notitle with lines smooth csplines
    

    【讨论】:

    • 结果为@​​987654322@
    【解决方案2】:

    看来我解决了我的问题。当省略set size 1.4,1 行时,所需日期出现在 x 轴上。但是日期相互重叠,因为图表水平不够大。

    如何在没有 size 参数的情况下缩放图形?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-21
      • 1970-01-01
      • 2023-03-28
      • 1970-01-01
      相关资源
      最近更新 更多