Hi,
I wanted to calculate the margins after a plot command. The right margin should be GPVAL_TERM_XMAX/(1.0*GPVAL_TERM_XSIZE).
But that works only for a few terminals, others have an internal oversampling, which gets included in e.g. GPVAL_TERM_XMAX, but not in e.g. GPVAL_TERM_XSIZE:
set terminal wxt
plot sin(x)
print sprintf('right margin at screen %f', GPVAL_TERM_XMAX/(1.0*GPVAL_TERM_XSIZE))
set terminal pdfcairo
set output '/dev/null'
plot sin(x)
print sprintf('right margin at screen %f', GPVAL_TERM_XMAX/(1.0*GPVAL_TERM_XSIZE))
That prints:
right margin at screen 0.962422
right margin at screen 0.047778
Tested with 4.6.0 and 4.7 (2013-09-23).
Would it be ok to scale GPVAL_TERM_XSIZE also by this oversampling factor, or would it break something?
Thanks,
Christoph
As of today, 4.6 and 5.0 both report the current terminal scale factor in GPVAL_TERM_SCALE.
So right margin in fractional coordinates is
GPVAL_TERM_XMAX * GPVAL_TERM_SCALE * 1.0 / GPVAL_TERM_XSIZE
Last edit: Ethan Merritt 2014-07-30
Great, thank you for adding this. I attached a small patch to include the
GPVAL_TERM_SCALEin an example in the docs.