weka.gui.visualize
Class PlotData2D

java.lang.Object
  extended byweka.gui.visualize.PlotData2D

public class PlotData2D
extends java.lang.Object

This class is a container for plottable data. Instances form the primary data. An optional array of classifier/clusterer predictions (associated 1 for 1 with the instances) can also be provided.

Version:
$Revision: 1.16 $
Author:
Mark Hall (mhall@cs.waikato.ac.nz)

Field Summary
private  int m_cIndex
          The colouring index
protected  boolean[] m_connectPoints
          Additional optional information to control the drawing of lines between consecutive points.
 java.awt.Color m_customColour
           
 boolean m_displayAllPoints
          Display all points (ie. those that map to the same display coords)
protected  double m_maxC
           
protected  double m_maxX
          Holds the min and max values of the x, y and colouring attributes for this plot
protected  double m_maxY
           
protected  double m_minC
           
protected  double m_minX
           
protected  double m_minY
           
protected  Instances m_plotInstances
          The instances
protected  java.lang.String m_plotName
          The name of this plot
protected  double[][] m_pointLookup
          Panel coordinate cache for data points
protected  int[] m_shapeSize
          Additional optional information to control the size of points.
protected  int[] m_shapeType
          Additional optional information to control the point shape for this data.
 boolean m_useCustomColour
          Custom colour for this plot
private  int m_xIndex
          The x index
private  int m_yIndex
          The y index
 
Constructor Summary
PlotData2D(Instances insts)
          Construct a new PlotData2D using the supplied instances
 
Method Summary
 void addInstanceNumberAttribute()
          Adds an instance number attribute to the plottable instances,
private  void determineBounds()
          Determine bounds for the current x,y and colouring indexes
 int getCindex()
          Get the currently set colouring index of the data
 Instances getPlotInstances()
          Returns the instances for this plot
 java.lang.String getPlotName()
          Get the name of this plot
 int getXindex()
          Get the currently set x index of the data
 int getYindex()
          Get the currently set y index of the data
 void setCindex(int c)
          Set the colouring index of the data
 void setConnectPoints(boolean[] cp)
          Set whether consecutive points should be connected by lines
 void setConnectPoints(FastVector cp)
          Set whether consecutive points should be connected by lines
 void setCustomColour(java.awt.Color c)
          Set a custom colour to use for this plot.
 void setPlotName(java.lang.String name)
          Set the name of this plot
 void setShapeSize(FastVector ss)
          Set the shape sizes for the plot data
 void setShapeSize(int[] ss)
          Set the shape sizes for the plot data
 void setShapeType(FastVector st)
          Set the shape type for the plot data
 void setShapeType(int[] st)
          Set the shape type for the plot data
 void setXindex(int x)
          Set the x index of the data.
 void setYindex(int y)
          Set the y index of the data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_plotInstances

protected Instances m_plotInstances
The instances


m_plotName

protected java.lang.String m_plotName
The name of this plot


m_useCustomColour

public boolean m_useCustomColour
Custom colour for this plot


m_customColour

public java.awt.Color m_customColour

m_displayAllPoints

public boolean m_displayAllPoints
Display all points (ie. those that map to the same display coords)


m_pointLookup

protected double[][] m_pointLookup
Panel coordinate cache for data points


m_shapeSize

protected int[] m_shapeSize
Additional optional information to control the size of points. The default is shape size 2


m_shapeType

protected int[] m_shapeType
Additional optional information to control the point shape for this data. Default is to allow automatic assigning of point shape on the basis of plot number


m_connectPoints

protected boolean[] m_connectPoints
Additional optional information to control the drawing of lines between consecutive points. Setting an entry in the array to true indicates that the associated point should have a line connecting it to the previous point.


m_xIndex

private int m_xIndex
The x index


m_yIndex

private int m_yIndex
The y index


m_cIndex

private int m_cIndex
The colouring index


m_maxX

protected double m_maxX
Holds the min and max values of the x, y and colouring attributes for this plot


m_minX

protected double m_minX

m_maxY

protected double m_maxY

m_minY

protected double m_minY

m_maxC

protected double m_maxC

m_minC

protected double m_minC
Constructor Detail

PlotData2D

public PlotData2D(Instances insts)
Construct a new PlotData2D using the supplied instances

Parameters:
insts - the instances to use.
Method Detail

addInstanceNumberAttribute

public void addInstanceNumberAttribute()
Adds an instance number attribute to the plottable instances,


getPlotInstances

public Instances getPlotInstances()
Returns the instances for this plot

Returns:
the instances for this plot

setPlotName

public void setPlotName(java.lang.String name)
Set the name of this plot

Parameters:
name - the name for this plot

getPlotName

public java.lang.String getPlotName()
Get the name of this plot

Returns:
the name of this plot

setShapeType

public void setShapeType(int[] st)
                  throws java.lang.Exception
Set the shape type for the plot data

Parameters:
st - an array of integers corresponding to shape types (see constants defined in Plot2D)
Throws:
java.lang.Exception

setShapeType

public void setShapeType(FastVector st)
                  throws java.lang.Exception
Set the shape type for the plot data

Parameters:
st - a FastVector of integers corresponding to shape types (see constants defined in Plot2D)
Throws:
java.lang.Exception

setShapeSize

public void setShapeSize(int[] ss)
                  throws java.lang.Exception
Set the shape sizes for the plot data

Throws:
java.lang.Exception

setShapeSize

public void setShapeSize(FastVector ss)
                  throws java.lang.Exception
Set the shape sizes for the plot data

Throws:
java.lang.Exception

setConnectPoints

public void setConnectPoints(boolean[] cp)
                      throws java.lang.Exception
Set whether consecutive points should be connected by lines

Parameters:
cp - an array of boolean specifying which points should be connected to their preceeding neighbour.
Throws:
java.lang.Exception

setConnectPoints

public void setConnectPoints(FastVector cp)
                      throws java.lang.Exception
Set whether consecutive points should be connected by lines

Parameters:
cp - a FastVector of boolean specifying which points should be connected to their preceeding neighbour.
Throws:
java.lang.Exception

setCustomColour

public void setCustomColour(java.awt.Color c)
Set a custom colour to use for this plot. This overides any data index to use for colouring. If null, then will revert back to the default (no custom colouring).

Parameters:
c - a custom colour to use for this plot or null (default---no colouring).

setXindex

public void setXindex(int x)
Set the x index of the data.

Parameters:
x - the x index

setYindex

public void setYindex(int y)
Set the y index of the data

Parameters:
y - the y index

setCindex

public void setCindex(int c)
Set the colouring index of the data

Parameters:
c - the colouring index

getXindex

public int getXindex()
Get the currently set x index of the data

Returns:
the current x index

getYindex

public int getYindex()
Get the currently set y index of the data

Returns:
the current y index

getCindex

public int getCindex()
Get the currently set colouring index of the data

Returns:
the current colouring index

determineBounds

private void determineBounds()
Determine bounds for the current x,y and colouring indexes