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)
-
CONST_AUTOMATIC_SHAPE
-
-
DEFAULT_SHAPE_SIZE
-
-
DIAMOND_SHAPE
-
-
ERROR_SHAPE
-
-
MAX_SHAPES
-
-
MISSING_SHAPE
-
-
PLUS_SHAPE
-
-
TRIANGLEDOWN_SHAPE
-
-
TRIANGLEUP_SHAPE
-
-
X_SHAPE
-
-
Plot2D()
- Constructor
-
addPlot(PlotData2D)
- Add a plot to the list of plots to display
-
convertToAttribX(double)
- convert a Panel x coordinate to a raw x value.
-
convertToAttribY(double)
- convert a Panel y coordinate to a raw y value.
-
convertToPanelX(double)
- Convert an raw x value to Panel x coordinate.
-
convertToPanelY(double)
- Convert an raw y value to Panel y coordinate.
-
determineBounds()
- Determine the min and max values for axis and colouring attributes
-
getMasterPlot()
- Get the master plot
-
getMaxC()
-
Return the current max value of the colouring attribute
-
getMaxX()
-
Return the current max value of the attribute plotted on the x axis
-
getMaxY()
-
Return the current max value of the attribute plotted on the y axis
-
getMinC()
-
Return the current min value of the colouring attribute
-
getMinX()
-
Return the current min value of the attribute plotted on the x axis
-
getMinY()
-
Return the current min value of the attribute plotted on the y axis
-
getPlots()
- Return the list of plots
-
main(String[])
- Main method for testing this class
-
paintComponent(Graphics)
- Renders this component
-
removeAllPlots()
- Clears all plots
-
searchPoints(int, int, boolean)
- Pops up a window displaying attribute information on any instances
at a point+-plotting_point_size (in panel coordinates)
-
setCindex(int)
- Set the index of the attribute to use for colouring
-
setColours(FastVector)
- Set a list of colours to use when colouring points according
to class values or cluster numbers
-
setInstances(Instances)
- Sets the master plot from a set of instances
-
setJitter(int)
- Set level of jitter and repaint the plot using the new jitter value
-
setMasterPlot(PlotData2D)
- Set the master plot.
-
setPlotCompanion(Plot2DCompanion)
- Set a companion class.
-
setXindex(int)
- Set the index of the attribute to go on the x axis
-
setYindex(int)
- Set the index of the attribute to go on the y axis
MAX_SHAPES
public static final int MAX_SHAPES
ERROR_SHAPE
public static final int ERROR_SHAPE
MISSING_SHAPE
public static final int MISSING_SHAPE
CONST_AUTOMATIC_SHAPE
public static final int CONST_AUTOMATIC_SHAPE
X_SHAPE
public static final int X_SHAPE
PLUS_SHAPE
public static final int PLUS_SHAPE
DIAMOND_SHAPE
public static final int DIAMOND_SHAPE
TRIANGLEUP_SHAPE
public static final int TRIANGLEUP_SHAPE
TRIANGLEDOWN_SHAPE
public static final int TRIANGLEDOWN_SHAPE
DEFAULT_SHAPE_SIZE
public static final int DEFAULT_SHAPE_SIZE
Plot2D
public Plot2D()
- Constructor
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
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
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
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
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
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
getPlots
public FastVector getPlots()
- Return the list of plots
- Returns:
- the list of plots
getMasterPlot
public PlotData2D getMasterPlot()
- Get the master plot
- Returns:
- the master plot
getMaxX
public double getMaxX()
- Return the current max value of the attribute plotted on the x axis
- Returns:
- the max x value
getMaxY
public double getMaxY()
- Return the current max value of the attribute plotted on the y axis
- Returns:
- the max y value
getMinX
public double getMinX()
- Return the current min value of the attribute plotted on the x axis
- Returns:
- the min x value
getMinY
public double getMinY()
- Return the current min value of the attribute plotted on the y axis
- Returns:
- the min y value
getMaxC
public double getMaxC()
- Return the current max value of the colouring attribute
- Returns:
- the max colour value
getMinC
public double getMinC()
- Return the current min value of the colouring attribute
- Returns:
- the min colour value
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
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.
removeAllPlots
public void removeAllPlots()
- Clears all plots
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
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.
determineBounds
public void determineBounds()
- Determine the min and max values for axis and colouring attributes
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.
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.
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.
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.
paintComponent
public void paintComponent(Graphics gx)
- Renders this component
- Parameters:
- gx - the graphics context
- Overrides:
- paintComponent in class JComponent
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