Back to demo index

gnuplot demo script: custom_key.dem

autogenerated by webify.pl on Sat Mar 11 15:38:25 2023
gnuplot version gnuplot 5.4 patchlevel 7alpha
#
# Illustrate custom placement of individual plot titles outside the key box
#
set style data boxes
set style fill solid border
set boxwidth 0.5
set datafile missing '-'
set yrange [0:*]
unset ytics
unset xtics
set xrange [-0.5:7.5]
set offset 0,0,graph .1,0

set label 1 at screen 0.75, screen 0.22 "{/:Bold Custom combined key area}" center
set key autotitle columnhead nobox title "  "
set multiplot layout 3,2 columnsfirst \
              title "{/:Bold Illustrate use of a custom key area}" \
              margins 0.05, 0.95, 0.05, 0.90 spacing 0.0, 0.0

plot 'immigration.dat' using 0:6   lt 1 title at 0.75, 0.18
plot 'immigration.dat' using 0:12  lt 2 title at 0.75, 0.15
plot 'immigration.dat' using 0:13  lt 3 title at 0.75, 0.12
plot 'immigration.dat' using 0:14  lt 4 title at 0.75, 0.09
set xtics scale 0 font ",8"

plot 'immigration.dat' using 0:($6+$12+$13+$14):xtic(strcol(1)[6:]) with linespoints \
                                   lt black pt 7 title "total"

unset multi

if (exists("MANUAL_FIGURES")) exit

Click here for minimal script to generate this plot




#
# Use of `keyentry` to construct a key
# ====================================
#
set title "{/:Bold Construct key from custom entries}"
set tics scale 0
unset xtics
set xrange  [-0.5:4.5]
set x2range [-0.5:4.5]
set yrange  [3.5:-0.5]
set x2tics ("A" 0, "B" 1, "C" 2, "D" 3, "E" 4)
set ytics  0,1
set palette rgbform -7,2,-7
unset colorbox
set style fill solid border lc "black"
set key outside right center reverse Left samplen 1
set key title "{/:Bold        Outcomes}" left

$HEATMAP << EOD
5 4 3 1 0
2 2 0 0 1
0 0 0 1 0
0 1 4 1 3
EOD

plot $HEATMAP matrix with image pixels notitle, \
    keyentry with boxes fc palette cb 0 title "no effect", \
    keyentry with boxes fc palette cb 1 title "threshold", \
    keyentry with boxes fc palette cb 3 title "typical range", \
    keyentry with labels title "as reported in [12]", \
    keyentry with boxes fc palette cb 5 title "strong effect"


Click here for minimal script to generate this plot