【问题标题】:Space between Y axis and bar on gnuplot histogramgnuplot 直方图上 Y 轴和条形之间的空间
【发布时间】:2014-05-06 08:18:51
【问题描述】:

我有这样的 gnuplot 脚本:

set term pos eps
set style data histogram
set style histogram clustered gap 1
set grid y
set boxwidth 0.8 absolute
set style fill transparent solid 0.8 noborder
#set key outside right top vertical Left

#component stuff
set output 'eps/component.eps'
set title "Component in interesting Issues"
set xlabel "Components"
set xtics nomirror rotate by -270
plot 'dat/!component' using 2:xtic(1) t "Count" lc rgbcolor "blue" lt 1

和数据:

Cmp count
AM    167
NM    90
RM    83
JT    53
TT    51
RED   32
MAP   29
COMM  3
SX    6
HS    68

这是我的输出:

我看到我的图表在 Y 轴和第一个条形之间有很长的空间。我怎样才能将条均匀分布?

【问题讨论】:

    标签: gnuplot histogram


    【解决方案1】:

    gnuplot 被数据文件中的第一行弄糊涂了,这应该是标题。只需使用every ::1 跳过这一行,自动缩放就可以了:

    plot 'dat/!component' using 2:xtic(1) every ::1 t "Count" lc rgbcolor "blue" lt 1
    

    4.6.4 的结果:

    一般情况下,此类数据不需要使用直方图,绘图样式with boxes 也可以正常工作。

    【讨论】: