Re: changing data color on the fly in 2D X-Y plot



m huang wrote:

Say I have (x -> y) plotted with lines connected, as shown in
the example P2_05 in the Tutorial.

I use display.addReference(data_ref, cMap ) to set
the color of the curve, where cMap is an array of ConstantMaps
made according to the r g b color components. My question is
how to change the color of the curve AFTER the plot has
been constructed and shown? I tried to make new ConstantMaps
and put them in the cMap above, but that doesn't seem to
change anything. Should I somehow trigger the DisplayRenderer
or something else to remake the rendering?

Are you removing the DataReference and readding it with the
new ConstantMaps, or just changing the array.  If the latter,
that won't work, the former should.

An alternative would be to map your values RealType to RGB and
use the setTable method to change it to a table with solid
colors.  Your table must have at least 5 values in it or
you'll get an exception (float[3][5]) where the 3 is r,g,b
and each of the values is the same for all 5 in the array.

We do both in our IDV.

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************



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