Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnuplot: add key outside plot without resizing plot

In gnuplot, I can put the key outside the plots using this command:

set key outside;
set key right top;

But as this page indicates, the placement of the key will automatically resize the plot area such that the size of the resulting image remains the same. Is there an easy way of keeping the plot area the same no matter where I place the key outside the plot area?

like image 897
Alan Turing Avatar asked Dec 09 '12 15:12

Alan Turing


People also ask

How to set key outside in gnuplot?

What you need to do is first make room for the key by shrinking the plot horizontally, say by "set size . 75, 1". Then position the key manually. Rather than saying "set key outside", try "set key at x,y", where x and y are in your axes units.

How to position key in gnuplot?

By default the key is placed in the upper right inside corner of the graph. The keywords left, right, top, bottom, center, inside, outside, lmargin, rmargin, tmargin, bmargin (, above, over, below and under) may be used to automatically place the key in other positions of the graph.

What is Multiplot gnuplot?

The command set multiplot places gnuplot in the multiplot mode, in which several plots are placed on the same page, window, or screen.

Is gnuplot easy?

gnuplot is a not-quite-as-easy-to use, though extremely powerful, command-line plotting program. Running gnuplot is easy: from a command prompt on any system, type gnuplot. It is even possible to do this over a telnet or ssh connection, and preview the graphs in text mode!


1 Answers

The size of the plot in units of the canvas size is set with the "set size" command. But the key is considered part of the plot, so the actual graph will always shrink when you use "set key outside", so that the graph + key obey the size that you set with "set size".

What you need to do is first make room for the key by shrinking the plot horizontally, say by "set size .75, 1". Then position the key manually. Rather than saying "set key outside", try "set key at x,y", where x and y are in your axes units. The value of x will be some margin + key length + x-axis length, and the value of y will be somewhat less than the top of your y-axis. You will want to experiment a little to get the placement that you like, but you will find that the graph size does not change as you move the key around using this command.

like image 144
Lee Phillips Avatar answered Sep 20 '22 09:09

Lee Phillips