【问题标题】:How to reduce the gaps in the histogram gnuplot?如何减少直方图 gnuplot 中的空白?
【发布时间】:2014-06-11 15:23:03
【问题描述】:

gnuplot 脚本:

set auto x
set yrange [0:100] 
set style data histogram 
set style histogram cluster gap 1
set style fill solid border -1 
set boxwidth 1  
plot 'test.data' using 1, '' u 2

测试数据

80   15
71   81
81   71
61   75
57   17
80   80
82   91
86   73

输出:

我需要这样:

如何减少直方图gnuplot中的空白?

【问题讨论】:

  • 只是好奇——如果你没有脚本,你从哪里得到相同数据的正确图?

标签: graph gnuplot histogram


【解决方案1】:

我认为你不能用聚集直方图样式做到这一点,因为gap 选项只接受整数。

在您只有两列的情况下,您可以使用boxes 绘图样式并将属于第一列的框向左移动框宽度的一半,将第二列的框向左移动相同的数量右边:

set auto x
set yrange [0:100] 
set style fill solid border -1
boxwidth=0.45

set boxwidth 0.45 absolute
set style data boxes
plot 'test.data' using ($0-boxwidth/2):1, '' u ($0+boxwidth/2):2

4.6.4 的结果:

【讨论】:

    【解决方案2】:

    http://www.bersch.net/gnuplot-doc/histograms.html 报告您可以在 gnuplots 中使用带有新直方图的“at x-coord”选项来手动调整集群之间的间隙。我结合使用了设置样式直方图的“gap”选项和“set offsets”命令在图表上移动集群。希望这会有所帮助。

    【讨论】:

      【解决方案3】:

      您正在为set style histogram 命令寻找gap 关键字。

      set style histogram clustered gap <width of gap>
      

      【讨论】:

      • gap 选项只接受整数