gnuplot:如何在聚集直方图的条形图上绘制点?
我正在使用gnuplot:如何在聚集直方图的条形图上绘制点?,gnuplot,histogram,Gnuplot,Histogram,我正在使用直方图聚类制作一些加速图。对于每个实例,我使用2、4、8、16和32台计算机对达到的加速比进行分组。我还用一条线表示“线性加速”。但是,对于每个实例/计算机,我还希望在其顶部放置一个点,以指示我比较加速比的值 我尝试使用相同的策略来绘制长方体,但使用点代替。但是,这些点绘制在同一位置,它们不遵循“聚集”间距 以下是我正在使用的代码: set yrange [0:105] set grid ytics set style line 1 lc rgb '#0e1111' lt 1 lw
直方图聚类
制作一些加速图。对于每个实例,我使用2、4、8、16和32台计算机对达到的加速比进行分组。我还用一条线表示“线性加速”。但是,对于每个实例/计算机,我还希望在其顶部放置一个点
,以指示我比较加速比的值
我尝试使用相同的策略来绘制长方体,但使用点代替。但是,这些点绘制在同一位置,它们不遵循“聚集”间距
以下是我正在使用的代码:
set yrange [0:105]
set grid ytics
set style line 1 lc rgb '#0e1111' lt 1 lw 2 pt -1 ps 1.0
set xlabel "Instance" font "sans, 18"
set ylabel "Normalized Speedup (In %)" font "sans, 18"
set style histogram clustered
plot for [COL=2:2] 'data.dat' using COL:xticlabels(1) title columnheade lc rgbcolor "black" lt -1 fs pattern 3,\
for [COL=3:3] 'data.dat' using COL:xticlabels(1) title columnheade lc rgbcolor "black" lt -1 fs pattern 1,\
"linear.t" t "Lin" with linespoints ls 1
数据示例
0 2 4 8 16 32
ta22 65.67 37.98 38.16 30.91 19.24
ta23 73.69 45.59 48.59 44.20 34.19
这就是我得到的。这些要点正是我想要的
有可能有这样的事吗?它还可以像一个错误条一样工作。但是,没有行,只有一个“max”
谢谢大家! 我无法运行您的代码。但是,基于你的形象,我理解你的问题。 为了根据需要绘制点,我创建了一个名为
points.dat
的文件
0 2 4 8 16 32
ta22 75.67 47.98 48.16 40.91 29.24
ta23 83.69 55.59 58.59 54.20 44.19
这一个是您的数据+10
gnuplot
代码
reset # Restore the default settings
set encoding utf8 # Selects the character encoding
set terminal pngcairo size 800,500 # Generates output in png
set output 'histogram.png' # The filename
set grid ytics ls -1 lc 'gray' # Grid lines ytics only
set yrange [0:100] # Yrange 0 to 100 (% ?)
set style data histograms # Type of data: histograms
set style histogram clustered gap 1 # Type of histogram: clustered with gap 1
set style fill transparent solid 1 border lt -1 # Style: fillstyle and border
stats 'points.dat' skip 1 matrix nooutput # Statistical summary with skip
# for header and without output
numRows = STATS_size_y # Y size of matrix (rows)
numCols = STATS_size_x # X size of matrix (columns)
array Value[numRows*(numCols-1)] # Create an array based on size of data
position = 0 # Count to position on array
# Loop for populate the array
do for [i=1:numRows]{
do for [j=2:numCols]{
# Statistical summary (with skip for header) at each value and without output
stats 'points.dat' skip 1 u j every ::i-1::i-1 nooutput
position = position + 1 # Increase the count of position
Value[position] = STATS_min # Define the array-value as result of statistical analysis
}
}
# Mapping functions:
# i-cluster/rows (x-values),
# j-column (y-values)
# ignore the cluster name ($1)
posX(i, j) = (i - 1) + 1.0*(j - numCols + 3)/numCols # To X-values
posY(i, j) = i == 1 ? Value[j] : Value[numCols - 1 + j] # To Y-values
# The plot itself as newhistogram and nested loops:
# i-loop to bars and title as columnheade
# j-loop to rows (x-values)
# k-loop to columns (y-values)
plot \
newhistogram ,\
for [i=2:numCols]\
'data.dat' u i:xticlabels(1) ls i-1 title columnheade,\
for [j=1:numRows] \
for [k=1:numCols-1] \
'+' u (posX(j, k)):(posY(j, k)) w p pt 5 ps 0.75 lc 'black' notitle
产生
你好,格索萨!非常感谢。我试过了,而且做得很好(太好了!别忘了把你的问题标为已回答。