All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.gui.visualize.Plot2D

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----javax.swing.JComponent
                           |
                           +----javax.swing.JPanel
                                   |
                                   +----weka.gui.visualize.Plot2D

public class Plot2D
extends JPanel
This class plots datasets in two dimensions. It can also plot classifier errors and clusterer predictions.

Author:
Mark Hall (mhall@cs.waikato.ac.nz)

Variable Index

 o CONST_AUTOMATIC_SHAPE
 o DEFAULT_SHAPE_SIZE
 o DIAMOND_SHAPE
 o ERROR_SHAPE
 o MAX_SHAPES
 o MISSING_SHAPE
 o PLUS_SHAPE
 o TRIANGLEDOWN_SHAPE
 o TRIANGLEUP_SHAPE
 o X_SHAPE

Constructor Index

 o Plot2D()
Constructor

Method Index

 o addPlot(PlotData2D)
Add a plot to the list of plots to display
 o convertToAttribX(double)
convert a Panel x coordinate to a raw x value.
 o convertToAttribY(double)
convert a Panel y coordinate to a raw y value.
 o convertToPanelX(double)
Convert an raw x value to Panel x coordinate.
 o convertToPanelY(double)
Convert an raw y value to Panel y coordinate.
 o determineBounds()
Determine the min and max values for axis and colouring attributes
 o getMasterPlot()
Get the master plot
 o getMaxC()
Return the current max value of the colouring attribute
 o getMaxX()
Return the current max value of the attribute plotted on the x axis
 o getMaxY()
Return the current max value of the attribute plotted on the y axis
 o getMinC()
Return the current min value of the colouring attribute
 o getMinX()
Return the current min value of the attribute plotted on the x axis
 o getMinY()
Return the current min value of the attribute plotted on the y axis
 o getPlots()
Return the list of plots
 o main(String[])
Main method for testing this class
 o paintComponent(Graphics)
Renders this component
 o removeAllPlots()
Clears all plots
 o searchPoints(int, int, boolean)
Pops up a window displaying attribute information on any instances at a point+-plotting_point_size (in panel coordinates)
 o setCindex(int)
Set the index of the attribute to use for colouring
 o setColours(FastVector)
Set a list of colours to use when colouring points according to class values or cluster numbers
 o setInstances(Instances)
Sets the master plot from a set of instances
 o setJitter(int)
Set level of jitter and repaint the plot using the new jitter value
 o setMasterPlot(PlotData2D)
Set the master plot.
 o setPlotCompanion(Plot2DCompanion)
Set a companion class.
 o setXindex(int)
Set the index of the attribute to go on the x axis
 o setYindex(int)
Set the index of the attribute to go on the y axis

Variables

 o MAX_SHAPES
 public static final int MAX_SHAPES
 o ERROR_SHAPE
 public static final int ERROR_SHAPE
 o MISSING_SHAPE
 public static final int MISSING_SHAPE
 o CONST_AUTOMATIC_SHAPE
 public static final int CONST_AUTOMATIC_SHAPE
 o X_SHAPE
 public static final int X_SHAPE
 o PLUS_SHAPE
 public static final int PLUS_SHAPE
 o DIAMOND_SHAPE
 public static final int DIAMOND_SHAPE
 o TRIANGLEUP_SHAPE
 public static final int TRIANGLEUP_SHAPE
 o TRIANGLEDOWN_SHAPE
 public static final int TRIANGLEDOWN_SHAPE
 o DEFAULT_SHAPE_SIZE
 public static final int DEFAULT_SHAPE_SIZE

Constructors

 o Plot2D
 public Plot2D()
Constructor

Methods

 o setPlotCompanion
 public void setPlotCompanion(Plot2DCompanion p)
Set a companion class. This is a class that might want to render something on the plot before we do our thing. Eg, Malcolm's shape drawing stuff needs to happen before we plot axis and points

Parameters:
p - a companion class
 o setJitter
 public void setJitter(int j)
Set level of jitter and repaint the plot using the new jitter value

Parameters:
j - the level of jitter
 o setColours
 public void setColours(FastVector cols)
Set a list of colours to use when colouring points according to class values or cluster numbers

Parameters:
cols - the list of colours to use
 o setXindex
 public void setXindex(int x)
Set the index of the attribute to go on the x axis

Parameters:
x - the index of the attribute to use on the x axis
 o setYindex
 public void setYindex(int y)
Set the index of the attribute to go on the y axis

Parameters:
y - the index of the attribute to use on the y axis
 o setCindex
 public void setCindex(int c)
Set the index of the attribute to use for colouring

Parameters:
c - the index of the attribute to use for colouring
 o getPlots
 public FastVector getPlots()
Return the list of plots

Returns:
the list of plots
 o getMasterPlot
 public PlotData2D getMasterPlot()
Get the master plot

Returns:
the master plot
 o getMaxX
 public double getMaxX()
Return the current max value of the attribute plotted on the x axis

Returns:
the max x value
 o getMaxY
 public double getMaxY()
Return the current max value of the attribute plotted on the y axis

Returns:
the max y value
 o getMinX
 public double getMinX()
Return the current min value of the attribute plotted on the x axis

Returns:
the min x value
 o getMinY
 public double getMinY()
Return the current min value of the attribute plotted on the y axis

Returns:
the min y value
 o getMaxC
 public double getMaxC()
Return the current max value of the colouring attribute

Returns:
the max colour value
 o getMinC
 public double getMinC()
Return the current min value of the colouring attribute

Returns:
the min colour value
 o setInstances
 public void setInstances(Instances inst) throws Exception
Sets the master plot from a set of instances

Parameters:
inst - the instances
Throws: exception
Exception if instances could not be set
 o setMasterPlot
 public void setMasterPlot(PlotData2D master) throws Exception
Set the master plot.

Parameters:
master - the plot to make the master plot
Throws: Exception
if the plot could not be set.
 o removeAllPlots
 public void removeAllPlots()
Clears all plots

 o addPlot
 public void addPlot(PlotData2D newPlot) throws Exception
Add a plot to the list of plots to display

Parameters:
newPlot - the new plot to add
Throws: Exception
if the plot could not be added
 o searchPoints
 public void searchPoints(int x,
                          int y,
                          boolean newFrame)
Pops up a window displaying attribute information on any instances at a point+-plotting_point_size (in panel coordinates)

Parameters:
x - the x value of the clicked point
y - the y value of the clicked point
newFrame - true if instance info is to be displayed in a new frame.
 o determineBounds
 public void determineBounds()
Determine the min and max values for axis and colouring attributes

 o convertToAttribX
 public double convertToAttribX(double scx)
convert a Panel x coordinate to a raw x value.

Parameters:
scx - The Panel x coordinate
Returns:
A raw x value.
 o convertToAttribY
 public double convertToAttribY(double scy)
convert a Panel y coordinate to a raw y value.

Parameters:
scy - The Panel y coordinate
Returns:
A raw y value.
 o convertToPanelX
 public double convertToPanelX(double xval)
Convert an raw x value to Panel x coordinate.

Parameters:
xval - the raw x value
Returns:
an x value for plotting in the panel.
 o convertToPanelY
 public double convertToPanelY(double yval)
Convert an raw y value to Panel y coordinate.

Parameters:
yval - the raw y value
Returns:
an y value for plotting in the panel.
 o paintComponent
 public void paintComponent(Graphics gx)
Renders this component

Parameters:
gx - the graphics context
Overrides:
paintComponent in class JComponent
 o main
 public static void main(String args[])
Main method for testing this class

Parameters:
args - arguments

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home