Gnuplot直方图xtics和条间距

时间:2016-12-13 12:06:37

标签: gnuplot

set style data histogram
set style histogram rowstacked
set style fill solid border

set terminal png

set output 'permfail.png'

set boxwidth 0.5 relative # histogram bar width

set title "Analysis of dangerus permissions"
set ylabel "Apps percentage %"
set yrange [0 : 100]

set xtics noenhanced # no escaping for strings
set xtics rotate by 40 right

set grid ytics

plot for [COL=2:2] 'permfail.dat' using COL:xticlabels(1) title columnheader fs pattern 2 lc rgb "black"

Permission distribution

正如您所看到的,xtics是从图像切割而来的,它们距离太近。我该如何改进呢?

1 个答案:

答案 0 :(得分:1)

要增加xtic标签之间的间距,必须增加终端尺寸,例如

set terminal pngcairo size 1000,500

Gnuplot无法获得字符串的确切长度,因为它不了解终端字体渲染的内部结构。所以它只能估计一个近似的字符串长度。特别是对于长标签,就像你一样,这可能会出错。在这种情况下,您必须明确设置适当的底部边距(根据您的需要调整数量)

set bmargin 20

set bmargin at screen 0.3