动态更改gnuplot中直方图的范围? 我有一个C++程序,它从样本数据中生成10000个中间变量,并将中间变量输出到名为“DATA .DAT”的文件。然后,我从修改了这个gnuplot脚本以生成直方图: reset n=100 #number of intervals max=500 min=0 #min value width=(max-min)/n #interval width #function used to map a value to the intervals hist(x,width)=width*floor(x/width)+width/2.0 set term png #output terminal and file set output "histogram.png" set xrange [min:max] set yrange [0:] #to put an empty boundary around the #data inside an autoscaled graph. set offset graph 0.05,0.05,0.05,0.0 set xtics min,(max-min)/5,max set boxwidth width*0.9 set style fill solid 0.5 #fillstyle set tics out nomirror set xlabel "Medians" set ylabel "Frequency" #count and plot plot "data.dat" u (hist($1,width)):(1.0) smooth freq w boxes lc rgb"green" notitle set xrange [GPVAL_DATA_X_MIN:GPVAL_DATA_X_MAX] reset replot

动态更改gnuplot中直方图的范围? 我有一个C++程序,它从样本数据中生成10000个中间变量,并将中间变量输出到名为“DATA .DAT”的文件。然后,我从修改了这个gnuplot脚本以生成直方图: reset n=100 #number of intervals max=500 min=0 #min value width=(max-min)/n #interval width #function used to map a value to the intervals hist(x,width)=width*floor(x/width)+width/2.0 set term png #output terminal and file set output "histogram.png" set xrange [min:max] set yrange [0:] #to put an empty boundary around the #data inside an autoscaled graph. set offset graph 0.05,0.05,0.05,0.0 set xtics min,(max-min)/5,max set boxwidth width*0.9 set style fill solid 0.5 #fillstyle set tics out nomirror set xlabel "Medians" set ylabel "Frequency" #count and plot plot "data.dat" u (hist($1,width)):(1.0) smooth freq w boxes lc rgb"green" notitle set xrange [GPVAL_DATA_X_MIN:GPVAL_DATA_X_MAX] reset replot,gnuplot,Gnuplot,这个脚本生成的正是我想要的,只是我需要更改直方图的x范围的能力。我的C++程序要求用户使用样本数据的上边界。这意味着中值数据可以在0和用户输入的任何上限之间。正如您在上面所看到的,我试图更改数据的范围,但未能使其正常工作。即使我使用GLPVAL_数据并重置xrange并重新打印数据,直方图范围也不会改变。我只是得到了与原始图形输出相同的xrange 0到500。我在这里做错了什么?使用设置自动缩放xfix?使用设置自动缩放x我能够获得所需的输出。谢谢或者删除set xrange…调用。

这个脚本生成的正是我想要的,只是我需要更改直方图的x范围的能力。我的C++程序要求用户使用样本数据的上边界。这意味着中值数据可以在0和用户输入的任何上限之间。正如您在上面所看到的,我试图更改数据的范围,但未能使其正常工作。即使我使用GLPVAL_数据并重置xrange并重新打印数据,直方图范围也不会改变。我只是得到了与原始图形输出相同的xrange 0到500。我在这里做错了什么?

使用
设置自动缩放xfix
?使用设置自动缩放x我能够获得所需的输出。谢谢或者删除
set xrange…
调用。