In gnuplot
, I used the horizontal key, but it shows me vertical on the output screen. I tried every alternative but found difficult to do that.
set
You can force the legend to consist of a single row by specifying set key vertical maxrows 1
:
set xlabel "X-Axis"
set ylabel "Y-Axis"
set multiplot layout 2,3
set key at screen 0.5, 0.40 center vertical height 1 box maxrows 1
set title "1st"
set xrange [0:20]
plot tan((pi/180)*x) title "Analytical" w l ls 1,\
tan(2*(pi/180)*x) title "Observed" w lp ls 2,\
tan(3*(pi/180)*x) title "Experimental" w lp ls 3
set title "2nd"
set xrange [0:20]
plot tan((pi/180)*x) title "Analytical" w l ls 1,\
tan(2*(pi/180)*x) title "Observed" w lp ls 2,\
tan(3*(pi/180)*x) title "Experimental" w lp ls 3
set title "3rd"
set xrange [0:20]
plot tan((pi/180)*x) title "Analytical" w l ls 1,\
tan(2*(pi/180)*x) title "Observed" w lp ls 2,\
tan(3*(pi/180)*x) title "Experimental" w lp ls 3
unset multiplot
Each of your 3 plots generates a separate key. The multiplot layout places all 3 plots on the same page, but still each one is only 1/3 of the page in width and that sets the maximum horizontal size of its key. In the example you re-position each key to the same place at the bottom of the page so that they lie exactly on top of each other. This does not change their size or shape, only their position.
What you can do instead is to manually place each title on the page without reference to the auto-generated key. In order to leave room for the manually placed key entries you can give explicit multiplot layout margins.
set multiplot layout 1,3 margins .1, .9, .3, .9
set key
plot tan((pi/180)*x) title "Analytical" at screen .25,.1 w l ls 1,\
tan(2*(pi/180)*x) title "Observed" at screen .50,.1 w lp ls 2 ,\
tan(3*(pi/180)*x) title "Experimental" at screen .75,.1 w lp ls 3
unset key
plot ...
plot ...
unset multiplot
Placing a box around the manually positioned titles is a separate question.