Putting a box around the legend
This recipe is a simple modification of the previous one, but gets its own section because the legend in the box is such a popular style (for better or worse).
How to do it…
Replace the highlighted set key
command in the previous recipe with the following two commands:
set key spacing 3 font "Helvetica, 14"
set key box lt -1 lw 2
How it works…
The new command is in the second line. set key box
tells gnuplot to draw a box around the legend; this is followed by two specifications for the type of line from which the box will be drawn. In the previous command, we have used abbreviations: lt
stands for linetype, and a linetype of -1 yields a solid black line in the PostScript terminal. lw
stands for linewidth; lw 2
is one step up from the default lw 1
, and makes the box more prominent.