|
From: Mojca M. <moj...@gm...> - 2006-08-21 21:17:46
|
Hello,
1.)
is there a way to get the default terminal settings? Postscript
terminal provides an option "default", but most terminals don't
(metapost terminal sets everything back to default values without
asking for it which is probably against the main phylosophy of how
terminals should work, but that's another topic which I don't intend
to discuss here).
I would like to write a longer gnuplot script with multiple changes of
terminal type and output file. The input will be provided from outside
(from other users, so I can't assume anything about it in advance).
The most safe way would be to write a single script for each input
(which is what is done now), but that influences efficiency
considerably (think of calling gnuplot 30 times versus calling gnuplot
only once with 30 plot commands and perhaps a few changes of the
terminal and output file inbetween).
Example:
the user selects PNG terminal and wants the first figure to be
transparent and the second one to use "default" values (whatever they
are, notransparent in that case).
first plot:
********
terminal: png
additional options: transparent
script: plot sin(x)
second plot:
********
terminal: png
additional options: -
script: plot sin(x)
The first approach would be to write two scripts, while the "efficient
one" would be to do something like this:
set term png transparent
set output 'p001.png'
set title 'first plot'
plot sin(x)
reset
# how to get the default terminal settings again?
set term png
set output 'p002.png'
plot sin(x)
"reset" is very handy, but I'm looking for a similar thing for
terminal settings as well.
In the worst case I can still warn the user that it's his own fault if
he wants to do such obscure things and that it's his own
responsibility to set the things back as they were. Or I can leave the
inefficient version there, but I would be very happy if there was some
"magic reset switch" for terminal settings as well. (There's only one
thing I'm sure about: I don't want to parse options in that program to
set them back to defaults.)
2.)
What is the main phylosophy behind terminals. Is a sentence like
set terminal post color monochrome
allowed? Well, the above is not, but for example
set term png notransparent transparent
doesn't complain. I prefer the later, since I don't have to worry then
if I set some settings which I consider to be default for my purpose
(for example "set term post color") and simply append user-provided
ones to the end of the string (if user wants portrait, the command
would become "set term post color portrait", if the user wants
monochrome, the command would become "set term post color monochrome",
but that doesn't work).
OK, I know, I can do it in two steps. I can first apply my own
defaults and then user-provided ones (wouldn't work with metapost, but
then again: I don't care about metapost terminal too much).
There are some work-arounds, but life would be much easier if
behaviour would be more consistent accross terminals. (I see no reason
why someone would make a restriction that an option may not be
specified more than once.)
Thank you very much for any answer,
Mojca
|