如何减少直方图gnuplot中的间隙? [英] How to reduce the gaps in the histogram gnuplot?

查看:128
本文介绍了如何减少直方图gnuplot中的间隙?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

gnuplot脚本:

gnuplot script:

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

test.data

test.data

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

输出:

我需要这样:

如何减少直方图gnuplot中的间隙?

How to reduce the gaps in the histogram gnuplot?

推荐答案

我认为您无法使用聚集的直方图样式执行此操作,因为gap选项仅接受整数.

I think you cannot do this with the clustered histogram style, because the gap option takes only integer numbers.

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

In your case with only two columns, you can use the boxes plotting style and shift the boxes belonging to the first column by half of the boxwidth to the left, and the boxes of the second column by the same amount to the right:

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的结果:

这篇关于如何减少直方图gnuplot中的间隙?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆