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

Home » Public Forums » archive » Re: Change default value of system variable?
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: Change default value of system variable? [message #23825] Fri, 23 February 2001 16:43 Go to next message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <230220011054580017%k-bowman@null.tamu.edu>, K. Bowman
<k-bowman@null.tamu.edu> wrote:

> Is there any way to
> change the default value of a built-in system variable?

Begin Rant-in-Jest

Thanks for nothin' everybody! I *know* I can set the stupid background
and foreground colors explicitly! I'm not a newbie! All I want to do
is set the stinkin' program so that whenever I pop up a window, even if
I'm just doodlin' around at the command prompt, it doesn't default to
that ugly white on black thing. Black on white is so 1970's! I mean,
come on, is that too much to ask! I know there is a default value
hidden in there somewhere, RSI. Why won't you let me screw with it?
Jeez, I guess I'll have to switch to Python or some other such *modern*
thingy.

(In civilized newsgroups I'd be embarassed about responding to my own
post, but everyone else in this group does it too. So there.)

End Rant-in-Jest

Ken
Re: Change default value of system variable? [message #23835 is a reply to message #23825] Fri, 23 February 2001 11:56 Go to previous messageGo to next message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
Craig Markwardt wrote:
>
> "K. Bowman" <k-bowman@null.tamu.edu> writes:
>> I prefer to plot with black lines on a white background, so in my
>> idl_startup file I include
>>
>> !P.BACKGROUND = COLOR_24('white') ;Set background color to white
>> !P.COLOR = COLOR_24('black') ;Set default draw color to black
>>
>> (COLOR_24 is my own routine.)
>>
>> This works fine until I change plot devices and then change back, viz.
> ... deleted ...
>>
>> This means that I have to include code to set !P.BACKGROUND and
>> !P.COLOR in every time I switch graphics devices. Is there any way to
>> change the default value of a built-in system variable?
>
> You could simply save and restore the entire !P variable, right?
>
> old_p = !p
> set_plot, 'ps'
> ...
> set_plot, 'x'
> !p = old_p

I do this (relatively) religiously. Haven't ever had any problems (as long as the code
doesn't crash or I don't Ctrl-C before the restoration statement).

> and you have the satisfaction
> that you didn't miss any stray graphics keywords by accident.

exact-o-moe

paulv

--
Paul van Delst A little learning is a dangerous thing;
CIMSS @ NOAA/NCEP Drink deep, or taste not the Pierian spring;
Ph: (301)763-8000 x7274 There shallow draughts intoxicate the brain,
Fax:(301)763-8545 And drinking largely sobers us again.
pvandelst@ncep.noaa.gov Alexander Pope.
Re: Change default value of system variable? [message #23837 is a reply to message #23835] Fri, 23 February 2001 11:14 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"K. Bowman" <k-bowman@null.tamu.edu> writes:
> I prefer to plot with black lines on a white background, so in my
> idl_startup file I include
>
> !P.BACKGROUND = COLOR_24('white') ;Set background color to white
> !P.COLOR = COLOR_24('black') ;Set default draw color to black
>
> (COLOR_24 is my own routine.)
>
> This works fine until I change plot devices and then change back, viz.
... deleted ...
>
> This means that I have to include code to set !P.BACKGROUND and
> !P.COLOR in every time I switch graphics devices. Is there any way to
> change the default value of a built-in system variable?

You could simply save and restore the entire !P variable, right?

old_p = !p
set_plot, 'ps'
...
set_plot, 'x'
!p = old_p

This probably wouldn't be much better to type on the command line, but
it would be pretty nice for programming, and you have the satisfaction
that you didn't miss any stray graphics keywords by accident.

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: Change default value of system variable? [message #23839 is a reply to message #23837] Fri, 23 February 2001 10:00 Go to previous messageGo to next message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
"K. Bowman" wrote:
>
> I prefer to plot with black lines on a white background, so in my
> idl_startup file I include
>
> !P.BACKGROUND = COLOR_24('white') ;Set background color to white
> !P.COLOR = COLOR_24('black') ;Set default draw color to black
>
> (COLOR_24 is my own routine.)
>
> This works fine until I change plot devices and then change back, viz.
>
> flow>idl
> IDL Version 5.3 (IRIX mipseb). (c) 1999, Research Systems, Inc.
> IDL> PRINT, !P.BACKGROUND, !P.COLOR
> 16777215 0
> IDL> SET_PLOT, 'PS'
> IDL> SET_PLOT, 'X'
> IDL> PRINT, !P.BACKGROUND, !P.COLOR
> 0 255
>
> This means that I have to include code to set !P.BACKGROUND and
> !P.COLOR in every time I switch graphics devices. Is there any way to
> change the default value of a built-in system variable?
>
> Thanks, Ken


Run IDL with dbx and try to find the place where !P.Background is set.
This may be a little cumbersome without the IDL sources, but after
about 5 years you may have found the solution ;-)

Now, honestly, I would recommend to follow David's advice to ALWAYS
set colors before issuing any plot command.

Cheers,

Martin

PS: Todd - still have a note lying on my desk to send you this object
file stuff. Just want to give it a few comments before sending it
(otherwise you'd be lost right away). Maybe in a couple of days...

--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
Re: Change default value of system variable? [message #23840 is a reply to message #23839] Fri, 23 February 2001 09:21 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
David Fanning (davidf@dfanning.com) writes:

> Uh, use somebody else's routine:
>
> !P.Background = FSC_Color("white", !P.Background)
> !P.Color = FSC_Color("black", !P.Color)
>
> That will work correctly *everywhere*. :-)

Whoops! Now that I think about it (my brain is
still sluggish from all the percussive noise the
past couple of days) I don't think this will solve
your problem. Let me think about this some.

Actually, my rule of thumb for *all* color
operations is to always load the colors before
you draw the graphics. That is really the only
reliable way to be sure your graphic will be
displayed with the proper colors. Certainly
the two lines of code I mentioned will work
correctly if executed immediately prior to any
graphic operation. But I see now you were asking
a different question.

Sorry. I'm going back to bed after I apply a
little more liniment.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Change default value of system variable? [message #23841 is a reply to message #23840] Fri, 23 February 2001 09:11 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
K. Bowman (k-bowman@null.tamu.edu) writes:

> I prefer to plot with black lines on a white background, so in my
> idl_startup file I include
>
> !P.BACKGROUND = COLOR_24('white') ;Set background color to white
> !P.COLOR = COLOR_24('black') ;Set default draw color to black
>
> (COLOR_24 is my own routine.)
>
> This works fine until I change plot devices and then change back, viz.
>
> flow>idl
> IDL Version 5.3 (IRIX mipseb). (c) 1999, Research Systems, Inc.
> IDL> PRINT, !P.BACKGROUND, !P.COLOR
> 16777215 0
> IDL> SET_PLOT, 'PS'
> IDL> SET_PLOT, 'X'
> IDL> PRINT, !P.BACKGROUND, !P.COLOR
> 0 255
>
> This means that I have to include code to set !P.BACKGROUND and
> !P.COLOR in every time I switch graphics devices. Is there any way to
> change the default value of a built-in system variable?

Uh, use somebody else's routine:

!P.Background = FSC_Color("white", !P.Background)
!P.Color = FSC_Color("black", !P.Color)

That will work correctly *everywhere*. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Change default value of system variable? [message #23912 is a reply to message #23825] Mon, 26 February 2001 07:45 Go to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
"Kenneth P. Bowman" wrote:
> Thanks for nothin' everybody! I *know* I can set the stupid background
> and foreground colors explicitly! I'm not a newbie! All I want to do
> is set the stinkin' program so that whenever I pop up a window, even if
> I'm just doodlin' around at the command prompt, it doesn't default to
> that ugly white on black thing.

How about including this in your startup file:

tvlct, 255B, 255B, 255B, 0
tvlct, 0B, 0B, 0B, !d.table_size - 1
device, decomposed=0

You should get black on a white background by default:

plot, indgen(10)

Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
Re: Change default value of system variable? [message #23924 is a reply to message #23825] Fri, 23 February 2001 18:43 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Kenneth P. Bowman (kbowman@null.net) writes:

> I know there is a default value
> hidden in there somewhere, RSI. Why won't you let me screw with it?

I'm not so sure. If IDL was smart enough to have
defaults, why would it change as you switch from one
device to another? And if it had sensible defaults,
why would it want us mucking around every 2 minutes
with the Device, Decomposed value? I think there must
be something fundamentally screwy in the internals
that make this whole business hard. Why else would
they make us use IDL to solve it?

Cheers,

David

P.S. Let's just say this post reminds me of Pablo
Neruda's wonderful book of poems, The Book of Questions:

Does the drop of metal shine
like a syllable in my song?

Does a word sometimes
slither like a serpent?

Didn't a name like an orange
creep into your heart?

From which river do fish come?
From the word *silversmithing*?

When they stow too many vowels
don't sailing ships wreck?

Pablo Neruda

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: !EXCEPT
Next Topic: Re: reading files with date- and time - columns

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

Current Time: Wed Oct 08 15:13:03 PDT 2025

Total time taken to generate the page: 0.00633 seconds