Re: Different-color plots on one set of axes

Hi Charles,

> I need to draw multiple lines of different colors in one 2D plot.
> Looking for clues as to how to do this, I found Test67 in the "examples"
> subdirectory. It shows red and blue sine waves each in its own cube.
> It appears from that example that color is a property of the Display
> object. But experimentation with two data vectors representing two
> different lines showed me that they must be associated with only
> one Display object to have them appear on one set of axes. What to
> do?

Multiple Data objects can be linked to a single Display and
thus appear on one set of axes.

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().

If you prefer not to use UnionSet, you can do the same thing
by using each Gridded*DSet as the domain Set of its own
FlatField, and combining multiple FlatFields as range objects
of a FieldImpl with MathType:

  (index -> ((x, y, z) -> (r, g, b)))

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