【发布时间】:2016-01-25 11:55:30
【问题描述】:
我是 gnuplot 的新手,遇到了一个问题:
我有 2 个不同的文本文件,第一个 (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:
谢谢
【问题讨论】:
标签: plot gnuplot line histogram