我的问题是有没有办法在 gnuplot 中制作水平直方图?以下是直方图的组成数据集:
sample M N O P Q R S T Total
A 39.17 8.33 11.07 8.57 22.20 22.93 1.47 1.13 114.87
B 61.68 15.53 16.23 15.55 35.68 36.35 2.32 2.23 185.58
C 30.20 7.35 7.55 7.48 16.90 17.50 1.18 1.10 89.25
D 12.57 5.18 4.98 5.77 9.88 8.18 0.67 0.83 48.07
E 36.80 9.00 11.07 9.43 21.43 22.63 0.93 1.03 112.33
F 62.05 15.57 15.95 15.70 35.68 36.63 2.27 2.47 186.32
G 30.23 7.33 7.55 7.48 17.10 17.68 1.10 1.25 89.70
H 12.97 4.87 5.22 5.18 10.37 7.90 0.98 0.70 48.18
I 17.67 12.80 9.40 5.67 32.47 18.53 1.13 0.63 98.30
J 72.30 13.70 17.43 15.43 30.62 38.43 2.25 2.43 192.60
K 25.70 7.58 12.45 4.60 19.30 18.88 1.10 0.80 90.40
L 16.15 3.80 3.53 10.43 7.27 8.80 0.88 1.10 51.97
我从这里修改了代码以绘制直方图:
set terminal png font "Times-Roman,9"
set output 'sample.png'
set border 3 front linetype -1 linewidth 1.000
set boxwidth 0.85 absolute
set style fill solid 1.00 border lt -1
set grid nopolar
set grid noxtics nomxtics ytics nomytics noztics nomztics \
nox2tics nomx2tics noy2tics nomy2tics nocbtics nomcbtics
set grid layerdefault linetype 0 linewidth 1.000, linetype 0 linewidth 1.000
set key outside right top vertical Left reverse noenhanced autotitles columnhead nobox
set key invert samplen 4 spacing 1 width 0 height 0
set style histogram rowstacked title offset character 0, 0, 0
set datafile missing '-'
set style data histograms
#set style histogram gap 1
set xtics border in scale 0,0 nomirror rotate by -45 offset character 0, 0, 0 autojustify
set xtics norangelimit font ",8"
set xtics ()
#set noytics
set ylabel "% of total"
set yrange [ 0 : 100 ] #noreverse nowriteback
plot 'sample.txt' using (100.*$2/$10):xtic(1) t column(2), for [i=3:9] '' using (100.*column(i)/column(10)) title column(i)
这给了我:
gnuplot 有没有办法让它横着走?