gnuplot error:"Tic label does not evaluate as string!" in bar chart

gnuplot error:"Tic label does not evaluate as string!" in bar chart

我正在研究 Gnuplot 4.6 补丁 4。 我想用调色板创建条形图。我已关注 this 但我收到错误消息:

Tic label does not evaluate as string!

是的,与我上面提到的参考不同的是xtics。我的图形在 xtics 中使用字符串。

这是我的示例数据:

off 100.0
gpl 60.0
docs    99
vim 9.4
box 95
goo 60
ama 99.9
eba 99.98

我的绘图文件是:

set term pos eps font 20
set style data histogram
set style histogram rowstacked
set boxwidth 0.75
set format y "%.0f%%"
set style fill solid border -1

set xtics font "Times-Roman, 15" rotate by 45 right
#set xtics center offset 0,-1
set ytics font "Times-Roman, 15" 

set palette defined ( 0 "#FFFFFF",\
                      1 "#FFCCCC",\
                      2 "#FF9999 ",\
                      3 "#FF6666",\
                      4 "#FF3333",\
                      5 "#FF0000",\
                      6 "#CC0000",\
                      7 "#C00000",\
                      8 "#B00000",\
                      9 "#990000",\
                      10 "#A00000")

set ylabel "Percentages"
#set xlabel "Services"
set yrange [70:100]
set output 'a2.eps'
plot 'a2.dat' \
    using ():xtic(1):(<=10 ? 0 : <=20 ? 1 : 2) t '' with boxes palette

感谢帮助!

xtic 标签部分应该始终是 using 语句中的最后一部分。此外,当使用 boxes 绘图样式时,您必须指定 x、y 和颜色值:

plot 'a2.dat' \
    using 0:2:(<=10 ? 0 : <=20 ? 1 : 2):xtic(1) t '' with boxes palette

请注意,with boxes 会覆盖您之前设置的 histogram 样式。此外,调色板中给出的值不是绝对值,但这些颜色值会按比例缩放以适应 [0:2] 的有效颜色范围。