#1212 incorrectly estimating key size in some terminals

closed-invalid
nobody
None
5
2015-03-23
2013-02-21
Andrew Rasmussen
No

gnuplot 4.7.0 (CVS version as of 2013-02-20)
Arch Linux 32-bit

In some terminals gnuplot appears to be estimating the key size incorrectly: longer titles lead to proportionally too-long keys. This causes the result of a

set key tmargin left

command to be different from what is expected. Where one would expect the key to be at the left, it appears more toward the middle of the plot (because gnuplot incorrectly estimates the text width?).

I noticed this in the epslatex and png terminals, though with the postscript terminal gnuplot seems to get the key size correctly.

It is somewhat better (but not perfect) when I use a monospaced font such as Courier.

Attached and quoted below is a plot script which demonstrates the problem.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env gnuplot

reset

# key size looks fine with postscript terminal
#set terminal postscript enhanced color
#set output 'test.eps'

# key size has problems with epslatex terminal, but png is simpler example
#set terminal epslatex
#set output 'test.tex'

set terminal png
set output 'test.png'

set key tmargin left box
set style data linespoints

set multiplot layout 5,1
plot 'data.dat' u ($0):1 title 'longtitle'
plot 'data.dat' u ($0):1 title 'reallylongtitle'
plot 'data.dat' u ($0):1 title 'reallyreallylongtitle'
set key tmargin left box reverse
replot
set key tmargin left Left box reverse
replot
unset multiplot
1 Attachments

Discussion

  • Here is the output of the script.

     
    Attachments
  • ...and the example data file, which is actually unnecessary (replacing "plot 'data.dat'" with "plot x" still demonstrates the problem.

     
    Attachments
  • Ethan Merritt
    Ethan Merritt
    2013-02-21

    Gnuplot does not know anything about fonts, so I think your example shows that it manages to do a pretty decent job at guessing.

    Anyhow, this is a "cannot fix" item, particularly in the case of PostScript, where the font may be known only to the eventually printer or print system.

     
  • Ethan Merritt
    Ethan Merritt
    2013-02-21

    • status: open --> open-invalid
     
  • Ethan Merritt
    Ethan Merritt
    2013-05-27

    • status: open-invalid --> closed-invalid