Currently I working on Gnulot stacked filledcurves. I have problem to make my graphs stacked. This is my data:
prog reli perf avail sec cons topo scale qos
2011 138 90.3 21.0 63.5 45.5 48.5 6.8 4.0 5.5
2012 191.3 77.8 90.8 30.8 29.0 22.1 2.0 1.0 1.0
2013 85.0 57.5 48.0 20.0 27.5 8.5 0 2.5 1.0
2014 2.0 0.5 1.0 2.0 1.0 1.5 0 0 0
I have plotted on t1.plt
set term pos eps font 20
set output 't1.eps'
set pointsize 0.8
set border 11
set xtics out
set tics front
set key below
set multiplot
a=0
plot for [i=1:9] "t1" using (column(i)):xtic(1) t column(i) with filledcurves
my current output:
my expectation to create graphs like this link:
Here is how you can do this with gnuplot only. You can use the sum
command for the summation of the column values in order to get a stacked graph:
set terminal postscript eps color font 20
set output 't1.eps'
set xtics 1 out
set tics front
set key invert
set style fill solid noborder
plot for [i=10:2:-1] "t1" using 1:(sum [col=2:i] column(col)) with filledcurves x1 title columnheader(i-1)
Note, that the indices for the column headers are 1..9, whereas the values go from 2..10. So you must explicitely use title columnheader(i-1)
. If you would give the first column also a header, e.g. year
, you could use set key autotitle columnheader
.
Unfortunately, the invert
option of set key
works only on the columns. So if you use set key below invert
, you don't get the original order of your data file.
Result with 4.6.4: