plots and logarithm scale

Celine Gestas celine.gestas at gmail.com
Wed Mar 21 12:46:54 MDT 2007


Hi,

I am working on a application which enables users to choose to use a
logarithm scale or not (log scale on X, on Y or on X and Y). When I am
plotting line it s ok, the scale and the plot but when I am trying to
display points, they don t fit to the log scale. So I have tried what is on
the comment but it changes nothing...

If someonr can help me ...


      for(i=0;  i<yAxis.size(); i++) {
                float[][] y_vals = _linePlot.getValues((String) yAxis.get
(i));

                /*******************************/
                /* Code for setting POINT data */
                /*******************************/

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

                /*index = RealType.getRealType("index",
CommonUnit.promiscuous);
                RealTupleType referenceIndex = new RealTupleType(index);
                LogCoordinateSystem logCSindex = new
LogCoordinateSystem(referenceIndex, base);
                RealTupleType rangeIndex = new RealTupleType(index,
logCSindex, null);
                index_set = new Integer1DSet(rangeIndex, x_vals[0].length,
logCSindex, null, null);*/

                // organize x and y in a Tuple
                if (log.equals("logX")) {
                    y = RealType.getRealType((String) yAxis.get(i));
                    x_y_tuple = new RealTupleType(logX, y);}

                else if (log.equals("logY")) {
                    y = RealType.getRealType("");
                    logY = RealType.getRealType((String) yAxis.get(i),
CommonUnit.promiscuous);
                    x_y_tuple = new RealTupleType(x, logY);}

                else if(log.equals("loglog")){
                    y = RealType.getRealType("");
                    logY = RealType.getRealType((String) yAxis.get(i),
CommonUnit.promiscuous);
                    x_y_tuple = new RealTupleType(logX, logY);}

                else {
                    y = RealType.getRealType((String) yAxis.get(i));
                    x_y_tuple = new RealTupleType(x, y);
                }

                // create the function to draw points
                //func_i_tuple = new FunctionType( rangeIndex, x_y_tuple);
                func_i_tuple = new FunctionType( index, x_y_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)
                points_ff = new FlatField( func_i_tuple, index_set);

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


Thank you,

Celine Gestas


More information about the visad mailing list