lukmac
lukmac

Reputation: 4841

gnuplot - regarding legend: how to set the box at middle and set the box size

Default positions are: top, bottom, left, right, etc - but no "middle". When I use

set key top

The legend is placed at top right, by default. How to position it at "top middle"?

Besides, when I add a frame to the legend box, can I control the width of the box? I need this because sometimes the frame cut the text in the legend.

Upvotes: 1

Views: 13534

Answers (2)

andyras
andyras

Reputation: 15930

To answer your first question, there is a center option instead of middle:

set key top center

To change the width of the box, try

set key width 10

(or some other number) and see if that helps. If that does not help, can you post a minimal code example? You can also try

help set key

in gnuplot for more details about all the options available.

Upvotes: 4

Jari Laamanen
Jari Laamanen

Reputation: 2647

Instead of middle, use center. You can find this instruction in gnuplot by using help

gnuplot> help key
 The `set key` command enables a key (or legend) describing plots on a plot. 
 [...]
 Syntax:
       set key {on|off} {default}
                     [...]
                    {left | right | center} {top | bottom | center}

All the other answers are also provided in this help.

Upvotes: 3

Related Questions