customizing points with shapes

Celine Gestas celine.gestas at gmail.com
Wed May 16 10:05:01 MDT 2007


Hi everybody,

First I d like to know if we can use Latex with VisAD because I d like to
display subscript and maybe equation on axis : example, B_s or \alpha for
greek character.
Then I have issues displaying points as shapes. Actually I am plotting
lineplots that means I display line then points. As I change the line style
I would like to change the points shape. But when I customize just the line
(so points do not have particular shape) it works fine but when I add a
shape control on points, they don t display anymore (line remains)... Does
anyone have an idea ?
Here is my code for displaying points :


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        RealType x = RealType.getRealType("xReal");
        RealType y = RealType.getRealType("yReal");

        // create the index
        RealType id = RealType.getRealType("indexReal");
        Integer1DSet i_set = new Integer1DSet(id, x_vals[0].length);

    // organize x and y in a Tuple
        RealTupleType tuple = new RealTupleType(x, y);

    // create the function to draw points
        FunctionType func = new FunctionType(id, tuple);

        // our actual data values for x and y
        float[][] point_vals  = new float[2][x_vals[0].length];
        point_vals[0] = x_vals[0];
        point_vals[1] = y_vals[0];

        // associate the function (func_i_tuple) to the values (index_set)
        FlatField points_ff = new FlatField( func, i_set);

        // and finally put the points above in it
        points_ff.setSamples( point_vals );

        // create data references and set the FlatFields (association
function/values) as our datas
        DataReferenceImpl points_ref = new DataReferenceImpl("points_ref");
        points_ref.setData( points_ff );

        ScalarMap shape_map2 = new ScalarMap(y, Display.Shape);
        _display.addMap(shape_map2);


        float[] color = plotProperties.getColor(yAxis);

        // points initialization : colors and points size
        pointsCMap = new ConstantMap[] { new ConstantMap(color[0],
Display.Red),
        new ConstantMap( color[1], Display.Green),
        new ConstantMap( color[2], Display.Blue),
        new ConstantMap( 4.0f, Display.PointSize)};

        // add references to the display
        _display.addReference( points_ref, null);
        //_display.addReference( points_ref, pointsCMap);


        ShapesVisAD sv = new ShapesVisAD();

        Gridded1DSet count_set2 = new Gridded1DSet(x, x_vals,
x_vals[0].length);
        VisADGeometryArray[] shapes2 = new
VisADGeometryArray[x_vals[0].length];

        int pointStyle = plotProperties.getPointStyle(yAxis)-1;

        for(i=0; i<x_vals[0].length; i++) {
            shapes2[i] = sv.getShape(pointStyle);
        }

        ShapeControl shape_control2 = (ShapeControl)
shape_map2.getControl();
        shape_control2.setShapeSet(count_set2);
        shape_control2.setShapes(shapes2);

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Thanks,

Celine Gestas


More information about the visad mailing list