【发布时间】:2020-05-03 10:29:11
【问题描述】:
我正在尝试在多图中绘制 3 个直方图。三个dat文件分别是:
Sta1.dat:
attn, mu2 , mu3, mu4
20, 4.9, 17.1, 78.1
25, 4.0, 22.0, 74.0
30, 2.0, 17.0, 81.0
35, 11.5, 21.7, 66.8
40, 4.7, 18.0, 77.4
45, 3.8, 8.9, 87.3
50, 0.6, 17.3, 82.1
55, 2.0, 3.4, 94.6
60, 1.0, 1.3, 97.6
Sta2.dat
attn, mu2 , mu3, mu4
20, 5.3, 20.6, 74.2
25, 9.2, 27.2, 63.6
30, 9.5, 20.3, 70.2
35, 9.9, 22.1, 68.0
40, 5.3, 19.0, 75.7
45, 3.4, 9.6, 86.9
50, 2.3, 15.3, 82.4
55, 2.7, 10.6, 86.7
60, 1.7, 1.0, 97.3
Sta3.dat
attn, mu2 , mu3, mu4
20, 6.8, 20.6, 72.6
25, 6.2, 29.5, 64.3
30, 5.3, 23.6, 71.1
35, 4.5, 15.6, 79.9
40, 5.5, 17.4, 77.1
45, 3.7, 10.5, 85.8
50, 9.1, 16.6, 74.3
55, 2.8, 3.8, 93.4
60, 1.0, 1.6, 97.4
在 num.jpg 中,直方图的 Station2 和 Station3 条是对齐的,因为显示了图例。在station1中,我没有指定图例,因为直方图的条没有对齐。
有人可以帮助调整命令以对齐所有条形。
set terminal pngcairo
set output "num.png"
set style data histogram
set style histogram rowstacked
set style fill solid
set key outside
set boxwidth 0.5
set size 1,1
set origin 0,0
set datafile separator ","
set multiplot layout 4,1
set ytics border font ",6" offset 0.7,0
set key title 'Signal Strength' font ",7"
set key font ",5"
set key bottom right
set size 1,0.25
set origin 0,0.50
set lmargin at screen 0.1
set tmargin at screen 0.48
set bmargin at screen 0.27
set rmargin at screen 0.85
set title "Station3" font ",6" offset 0,-0.7
set xtics border font ",6" offset 0,0.7
plot for [COL=2:4] 'sta3.dat' using COL:xtic(1) ti col
unset xtic
set size 1,0.25
set origin 0,0.75
set lmargin at screen 0.1
set tmargin at screen 0.73
set bmargin at screen 0.52
set rmargin at screen 0.85
set xzeroaxis
set title "Station2" font ",6" offset 0,-0.7
plot for [COL=2:4] 'sta2.dat' using COL:xtic(1) ti col
unset key
set size 1,0.25
set origin 0,0.95
set lmargin at screen 0.1
set tmargin at screen 0.96
set bmargin at screen 0.77
set rmargin at screen 0.85
set title "Station1" font ",6" offset 0,-0.7
plot for [COL=2:4] 'sta1.dat' using COL:xtic(1)
unset multiplot
exit
【问题讨论】: