Reputation: 907
I'm working on Gnuplot 4.6 patch 4. I want to create the bar chart with palette. I've followed this but I got error:
Tic label does not evaluate as string!
Yes, the different with the reference that I mentioned above are the xtics. My graph uses string in xtics.
Here is my sample data:
off 100.0
gpl 60.0
docs 99
vim 9.4
box 95
goo 60
ama 99.9
eba 99.98
and my plot file is:
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 ($2):xtic(1):($2<=10 ? 0 : $2<=20 ? 1 : 2) t '' with boxes palette
Thanks for help!
Upvotes: 1
Views: 412
Reputation: 48420
The xtic
label part should always be the last in a using
statement. Also, when using the boxes
plotting style you must specify x, y and color values:
plot 'a2.dat' \
using 0:2:($2<=10 ? 0 : $2<=20 ? 1 : 2):xtic(1) t '' with boxes palette
Note, that with boxes
overwrites the histogram
style you set earlier. Also, the values given in the palette aren't absolute values, but those color values are scaled to accomodate your effictive color range of [0:2].
Upvotes: 1