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).

Putting a box around the legend

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 ...

Get gnuplot Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.