Re: How to display single datapoints? (I'm a beginner!)

I'm not sure I completely nderstand you data and how you want
to display it, but here's a quick example of how you could do
it.  This code compiles (with suitable substitutions for 'Xi',
'Yj' and 'Zij") but I have not tried to run it.  On the other
hand, it is an combination of working examples from the
Developer's Guide.  Good luck, and let me know if you have
any questions or problems.
public class Scatter {
// import needed classes
import visad.*;
import visad.java3d.DisplayImplJ3D;
import java.rmi.RemoteException;
import java.awt.*;
import java.awt.event.*;
import java.awt.swing.*;
  public static void main(String args[])
         throws VisADException, RemoteException {
    // construct a MathType ((I, J) -> (X, Y, Z))
    // first construct (I, J)
    RealType I = new RealType("I", null, null);
    RealType J = new RealType("J", null, null);
    RealTupleType IJ = new RealTupleType(new RealType[] {I, J});
    // next construct (X, Y, Z)
    RealType X = new RealType("X", null, null);
    RealType Y = new RealType("Y", null, null);
    RealType Z = new RealType("Z", null, null);
    RealTupleType XYZ = new RealTupleType(new RealType[] {X, Y, Z});
    // now construct ((I, J) -> (X, Y, Z))
    FunctionType field_type = new FunctionType(IJ, XYZ);
    // construct a 5 by 3 integer sampling
    Integer2DSet domain_set = new Integer2DSet(5, 3);
    // construct a FlatField to hold values
    FlatField field = new FlatField(field_type, domain_set);
    // fill values into 'data' array
    float[][] data = new float[3][5 * 3];
    for (int i=0; i<5; i++) {
      for (int j=0; j<3; j++) {
        // substitute source of values for 'Xi', 'Yj'
        // and 'Zij' in these three lines
        data[0][i + 5*j] = Xi;
        data[0][i + 5*j] = Yi;
        data[0][i + 5*j] = Zij;
    // set the data values into the FlatField
    // construct a scatter plot Display
    DisplayImpl display = new DisplayImplJ3D("image display");
    // construct mappings to define how data are displayed
    display.addMap(new ScalarMap(X, Display.XAxis));
    display.addMap(new ScalarMap(Y, Display.YAxis));
    display.addMap(new ScalarMap(Z, Display.ZAxis));
 NOTE, if you wanted to see your data as a surface of Z
 values, colored by X and Y values, you do use the
 following mappings INSTEAD:
    display.addMap(new ScalarMap(I, Display.XAxis));
    display.addMap(new ScalarMap(J, Display.YAxis));
    display.addMap(new ScalarMap(Z, Display.ZAxis));
    display.addMap(new ScalarMap(X, Display.Red));
    display.addMap(new ScalarMap(Y, Display.Green));
    // create a reference to the data
    DataReference field_ref = new DataReferenceImpl("field");
    // and use it to link data to display
    // create JFrame (i.e., a window) for display and slider
    JFrame frame = new JFrame("Simple VisAD Application");
    frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {System.exit(0);}
    // create JPanel in JFrame
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    // add display to JPanel
    // set size of JFrame and make it visible
    frame.setSize(500, 600);
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
whibbard@xxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
"kill cross-platform Java by growing the polluted Java market"
   - from an internal Microsoft planning document