WIN device color and backgnd reset after set_plot command [message #47071] |
Sat, 21 January 2006 20:52  |
guillaume.drolet.1
Messages: 20 Registered: July 2005
|
Junior Member |
|
|
Dear group of IDL users--
I've been trying to find an answer to this question but unsuccessfully:
In my IDL start up script, I switch the default WIN device background
and color (!d.background & !d.color) to white and black, respectively.
However, when I write a Post Script file (set_plot, 'PS') and then get
back to the WIN device, the device background and color are resetted to
the default values.
Does anyone have any solution or trick for avoiding such a behavior?
Thank you.
Gui
|
|
|
|
|
Re: WIN device color and backgnd reset after set_plot command [message #47183 is a reply to message #47071] |
Thu, 26 January 2006 06:21  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paolo Grigis writes:
>> Why? I don't know why.
>
> Maybe to lower the toner consumption rate? It may have been
> implemented after the discovery of scientists printing
> tons of pages featuring white plots on black background,
> giving nightmares to the people in the budget department ;-)
Oh, I understand why they switched *that*. Have you ever
made the mistake of printing a page with a black background?
You can hardly pick the soggy mess up!
No, I was complaining about *always* setting the background
color index to 0 when they switch back, instead of keeping
track of what it was before and switching back to that.
This seems to me to be a simple programming error that has
persisted in IDL almost from the beginning of time.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: WIN device color and backgnd reset after set_plot command [message #47184 is a reply to message #47071] |
Thu, 26 January 2006 02:33  |
Paolo Grigis
Messages: 171 Registered: December 2003
|
Senior Member |
|
|
> [...]
>
> Well, this unhappiness is caused by the odd behavior
> of the PostScript device. It switches foreground and
> background colors, then completely ignores the background
> color. ("You can have any background color you like in PostScript
> as long as it is white.") Then, when it switches back, it
> mindlessly sets !P.Color to what had previously been
> !P.Background and sets !P.Background to 0.
>
> Why? I don't know why.
Maybe to lower the toner consumption rate? It may have been
implemented after the discovery of scientists printing
tons of pages featuring white plots on black background,
giving nightmares to the people in the budget department ;-)
Ciao,
Paolo
The gods decreed it at some
> time in the past and that's the way it is. Get used
> to it, is my advice. I think it falls under the
> category of "direct graphics", which I understand to
> read "hopeless". :-)
>
> Knowing this, of course, allows you to work around it.
> Most of us build "wrappers" that allow us to switch
> from our graphics device back to our display device,
> and visa versa. We change the thickness of plots, the
> fonts, and all of the myriad other things we have to
> tweak to work around this creaky system. Here is another
> thing to go in there.
>
> Cheers,
>
> David
>
>
|
|
|
Re: WIN device color and backgnd reset after set_plot command [message #47185 is a reply to message #47071] |
Thu, 26 January 2006 02:21  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> I think it falls under the
> category of "direct graphics", which I understand to
> read "hopeless". :-)
"Hopeless" is too strong a word, and emotionally laden,
to boot. Perhaps "unchanging" is a better choice and
more accurately reflects my understanding of the situation.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: WIN device color and backgnd reset after set_plot command [message #47186 is a reply to message #47071] |
Thu, 26 January 2006 01:56  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
guillaume.drolet.1@ulaval.ca writes:
> I edited my startup script like this (as David's suggest):
>
> !p.background = fsc_color('white')
> !p.color = fsc_color('Navy')
Uh, I don't remember any discussion about a
startup script. I was suggesting you do this
before you draw graphics in whatever device
you find yourself in. And *especially* you need
to do it if you switch from a 24-bit device to
an 8-bit device, and back, since colors are
represented differently in those environments.
I personally don't use these system variables
for ANY colors I care about, mostly for this
non-equivalence between devices. I try to load
my color tables *before* I draw graphics, and I
explicitly stay away from color indices 0 and
255, mostly because these are used by !P.Color
and !P.Background in this perverse way you are
discovering. :-)
> But the same thing keep happening when I switch from WIN to PS and then
> to WIN again: the plot background and color previously set in my
> startup script are resetted to IDL defaults (i.e. black background and
> white color, which I don't like).
>
> Since I usually plot long expressions, I don't to have to specify plot
> color and background every time I plot data after coming back PS device
> to WIN device.
>
> Again, any useful advice is welcome.
Well, this unhappiness is caused by the odd behavior
of the PostScript device. It switches foreground and
background colors, then completely ignores the background
color. ("You can have any background color you like in PostScript
as long as it is white.") Then, when it switches back, it
mindlessly sets !P.Color to what had previously been
!P.Background and sets !P.Background to 0.
Why? I don't know why. The gods decreed it at some
time in the past and that's the way it is. Get used
to it, is my advice. I think it falls under the
category of "direct graphics", which I understand to
read "hopeless". :-)
Knowing this, of course, allows you to work around it.
Most of us build "wrappers" that allow us to switch
from our graphics device back to our display device,
and visa versa. We change the thickness of plots, the
fonts, and all of the myriad other things we have to
tweak to work around this creaky system. Here is another
thing to go in there.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|