Re: Change default value of system variable? [message #23825] |
Fri, 23 February 2001 16:43  |
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 #23837 is a reply to message #23835] |
Fri, 23 February 2001 11:14   |
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   |
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 #23841 is a reply to message #23840] |
Fri, 23 February 2001 09:11   |
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  |
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  |
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
|
|
|