comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: WIN device color and backgnd reset after set_plot command
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: WIN device color and backgnd reset after set_plot command [message #47068] Sat, 21 January 2006 22:33 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
guillaume.drolet.1@ulaval.ca writes:

> I'm sorry but I forgot to mention an important thing: I use the 24-bit
> default display (or 16 million colors) so the colors I'm using are
> !p.color = 0 and !p.background = 16777215. Based on your suggestion,
> what colors should I use instead? Or maybe should I switch to the 8-bit
> display mode ?

I'd use FSC_Color. It works in 8-bit or 24-bit
mode without having to do anything different. Don't
under ANY circumstances switch to 8-bit display mode.
Do you know how long it has taken me to get you as
my only convert! :-)

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 #47069 is a reply to message #47068] Sat, 21 January 2006 21:40 Go to previous messageGo to next message
guillaume.drolet.1 is currently offline  guillaume.drolet.1
Messages: 20
Registered: July 2005
Junior Member
Thanks David.

I'm sorry but I forgot to mention an important thing: I use the 24-bit
default display (or 16 million colors) so the colors I'm using are
!p.color = 0 and !p.background = 16777215. Based on your suggestion,
what colors should I use instead? Or maybe should I switch to the 8-bit
display mode ?

Gui
Re: WIN device color and backgnd reset after set_plot command [message #47070 is a reply to message #47069] Sat, 21 January 2006 21:21 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
guillaume.drolet.1@ulaval.ca writes:

> 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?

Yes, don't use indices 0 and 255 for *anything*, and
always use a white background color for your WIN device.
Then everything will work *perfectly*. :-)

!P.Background = 254
!P.Color = 253
TVLCT, 255, 255, 255, 254 ; White.
TVLCT, 0, 0, 128, 253 ; Navy blue.
Device, Decomposed=0

Then, like this:

Plot, findgen(11)
thisDev = !D.Name
Set_Plot, 'ps'
Device, /Color, Bits=8
Plot, findgen(11)
Device, /Close
Set_Plot, thisDev

PS file looks like the display, and visa versa. :-)

And, possibly, if you *really* want to do this correctly,
use FSC_COLOR to specify your colors. In other words,

PLOT, findgen(11), Color=FSC_Color('Navy'), $
Background=FSC_Color('white')

always works, too. And you don't have to muck around with
!P.Color, etc.

http://www.dfanning.com/programs/fsc_color.pro

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 #47188 is a reply to message #47068] Wed, 25 January 2006 22:13 Go to previous message
guillaume.drolet.1 is currently offline  guillaume.drolet.1
Messages: 20
Registered: July 2005
Junior Member
Hi !

I edited my startup script like this (as David's suggest):

!p.background = fsc_color('white')
!p.color = fsc_color('Navy')

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.

Thanks, Gui
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: 2D density plot *** hist_2d *** LARGE ARRAYS
Next Topic: Extract a sub-structure from a structure

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 07:01:38 PDT 2025

Total time taken to generate the page: 0.08293 seconds