As the title suggests I want to place the plot legend below a multiplot graph. I add the legend for just one of the plots because the line styles are the same for all. The problem I encounter is that, if I add the key by set key below
, the plots themselves get resized as to fit the (large) key inside the canvas. I would rather want to maintain the size of the plots. I tried adding the key as additional plot in the multiplot with set key inside
, but then the key can overlap the plots if it is too large. I am using the epslatex terminal.
Place key below multiplot graph in gnuplot
gnuplot
Best Answer
Here is a way to do it with some functions to help adjust the positions of the margins in the plot:
Here is the result:
The things you have to adjust manually are the number of plots and the size of the bottom margin, which is where the key gets drawn. The comments generally say where you have to change things.
I put the key in a plot by itself so that it would be easy to keep the sizes of the other plots the exact same. Plotting the number 2 when the y range is 0 to 1 keeps the lines from showing in the key plot.
This is mostly based on my answer here, which is why I have the plots all touching. You can adjust the top() and bot() functions with an additional margin parameter if you want a gap between the plots.