|
From: <pl...@pi...> - 2014-06-19 11:11:07
|
On 06/19/14 01:10, Jonathan Thornburg wrote:
>
> Philipp K. Janert wrote:
>> 3) Key position and offset
>> A very similar situation arises with the positioning
>> of the key. Frequently, I am happy with the automatic
>> positioning, but would like to adjust it slightly.
>>
>> I can see two solutions for that: one is that
>> show key
>> would display the actual position of the margin (so
>> that this position, when given to "set key at ..."
>> would reproduce the previous plot),
>
> Ethan A Merritt <sf...@us...> replied:
> : See above. These values can be retrieved from the GPVAL
> : variables.
>
>> What variables hold the key position? When I
>> do "show variables all", nothing seems appropriate.
>
> : I meant that you can position the key box relative to the plot
> : border by using, e.g.
> :
> : set key top right at graph 0.98, graph 0.98
>
> I've had the same problem as Philipp. It usually strikes when I'm
> using the postscript terminal, where gnuplot doesn't know the actual
> width of the plot key. I end up doing a fair bit of trial and error
> to determine either a "width" adjustment to, or an absolute position for,
> the plot key.
>
> An example might make this clearer: Consider the following two gnuplot
> scripts (which differ only in their "set key" lines & the names of their
> output files):
>
> --- BEGIN #1
> set term postscript eps enhanced color solid 14
> set output 'key-demo.eps'
>
> set key top left Left reverse samplen 2.5 spacing 1.333
>
> set xrange [0:10]
> set yrange [-1:1]
>
> plot (-sin(x)) title "10^6 {/Symbol \264 D} F_{/Symbol f} via Fourier series" \
> with lines linetype 1 linewidth 3.0 linecolor rgb "#00A000", \
> (-cos(x)) title "10^6 {/Symbol \264 D} F_t" \
> with lines linetype 1 linewidth 3.0 linecolor 3
>
> set output
> --- END #1
>
> --- BEGIN #2
> set term postscript eps enhanced color solid 14
> set output 'key-demo2.eps'
>
> # try to mimic the positioning of
> # set key top left Left reverse samplen 2.5 spacing 1.333
> set key at graph 0.45, graph 0.975 Left reverse samplen 2.5 spacing 1.333
>
> set xrange [0:10]
> set yrange [-1:1]
>
> plot (-sin(x)) title "10^6 {/Symbol \264 D} F_{/Symbol f} via Fourier series" \
> with lines linetype 1 linewidth 3.0 linecolor rgb "#00A000", \
> (-cos(x)) title "10^6 {/Symbol \264 D} F_t" \
> with lines linetype 1 linewidth 3.0 linecolor 3
>
> set output
> --- END #2
>
> These produce approximately the same output... but I had to find the
> numbers 0.45 and 0.975 in the second script by trial and error. Moreover,
> the 0.45 must be changed (found by a new round of trial-and-error) if
> I change label font, size, text length.
>
> You can see this if you try deleting the text "via Fourier series" from
> the label string. The automatically-placed label is still in the same
> place, but to get that place manually requires changing that 0.45 to
> something more like 0.20 (again determined by trial and error).
>
> What I (and I think also Philipp K. Janert) would like is a way to find
> those numbers 0.45 and 0.975 without trial and error, preferably in a
> way which doesn't require redoing if I change the label font, size, or
> text length.
>
> ciao,
>
Thanks for the example.
I've started a new thread where I suggest how this text placement
problem could be addressed, since I think the whole discussion about
margins is a work around for this core issue of text placement and extent.
Margins is not without merit as a discussion in the context of current
gnuplot and may have wider application, so I've split my comments as a
new thread discuss the underlying problem separately from the work around.
As I understand PS ( which I don't use much ) it relies on the fonts of
the host machine at the time it is printed, unless huge font information
is embedded in the PS file.
I suspect this will mean that this kind of careful hand tuning may come
unstuck when the PS plot is printed elsewhere than on the machine where
the manual optimisation was done.
If you are printing locally it should work fine.
Peter.
|