Gnuplot
使用 GNUplot 設置軸標籤和直方圖示籤
我有以下 GNUplot 文件:
set title "Performance of Quicksort over random data sets" set yrange [0:80000] set style data histogram set style histogram cluster set style fill solid border -1 set boxwidth 0.9 plot for [COL=2:6:1] 'timings.dat' using COL
和以下數據文件:
# Data-size being x-axis, each data size having a histogram-bar for seq/2-t/4-t/8-t/16-t (color-coded) # Y-axis is time (the information in the columns below Sequential for example being the timings of sequential program for 2^15...2^28) Data-size Sequential 2-threaded 4-threaded 8-threaded 16-threaded 2^15 6 4 5 7 10 2^16 11 9 9 11 19 2^17 24 17 18 24 32 2^18 49 35 32 43 59 2^19 102 71 70 89 115 2^20 208 145 135 161 201 2^21 431 295 281 333 416 2^22 895 598 550 667 870 2^23 1887 1219 1173 1228 1639 2^24 3852 2979 2478 2621 3457 2^25 7962 4980 4693 5064 6834 2^26 16329 10151 9332 10062 13217 2^27 33775 21039 19072 20008 25196 2^28 69995 43393 38091 40598 52492
這就是生成的 gnuplot 圖像的樣子:
我的兩個問題是:
- x 軸應根據數據大小列標記 (2^15,…,2^28)
- 條形應根據它們在數據表中的名稱命名(順序、2 執行緒等)
我已經閱讀了手冊的部分內容,這使我達到了這個階段,但不幸的是,我沒有足夠的經驗來理解我想要的東西是如何完成的。
我想你想要的是
plot for [COL=2:6:1] 'timings.dat' using COL:xticlabels(1) title columnheader
但是,您可能需要修改第一列的冪
2^{15}
等,以便正確解析它們:$ cat timings.dat # Data-size being x-axis, each data size having a histogram-bar for seq/2-t/4-t/8-t/16-t (color-coded) # Y-axis is time (the information in the columns below Sequential for example being the timings of sequential program for 2^{15}...2^28) Data-size Sequential 2-threaded 4-threaded 8-threaded 16-threaded 2^{15} 6 4 5 7 10 2^{16} 11 9 9 11 19 2^{17} 24 17 18 24 32 2^{18} 49 35 32 43 59 2^{19} 102 71 70 89 115 2^{20} 208 145 135 161 201 2^{21} 431 295 281 333 416 2^{22} 895 598 550 667 870 2^{23} 1887 1219 1173 1228 1639 2^{24} 3852 2979 2478 2621 3457 2^{25} 7962 4980 4693 5064 6834 2^{26} 16329 10151 9332 10062 13217 2^{27} 33775 21039 19072 20008 25196 2^{28} 69995 43393 38091 40598 52492