NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: Different-color plots on one set of axes

Charles Packer wrote:
> 
> At Wednesday, 06 February 2002, you wrote:
> >However, the real answer to your problem is to form your
> >lines as Gridded2DSets (if you want lines in 2-D) or
> >Grided3DSets (if you want lines in 3-D), in either case
> >with manifold dimension = 1. You can combine multiple
> >lines in a UnionSet. To get color, use your Set as the
> >domain Set of a FlatField with MathType (e.g., in the
> >3-D case):
> >
> >  ((x, y, z) -> (r, g, b))
> >
> >In your Display, map x -> XAxis, ..., r -> Red, ...
> >In your FlatField, set color values into r, g & b via
> >setSamples().
> 
> Could you apply this to the Rivers example? Then I think I would
> understand it. Rivers.java already uses a Unionset, so if you could
> take it from there and make one tributary red and another one blue.

To make each tributary a different solid color, a slightly
different approach is best. For each of the the three Gridded2DSets
in Rivers.java, make it the domain Set of a FlatField of MathType:

  ((RealType.Latitude, RealType.Longitude) -> (r, g, b))

The for each FlatField create an array values[3][n_samples]
repeating the appropriate values for red, green and blue.
Then construct a FieldImpl with MathType:

  (index -> ((RealType.Latitude, RealType.Longitude) -> (r, g, b))

and Integer1DSet(3) for domain Set, and set the three FlatFields
as values via FieldImpl.setSample(i, flat_field_i).

If you want a set of lines in 3-D, replace
(RealType.Latitude, RealType.Longitude) with a 3-D Type and
replace the Gridded2DSets with Gridded3DSets with manifold
dimension = 1.

Good luck,
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


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