tpp
Class ScatterPlotModel

java.lang.Object
  extended by tpp.TPPModel
      extended by tpp.ScatterPlotModel
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class ScatterPlotModel
extends TPPModel
implements java.lang.Cloneable

A TPPModel with added members for allowing it to be presented and manipulated using via a Scatter Plot GUI

See Also:
Serialized Form

Field Summary
 
Fields inherited from class tpp.TPPModel
CLASS_UNKNOWN
 
Constructor Summary
ScatterPlotModel(int n)
           
 
Method Summary
 boolean areAxesSelected()
          Are any axes selected?
 boolean canUndo()
          Whether there is a snapshot to undo to.
 ScatterPlotModel clone()
           
 void createSeries(Attribute indexAttribute, Attribute idAttribute)
          Create a series in the instances using the given index and id attributes (specified by name).
 Attribute createTestSet(int k)
          Create a test set comprising 1/k'th of the instances.
 void drawRectangleAroundSelectedAxes()
          Create a rectangle that includes all selected axes
 void drawRectangleAroundSelectedPoints()
          Create a rectangle that includes all selected points
 int getAxisForAttribute(Attribute at)
          Determine which axis represents the given attribute.
 Attribute getColourAttribute()
           
 ColourScheme getColours()
          Get teh color scheme
 Attribute getFillAttribute()
           
 double getMarkerSize()
           
 Attribute getSelectAttribute()
           
 Attribute getShapeAttribute()
           
 Attribute getSizeAttribute()
           
 java.awt.geom.AffineTransform getTransform()
           
 java.awt.geom.AffineTransform getTransform(double width, double height)
          Return a transform that will map data space onto device space of the given width and height, so that the points (and axes, if shown) fit snugly into the panel, adjusting the projection so that the scale of the transform is within reasonable limits.
 void initRectangle(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
          Initialise a rectangle with corners at the given points
 boolean isAxisSelected(int a)
           
 void loadGraph(Graph graph)
           
 void moveSelectedAxes(double dx, double dy)
          Move the selected axes by the (dx,dy)
 double[] removeAttribute(Attribute at)
          Remove an attribute, returning the values
 void removeAttributes(java.util.Vector<Attribute> attributes)
          remove multiple attributes
 void removeGraph()
           
 void removeSeries()
           
 void resizePlot()
          Rescale the scatter plot so that it fits into the existing window
 void resizePlot(int width, int height)
          Resize the scatter plot so that it fits in the new window size
 void selectAxes(int[] axes)
          Add axes to the selection
 void selectAxesByRectangle()
          Select any axes within the rectangle
 void selectAxis(int axis)
          Add a axis to the selection
 void selectPointsByClassValue(java.lang.String value, boolean addToExistingSelection)
          Select the points whose value of the selection attribute is equal to the given value
 void selectPointsByNumericRange(double min, double max, boolean addToExistingSelection)
          Select the points whose value of the selection attribute is in the given range.
 void selectPointsByRectangle()
          Select any points within the rectangle
 void setColourAttribute(Attribute at)
           
 void setColours(ColourScheme colours)
          Set the color scheme
 void setFillAttribute(Attribute fillAttribute)
           
 void setInstances(Instances data)
           
 void setMarkerSize(double d)
           
 void setSelectAttribute(Attribute selectAttribute)
           
 void setShapeAttribute(Attribute shapeAttribute)
           
 void setShowAxes(boolean b)
          Whether to show axes
 void setShowAxisLabels(boolean showAxisLabels)
          Whether or not to show axis labels.
 void setShowGraph(boolean show)
           
 void setShowHierarchicalClustering(boolean show)
           
 void setShowSeries(boolean show)
          Show any series in the data
 void setShowTarget(boolean showTarget)
           
 void setSizeAttribute(Attribute at)
           
 boolean showAxes()
           
 boolean showAxisLabels()
          Whether or not to show axis labels.
 boolean showGraph()
           
 boolean showHierarchicalClustering()
           
 boolean showSeries()
           
 boolean showTarget()
           
 void undo()
          Undo any changes back to the previous snapshot
 void unselectAxes()
          Unselect the axes
 void unselectAxis(int i)
           
 
Methods inherited from class tpp.TPPModel
addListener, arePointsSelected, cluster, createCrossValidation, createHierarchicalClustering, getAttributeByName, getAttributes, getCentroids, getData, getDateAttributes, getDescriptionOfAttributes, getDescriptionOfInstance, getGraph, getHierarchicalCluster, getInstances, getNominalAttributes, getNormalisedDistances, getNumDataDimensions, getNumDataPoints, getNumericAttributes, getNumViewDimensions, getPointDescriptions, getPointsInTrainingSet, getProjection, getProjectionConstraint, getSeparationAttribute, getSeries, getStringAttributes, getTarget, getTestAttribute, getView, getViewAsString, indexOf, indexOf, isPointInTestingSet, isPointSelected, nominalToBinary, normalizeDataUnit, normalizeProjection, numPointsSelected, PCA, project, pursueTarget, pursueTargetSingleShot, randomProjection, removeTestSet, selectPoint, selectPoints, selectSingleAttribute, setProjectionConstraint, setProjectionValues, setSeparationAttribute, setTarget, toString, uniformProjection, unselectPoints, zeroProjectionAttributes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScatterPlotModel

public ScatterPlotModel(int n)
Method Detail

setInstances

public void setInstances(Instances data)
                  throws java.lang.Exception
Overrides:
setInstances in class TPPModel
Throws:
java.lang.Exception

selectPointsByClassValue

public void selectPointsByClassValue(java.lang.String value,
                                     boolean addToExistingSelection)
Select the points whose value of the selection attribute is equal to the given value


selectPointsByNumericRange

public void selectPointsByNumericRange(double min,
                                       double max,
                                       boolean addToExistingSelection)
Select the points whose value of the selection attribute is in the given range.


unselectAxes

public void unselectAxes()
Unselect the axes


selectAxis

public void selectAxis(int axis)
Add a axis to the selection


selectAxes

public void selectAxes(int[] axes)
Add axes to the selection


areAxesSelected

public boolean areAxesSelected()
Are any axes selected?


isAxisSelected

public boolean isAxisSelected(int a)

unselectAxis

public void unselectAxis(int i)

getAxisForAttribute

public int getAxisForAttribute(Attribute at)
Determine which axis represents the given attribute. If the attribute is non-numeric (and hence will not be represented by an axis) then return -1


moveSelectedAxes

public void moveSelectedAxes(double dx,
                             double dy)
Move the selected axes by the (dx,dy)


getColours

public ColourScheme getColours()
Get teh color scheme


setColours

public void setColours(ColourScheme colours)
Set the color scheme


getShapeAttribute

public Attribute getShapeAttribute()

getFillAttribute

public Attribute getFillAttribute()

getSelectAttribute

public Attribute getSelectAttribute()

getColourAttribute

public Attribute getColourAttribute()

getSizeAttribute

public Attribute getSizeAttribute()

setSelectAttribute

public void setSelectAttribute(Attribute selectAttribute)

setSizeAttribute

public void setSizeAttribute(Attribute at)

setColourAttribute

public void setColourAttribute(Attribute at)

setShapeAttribute

public void setShapeAttribute(Attribute shapeAttribute)

setFillAttribute

public void setFillAttribute(Attribute fillAttribute)

setMarkerSize

public void setMarkerSize(double d)

getMarkerSize

public double getMarkerSize()

removeAttribute

public double[] removeAttribute(Attribute at)
Remove an attribute, returning the values

Overrides:
removeAttribute in class TPPModel

removeAttributes

public void removeAttributes(java.util.Vector<Attribute> attributes)
remove multiple attributes


initRectangle

public void initRectangle(java.awt.geom.Point2D p1,
                          java.awt.geom.Point2D p2)
Initialise a rectangle with corners at the given points


drawRectangleAroundSelectedPoints

public void drawRectangleAroundSelectedPoints()
Create a rectangle that includes all selected points


drawRectangleAroundSelectedAxes

public void drawRectangleAroundSelectedAxes()
Create a rectangle that includes all selected axes


selectPointsByRectangle

public void selectPointsByRectangle()
Select any points within the rectangle


selectAxesByRectangle

public void selectAxesByRectangle()
Select any axes within the rectangle


setShowAxes

public void setShowAxes(boolean b)
Whether to show axes


showAxes

public boolean showAxes()

showAxisLabels

public boolean showAxisLabels()
Whether or not to show axis labels.


setShowAxisLabels

public void setShowAxisLabels(boolean showAxisLabels)
Whether or not to show axis labels.


showTarget

public boolean showTarget()

setShowTarget

public void setShowTarget(boolean showTarget)

createSeries

public void createSeries(Attribute indexAttribute,
                         Attribute idAttribute)
Description copied from class: TPPModel
Create a series in the instances using the given index and id attributes (specified by name). Any existing series are removed.

Overrides:
createSeries in class TPPModel

removeSeries

public void removeSeries()
Overrides:
removeSeries in class TPPModel

showSeries

public boolean showSeries()

setShowSeries

public void setShowSeries(boolean show)
Show any series in the data


loadGraph

public void loadGraph(Graph graph)
Overrides:
loadGraph in class TPPModel

removeGraph

public void removeGraph()
Overrides:
removeGraph in class TPPModel

setShowGraph

public void setShowGraph(boolean show)

showGraph

public boolean showGraph()

setShowHierarchicalClustering

public void setShowHierarchicalClustering(boolean show)

showHierarchicalClustering

public boolean showHierarchicalClustering()

createTestSet

public Attribute createTestSet(int k)
Description copied from class: TPPModel
Create a test set comprising 1/k'th of the instances. If there are no series then the test set is chosen at random. If there are series defined the the test set is the last 1/kth of each series Any existing test set is replaced.

Overrides:
createTestSet in class TPPModel
Returns:
the attribute that defines the test set

resizePlot

public void resizePlot(int width,
                       int height)
Resize the scatter plot so that it fits in the new window size


resizePlot

public void resizePlot()
Rescale the scatter plot so that it fits into the existing window


getTransform

public java.awt.geom.AffineTransform getTransform(double width,
                                                  double height)
Return a transform that will map data space onto device space of the given width and height, so that the points (and axes, if shown) fit snugly into the panel, adjusting the projection so that the scale of the transform is within reasonable limits.
(See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6294396 and http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4982427 for more on reasonable limits for AffineTransforms)


getTransform

public java.awt.geom.AffineTransform getTransform()

clone

public ScatterPlotModel clone()
Overrides:
clone in class TPPModel

undo

public void undo()
Undo any changes back to the previous snapshot


canUndo

public boolean canUndo()
Whether there is a snapshot to undo to.