|
From: Allin C. <cot...@wf...> - 2012-10-11 23:43:12
|
On Thu, 11 Oct 2012, Ethan A Merritt wrote: > On Thursday, October 11, 2012 04:13:55 pm Ethan A Merritt wrote: >> On Thursday, October 11, 2012 12:42:22 pm Allin Cottrell wrote: >>> I'm comparing the output of gnuplot's svg and pngcairo >>> drivers, with a thought of making greater use of SVG. But >>> there seems to be a slight problem with the placement of key >>> text in the SVG output. Here's a little test script >>> >>> set term svg font "Sans,8" size 680,400 >>> set output 'test.svg' >>> set key left top >>> plot sin(x) title "PRIME" w l, \ >>> cos(x) title "UNEMP" w l >>> set term pngcairo font "Sans,8" size 680,400 >>> set output 'test.png' >>> replot >>> >>> In the PNG version the key is just fine, but in SVG the "U" of >>> "UNEMP" gets tangled up with the y-axis (more or less, >>> depending on the magnification). >> >> The underlying issue is that for SVG, like PostScript, gnuplot has >> to guess at the font properties for a font that will not actually >> be selected until the file is later viewed in another program. > > By the way, if you turn on the "box" attribute of the key you can > see that the key box itself is properly placed. The problem is that in > your case the width of the box is too small because the size of the text > was underestimated. > > As a work-around, you could use "set key left Left". > That anchors the left end of the text rather than the right end, > so it is not at risk of overwriting the left plot border. > Instead the right end of the text might run into the line sample ;-) Ah, that's a nice suggestion. I can manipulate the key placement so as to try to avoid colliding with the plot lines, just so long as I'm reasonably confident it won't collide with the axes. But on the more general point, does this mean I might have better luck if a specified the font more precisely than just "Sans"? Allin Cottrell |