【问题标题】:how to define X's label on gnuplot如何在 gnuplot 上定义 X 的标签
【发布时间】:2015-01-28 11:22:27
【问题描述】:

这是我的数据:

18_AGT_s 8234.00 8234.00 8234.00
18_MAC_s 8414.36 8308.36 8246.33
9_MAC_r 8414.36 8308.36 8246.33
9_MAC_s 8414.55 8309.55 8246.45
8_MAC_r 8414.55 8309.55 8246.45
8_MAC_s 8414.56 8310.08 8246.47
6_MAC_r 8414.56 8310.08 8246.47
6_MAC_s 8416.19 8310.21 8246.49
1_MAC_r 8416.19 8310.21 8246.49

这是我的 gnuplot 代码:

使用 ($0+1):2 与线点 pt 8 ps 2 lt 2 lw 4 lc rgb 绘制“dat” "green" 标题 "DMSR","dat" 使用 ($0+1):3 和linespoints pt 5 ps 2 lt 3 lw 4 lc rgb "blue" title "Alarm","dat" using ($0+1):4 with linespoints pt 6 ps 2 lt 4 lw 4 lc rgb "red" title "Emergency"

这是我的输出:

但是在步骤部分我想要 18_AGT_s 和 18_MAC_s 和 9_MAC_s 和 .... 例如在 X 部分我想要 18_AGT_s 代表 1 或者我想要 18_MAC_2 代表 2 和 9_MAC_r 代表3等。任何帮助谢谢

【问题讨论】:

    标签: gnuplot


    【解决方案1】:

    使用xticlabels() 选项和带有标签的列号作为参数(1,在这种情况下):

    # Optionally rotate labels so they fit
    set xtics rotate
    
    plot "dat" using ($0+1):2 with linespoints pt 8 ps 2 lt 2 lw 4 lc rgb \
    "green" title "DMSR","dat" using ($0+1):3 with linespoints pt 5 ps 2 \
    lt 3 lw 4 lc rgb "blue" title "Alarm","dat" using \
    ($0+1):4:xticlabels(1) with linespoints pt 6 ps 2 lt 4 lw 4 lc rgb \
    "red" title "Emergency"
    

    这里您只需将它用于最后一个绘图实例,以便它覆盖数字选项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-25
      • 2014-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多