Plot 如何从不同的文件中绘制直方图和常量线

Plot 如何从不同的文件中绘制直方图和常量线,plot,gnuplot,line,histogram,Plot,Gnuplot,Line,Histogram,我是gnuplot的新手,我有一个问题: 我有两个不同的文本文件,第一个(file1.txt)是这样的: Switch,Port,BPS S1,1,5464091.33 S1,3,5465677.33 S2,2,5463298.00 S2,3,5462729.67 S3,1,5461340.67 S3,3,5461772.33 我用直方图绘制“file1.txt”: plot avg_file using 3:xticlabels(stringcolumn(1)."-".stringcolum

我是gnuplot的新手,我有一个问题:

我有两个不同的文本文件,第一个(
file1.txt
)是这样的:

Switch,Port,BPS
S1,1,5464091.33
S1,3,5465677.33
S2,2,5463298.00
S2,3,5462729.67
S3,1,5461340.67
S3,3,5461772.33
我用直方图绘制“file1.txt”:

plot avg_file using 3:xticlabels(stringcolumn(1)."-".stringcolumn(2)) title columnheader
这个很好用

现在我有了
file2.txt
,它包含一个值:

AVG_BPS
4844714.81
我想在上一张图(直方图)上将此值绘制为一条恒定的水平线

这是我的完整脚本:

# Terminal definition (PNG image)
set term png

# Settings
set datafile separator ","
set output 'myplot.png'
set style data histogram
set style histogram cluster gap 1
set style fill solid border -1
set boxwidth 1

# Graph and Axis titles
set title  "BPS"
set xlabel "Switch-Port"
set ylabel "bits-per-second"

# Plot
plot "file1.txt" using 3:xticlabels(stringcolumn(1)."-".stringcolumn(2)) title columnheader
下面是
myplot.png


谢谢

也许最好的方法是做一个
stats

stats 'file2.txt' u 1
hor_value=STATS_min
然后添加到绘图中:

plot "file1.txt" using 3:xticlabels(stringcolumn(1)."-".stringcolumn(2)) title columnheader, hor_value 
或者在顶部(最后一个绘图之前)放一条线:


谢谢,它与统计数据一起工作。还有一点:当我运行我的脚本时,它会在终端上打印一些统计数据,我如何防止这种情况发生?统计数据有一个
nooutput
标志。请参阅gnuplot控制台中的帮助统计信息。
set arrow nohead from graph 0, hor_value to graph 1, hor_value front