Search code examples
gnuplot

Legend Box Size


The following code produce a box legend too large, how could I fix it? enter image description here

set terminal epslatex standalone color size 4.0in,3.0in background rgb "white" font "Helvetica,10" header '\usepackage{amsmath,bm} \usepackage{amssymb}'

set output 'output.tex'

set key top right box
set key width 1
set key height 1

set lmargin at screen 0.15
set rmargin at screen 0.95
set tmargin at screen 0.95
set bmargin at screen 0.15


set xrange [0:6.28]
plot sin(x) title "$\\dot{m}_{max, \\, EFT}$"

Solution

  • Sometimes gnuplot cannot estimate the place needed for a string accurately enough. You already use the set key width command, try it with a negative width.

    set key width -3
    

    Result:

    image with narrow key box

    From the help set key documentation:

    When using the TeX/LaTeX group of terminals or terminals in which formatting information is embedded in the string, gnuplot can only estimate the width of the string for key positioning.