Re: color bar.. [message #30527] |
Sun, 05 May 2002 12:23 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ho-yong,Jeong (hyjeong@climate.snu.ac.kr) writes:
> i use idl5.5
> i major in atmospheric science
> i think default 16-bit color is not good
> i want simple color...
> how?
Colors are pretty simple. And 16-bit color
is certainly better than 8-bit, although
not as good as 24-bit. :-)
> and..
> i want plot color bar with picture
> how can i make color bar in output?
Here is a short example program that shows
you a simple way to work with colors, get
a color bar, etc. You can find the programs
you need (TVImage, XColors, Colorbar, TVRead)
here:
http://www.dfanning.com/documents/programs.html
Run the program like this:
IDL> Example, yourImage
You can run it multiple times if you like. You will
be able to display different colors in different
windows. Each window will have its own color table
changing tool. When you want to make an output file,
use TVRead with one of the windows. For example, if
you want to create a JPEG file of window 32, do this:
IDL> I = TVRead(Wid=32, /JPEG, Filename='window32')
Cheers,
David
************************************************************ ***
PRO Example_Redisplay_Image, Image=image, Wid=wid
Device, Window_State=theseWindows
IF theseWindows[wid] EQ 1 THEN WSet, wid
TVImage, image, Position=[0.125, 0.125, 0.875, 0.7]
Colorbar, Position=[0.125, 0.85, 0.875, 0.9], $
Range=[Min(image), Max(image)]
END
PRO Example, image
IF N_Elements(image) EQ 0 THEN image = Dist(256)
Window, /Free, XSize=400, YSize=500
wid = !D.Window
LoadCT, 0, /Silent
TVImage, image, Position=[0.125, 0.125, 0.875, 0.7]
Colorbar, Position=[0.125, 0.85, 0.875, 0.9], $
Range=[Min(image), Max(image)]
XColors, Title='Colors for Window No. ' + StrTrim(wid,2), $
NotifyPro='Example_Redisplay_Image', Image=image, Wid=wid
END
************************************************************ ***
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|