Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Re: use of Display.Red color control

Hi Stuart,

> I am working through the new Java Tutorial by Ugo Tadei, and
> find it very helpful for a new user of VisAD. The tutorial is online at
> http://www.ssec.wisc.edu/~billh/tutorial/index.html .
> 
> I have some questions about color control in Section 3.4
> (http://www.ssec.wisc.edu/~billh/tutorial/s3/Section3.html )
> 
> The example program p3_04 displays 3 different quantitites on the same display
> with three color maps:
> 
>     tempMap = new ScalarMap( temperature,  Display.Red );
>     pressMap = new ScalarMap( pressure,  Display.Green );
>     precipMap = new ScalarMap( precipitation,  Display.Blue );
>     display.addMap( tempMap );
>     display.addMap( pressMap );
>     display.addMap( precipMap );
> 
> Works fine. The temperature (red) has a maximum at the top and a
> minimum at the bottom of the display, as expected by the data values supplied.
> 
> However, if you just want to see temerpature as shades of red,
> and you comment out display.addMap for the pressMap and precipMap, leaving 
> only
> the tempMap ("Display.Red") you see only white to cyan.
> Why does a display control called "Display.Red" make cyan?
> 
> If I switch Display.Red to Display.Cyan then red appears.
> 
> So using Display.Red gives red where desired - but only if
> other colors are displayed.
> 
> Likewise using only precipMap shows white to yellow, with white
> is where blue is expected.
> 
> Is this because there are other Maps (green and blue), which are
> "implicitly" created and added to the display.
> 
> How do you display temperature as shades of red using Display.Red?
> Using Display.Cyan seems counter-intuitive.

This happens because the default values for Red, Green and
Blue are all 1.0, so that graphics are colored white when
no color is specified.

If you just want shades of Red, dothe following:

  display.addMap(new ConstantMap(0.0, Display.Green);
  display.addMap(new ConstantMap(0.0, Display.Blue);

You can also pass ConstantMap[] arrays to display.addReference()
if you want them to only apply to one data object in the display.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html

 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690