Hi Adele,
> I've been using the parallel coordinates routine in
> visad/examples/parallel and I'm struggling with
> coloring the coordinates according to a new
> variable. The code looks like:
>
> RealType x = RealType.getRealType("coordinate");
> RealType y = RealType.getRealType("value");
> SetType xy = new SetType(new RealTupleType(x, y));
> FunctionType ptype = new FunctionType(index, xy);
> FieldImpl pfield = new FieldImpl(ptype, index_set);
> for (int j=0; j<nrows; j++) {
> float[][] locs = new float[2][ncoords];
> for (int i=0; i<ncoords; i++) {
> locs[0][i] = i;
> locs[1][i] = samples[i][j];
> }
> Gridded2DSet set = new Gridded2DSet(xy, locs, ncoords);
> pfield.setSample(j, set, false);
> }
> DataReference parallel_ref = new DataReferenceImpl("parallel");
> parallel_ref.setData(pfield);
> display.addMap(new ScalarMap(x, Display.XAxis));
> display.addMap(new ScalarMap(y, Display.YAxis));
>
> As well as samples[i][j], I have color[j], but I don't know how
> to set up the data so that it will know that color[j] is the
> color for the jth trace.
Your FieldImpl has MathType (index -> Set(coordinate, value)).
Try a FieldImpl with MathType:
(index -> (color, Set(coordinate, value)))
Each range value would be something like:
Gridded2DSet set = new Gridded2DSet(xy, locs, ncoords);
Real c = new Real(color_type, color_value); // (RealType, double)
Data[] components = {c, set};
Tuple range = new Tuple(components, false); // don't copy
pfield.setSample(j, range, false);
Then add a ScalarMap of color_type to RGB.
Good luck,
Bill