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
> .
> I have some questions about color control in Section 3.4
> ( )
> 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.

Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738

  • 2000 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: