I am having difficulty with the alignment of the different key titles when placed horizontally, apparently due to the differing lengths in the titles.
Having two short plot titles (1st and 4th) and two longer titles (2nd and 3rd) it leaves a larger gap between the final two titles (presumably as it is setting the gaps between them all by the same maximum string length). I have searched but found no way to alter this.
A simplified example is shown below. Any suggestions or help would be greatly appreciated.
set terminal postscript eps size 5.12,2.3 enhanced color "Helvetica" 12
set output 'example.eps'
set title 'Difficulty of Long and Short Title usage in Horizontal Keys' font "Helvetica, 20"
set key inside bottom center horizontal font "Helvetica, 20" width 1.8
set ylabel 'ylabel' font "Helvetica, 20"
set xlabel 'xlabel' font "Helvetica, 20"
set lmargin screen 0.10
set rmargin screen 0.95
set yrange [-1.5:1.5]
plot sin(x) title 'short', \
cos(x) title 'long title 1', \
-0.5 title 'long title 2', \
0.5 title 'short' w l ls 4
The result is:
One possible workaround for this would be to generate the first three graphs and the last one with two different plot commands in multiplot
mode:
set terminal postscript eps size 5.12,2.3 enhanced color "Helvetica" 12
set output 'example.eps'
set title 'Difficulty of Long and Short Title usage in Horizontal Keys' font "Helvetica, 20"
set ylabel 'ylabel' font "Helvetica, 20"
set xlabel 'xlabel' font "Helvetica, 20"
set lmargin screen 0.10
set rmargin screen 0.95
set yrange [-1.5:1.5]
set bmargin screen 0.15
set tmargin screen 0.9
set multiplot
set key horizontal font "Helvetica, 20" width 1.8 at graph 0.4, graph 0.1 center maxrows 1
plot sin(x) title 'short', \
cos(x) title 'long title 1', \
-0.5 title 'long title 2'
unset title
unset xlabel
unset ylabel
unset border
unset tics
set key horizontal font "Helvetica, 20" width 1.8 at graph 0.84, graph 0.1 center maxrows 1
plot 0.5 title 'short' w l ls 4
unset multiplot
However, this requires some tweaking:
plot
you must remove title, labels, tics and border, otherwise the graph might look jagged because of different anti-aliasingtmargin
and bmargin
The above code gives you:
Now you must judge if its worth.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With