I am trying to plot stacked bar graph using gnuplot. As for example I tried to plot stacked bar graph using data and gnuplot code below:
Data is:
year foo bar rest
1900 20 10 20
2000 20 30 10
2100 20 10 10
The gnuplot code is:
#
# Stacked histograms
#
set term png size 300,300
set output 'stackedhisto.png'
#set title "Stacked histogram\nTotals"
# Where to put the legend
# and what it should contain
set key invert reverse Left outside
set key autotitle columnheader
set yrange [0:100]
set ylabel "total"
# Define plot style 'stacked histogram'
# with additional settings
set style data histogram
set style histogram rowstacked
set style fill solid border -1
set boxwidth 0.75
# We are plotting columns 2, 3 and 4 as y-values,
# the x-ticks are coming from column 1
plot 'stackedhisto.dat' using 2:xtic(1) \
,'' using 3 \
,'' using 4
When I execute the above code I get some error which I dont know the source is. The error is as below:
./script-plot-total-stacked-bar.gnu: line 25: syntax error near unexpected token `('
./script-plot-total-stacked-bar.gnu: line 25: `plot 'stackedhisto.dat' using 2:xtic(1) \'
This error preventing me from plotting my own data. I am using gnuplot 4.6 in Ubuntu 11.10. Appreciate any help in advance. Thanks
note : In fact this is published at 1.