Change default value of system variable? [message #23844] |
Fri, 23 February 2001 08:54  |
K. Bowman
Messages: 330 Registered: May 2000
|
Senior Member |
|
|
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
|
|
|
Re: Change default value of system variable? [message #23909 is a reply to message #23844] |
Mon, 26 February 2001 10:47   |
R.G.S.
Messages: 46 Registered: September 2000
|
Member |
|
|
I do the same thing, and am constantly annoyed at the switching of
the defaults.
How about the following:
;****************************************
pro setplot,devicestring
; set the plot and save/restore the !p information
oldp = !p
set_plot,devicestring
!p=oldp
end
;****************************************
; Useage here
; mainlevel test code here
; HEY, specific numbers here, assuming 256 colours
!p.color = 0
!p.background = 255
window,0
erase ; on my comp, the screen starts out black
plot,findgen(10),tit='window first'
setplot,'ps'
plot,findgen(10),tit='ps'
device,/close
setplot,'win'
window,1
erase
plot,findgen(10),tit='window again'
end
Cheers,
bob stockwell
stockwel at co-ra dot com
K. Bowman <k-bowman@null.tamu.edu> wrote in message
news:230220011054580017%k-bowman@null.tamu.edu...
>
> I prefer to plot with black lines on a white background, so in my
> idl_startup file I include
|
|
|
Re: Change default value of system variable? [message #23910 is a reply to message #23844] |
Mon, 26 February 2001 08:38   |
Liam E. Gumley
Messages: 378 Registered: January 2000
|
Senior Member |
|
|
David Fanning wrote:
>
> Liam E. Gumley (Liam.Gumley@ssec.wisc.edu) writes:
>
>> 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:
>
> Well, certainly until someone loads a color table
> or changes the decomposition state to display a
> 24-bit image. :-)
>
Quite right. You either play with the color indexes, or the color table
itself. At least there are no writable system variables involved in this
method.
As for turning the decomposition state on or off to display 24-bit
images, I let IMDISP take care of it:
http://cimss.ssec.wisc.edu/~gumley/imdisp.html
Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
|
|
|
Re: Change default value of system variable? [message #23911 is a reply to message #23844] |
Mon, 26 February 2001 08:31   |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Liam E. Gumley (Liam.Gumley@ssec.wisc.edu) writes:
> 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:
Well, certainly until someone loads a color table
or changes the decomposition state to display a
24-bit image. :-)
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 #23962 is a reply to message #23844] |
Tue, 27 February 2001 15:20  |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article <3A9BD598.317C5212@fz-juelich.de>, Reimar Bauer
<r.bauer@fz-juelich.de> wrote:
> we have developed a plot environment to solve this and some other
> problems.
>
> The idea is to always initialize the device for each plot.
> What's all have to be done to make a plot is shown below.
>
> initialize
> open device
> make plot
> close device
>
> initialize: (plotprepare)
> * loads a predefined structure. This is used to store
> setting in keywords for the plots
> * The actual system variables are saved
> * The foreground and background color is set
>
> open device: (plotinit)
> * defines the device sizes
> * opens the output device
> * loads the colortable
>
> make plot (plotxy, plot2d, plotxy_2d, plot3d ...)
> plot, contour and so on
>
> close device (plotend)
> * the device is closed
> * the saved system variables are restored
Well, I'm glad to know it isn't *easy* to change the default background
color from black to white. ;-)
Ken
|
|
|
Re: Change default value of system variable? [message #23974 is a reply to message #23911] |
Tue, 27 February 2001 04:05  |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
David Fanning wrote:
>
> Liam E. Gumley (Liam.Gumley@ssec.wisc.edu) writes:
>
>> 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:
>
> Well, certainly until someone loads a color table
> or changes the decomposition state to display a
> 24-bit image. :-)
>
> Cheers,
>
> David
... but of course you could write a little widget program that uses a
timer event and redefines these colors every second or so ;-)
Cheers,
Martin
--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ 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 [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
|
|
|