Example usage for weka.gui.visualize PlotData2D setCindex

List of usage examples for weka.gui.visualize PlotData2D setCindex

Introduction

In this page you can find the example usage for weka.gui.visualize PlotData2D setCindex.

Prototype

public void setCindex(int c) 

Source Link

Document

Set the colouring index of the data

Usage

From source file:milk.visualize.MIPlot2D.java

License:Open Source License

/**
 * Sets the plot vectors from a set of exemplars
 * @param added the exemplars//from  www. java  2 s. co m
 * @exception exception Exception if plots could not be set
 */
public void setPlotExemplars(Exemplars added) throws Exception {
    super.removeAllPlots(); // Set xIndex, yIndex and cIndex to 0   
    if (added == null) {
        plotExemplars = null;
        setEnabled(false);
        return;
    }

    plotExemplars = new Exemplars(added);
    int cIndex = plotExemplars.classIndex();

    for (int i = 0; i < plotExemplars.numExemplars(); i++) {
        Exemplar ex = plotExemplars.exemplar(i);
        Instances insts = ex.getInstances();
        PlotData2D tmp = new PlotData2D(insts);
        int num = insts.numInstances();
        int[] shapes = new int[num];
        int[] sizes = new int[num];
        for (int j = 0; j < num; j++) {
            shapes[j] = Plot2D.X_SHAPE;
            sizes[j] = Plot2D.DEFAULT_SHAPE_SIZE;
        }

        tmp.setShapeType(shapes);
        tmp.setShapeSize(sizes);
        tmp.m_useCustomColour = false;
        tmp.setCindex(cIndex);
        tmp.setPlotName(Integer.toString((int) ex.idValue()));
        addPlot(tmp); // determineBound() involved
    }
    // Reset
    if (x != null)
        setXValue(x);
    if (y != null)
        setYValue(y);
    m_cIndex = cIndex;
    if (!Double.isNaN(maxC))
        m_maxC = maxC;
    if (!Double.isNaN(minC))
        m_minC = minC;
}