Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
自动删除gnuplot中方框图左侧的空白_Gnuplot - Fatal编程技术网

自动删除gnuplot中方框图左侧的空白

自动删除gnuplot中方框图左侧的空白,gnuplot,Gnuplot,以下是对这个问题的回答:以及我创建这个脚本的一些其他来源: set terminal postscript eps enhanced color set title "Histogram\_CreatesFile" colour1="#00A0ff" colour2="navy" colour3="#ffA000" colour4="#800000" set output 'Histogram_CreatesFile.eps' set yrange [0:] set style fill so

以下是对这个问题的回答:以及我创建这个脚本的一些其他来源:

set terminal postscript eps enhanced color
set title "Histogram\_CreatesFile"

colour1="#00A0ff"
colour2="navy"
colour3="#ffA000"
colour4="#800000"
set output 'Histogram_CreatesFile.eps'
set yrange [0:]
set style fill solid 0.8 border -1
bin_width = 0.2
set boxwidth bin_width
bin_number(x) = floor(x/bin_width)
rounded(x) = bin_width * ( bin_number(x) + 0.5 )
plot 'Histogram_CreatesFile.txt' using (rounded($1)):(1) smooth frequency with boxes lc rgb colour1 notitle
我有一个测试数据文件:

0
0.2
0.4
0.41
一切都很美好,但我在第一个酒吧左边有一个奇怪的空白处:


当我不知道apriori数据文件中的值是什么(即,它可能从0以外的值开始)时,如何使图形从第一个条开始?

在我看来,
stats
命令可能会帮助您

set terminal postscript eps enhanced color
set title "Histogram\_CreatesFile"

colour1="#00A0ff"
colour2="navy"
colour3="#ffA000"
colour4="#800000"
set output 'Histogram_CreatesFile.eps'
set yrange [0:]
set style fill solid 0.8 border -1
bin_width = 0.2
set boxwidth bin_width
bin_number(x) = floor(x/bin_width)
rounded(x) = bin_width * ( bin_number(x) + 0.5 )

stats 'Histogram_CreatesFile.txt' using (rounded($1)) nooutput
set xrange [STATS_min-bin_width/2.:]

plot 'Histogram_CreatesFile.txt' using (rounded($1)):(1) smooth frequency with boxes lc rgb colour1 notitle

在gnuplot4.6(?)中添加了
stats
。在此之前,我一直使用的技巧是绘制到虚拟终端,并从特殊的只读变量
GPVAL\u X\u MIN
中获取最小值
stats
更干净、功能更强大,目前的稳定版本是4.6,因此应该使用它。

还请注意,由于您对
设置标题使用双引号字符串,因此可能需要两个反斜杠来防止增强文本将
C
作为下标。或者,您可以使用我认为不增强的
选项。