Reputation: 1403
I have a series of gnuplot scripts which I have developed using the default 'qt' terminal on my OS X system. This has the convenient feature of closing the closing the qt window when the script completes, so I added:
pause mouse "mouse button 2 or 3 to close\n";
Later in development I want to output to pdf, but now the pause hangs my command line terminal until I hit return. I wanted to do:
set terminal pdf
...
if (terminal eq qt) pause mouse "mouse button 2 or 3 to close\n";
but this gives me:
line 45: undefined variable: terminal
I now have a workaround of setting a different variable and setting the terminal from it:
term = 'qt'
if (term eq 'pdf') set terminal pdf ; set output 'rToR.pdf'
...
if (term eq 'qt') pause mouse "mouse button 2 or 3 to close\n";
which may be arguably better for some code design aspects, but requires a layer of redundancy and isn't actually what I want to do.
Therefore, is there way to / how do I access the value of a gnuplot setting like 'terminal'?
Upvotes: 2
Views: 522
Reputation: 48420
See show variables all
for a list of available variables. In your case you need GPVAL_TERM
:
if (GPVAL_TERM eq 'qt') { ... }
if (GPVAL_TERM eq 'pdfcairo') { ... }
With set terminal pdf
usually, the pdfcairo
terminal is selected, so you need the string 'pdfcairo'
for the comparison.
Upvotes: 1