#!/usr/local/bin/gnuplot -persist # set terminal svg size 600,400 dynamic enhanced font 'arial,10' mousing name "label_stacked_histograms_1" butt dashlength 1.0 # set output 'label_stacked_histograms.1.svg' set border 2 front lt black linewidth 1.000 dashtype solid set boxwidth 0.6 absolute set style fill solid 1.00 border lt -1 set key fixed right bottom vertical Right noreverse enhanced autotitle nobox set style histogram columnstacked title textcolor lt -1 set style data histograms set xtics border in scale 1,0.5 nomirror norotate autojustify set xtics norangelimit set xtics () set ytics border in scale 1,0.5 nomirror norotate autojustify set cbtics border in scale 1,0.5 nomirror norotate autojustify set title "Place data values as labels in stacked histogram" set title offset character 0, -1, 0 font "" textcolor lt -1 norotate set xrange [ -0.500000 : * ] noreverse writeback set x2range [ * : * ] noreverse writeback set yrange [ * : * ] noreverse writeback set y2range [ * : * ] noreverse writeback set zrange [ * : * ] noreverse writeback set cbrange [ * : * ] noreverse writeback set rrange [ * : * ] noreverse writeback set colorbox vertical origin screen 0.9, 0.2 size screen 0.05, 0.6 front noinvert bdefault XShift(n) = (n < YminSpace) ? 0.45 : 0 YShift(n) = (n < YminSpace) ? (YExtraDistance=YExtraDistance+YStep,YExtraDistance) : (YExtraDistance=-YStep,0) NO_ANIMATION = 1 YminSpace = 4 YStep = 2 YExtraDistance = -2 ysum = 90.1 ## Last datafile plotted: "$Data" plot newhistogram lt 9, $Data u 2 ti col , '' u 3:key(1) ti col, ysum=0 '' skip 1 using (0+XShift($2)):((ysum = ysum + $2, ysum-$2/2+YShift($2))):2 with labels notitle, ysum=0 '' skip 1 using (1+XShift($3)):((ysum = ysum + $3, ysum-$3/2+YShift($3))):3 with labels notitle, ysum=0 '' skip 1 using ($2>YminSpace ? 1/0:(0+XShift($2)-0.05)):((ysum = ysum + $2, ysum-$2/2+YShift($2))):(-0.1):(-YExtraDistance) ls -1 with vectors not, ysum=0 '' skip 1 using ($3>YminSpace ? 1/0:(1+XShift($3)-0.05)):((ysum = ysum + $3, ysum-$3/2+YShift($3))):(-0.1):(-YExtraDistance) ls -1 with vectors not,