Class Plot2D

    • Constructor Detail

      • Plot2D

        public Plot2D()
        Constructor
    • Method Detail

      • applySettings

        public void applySettings​(Settings settings,
                                  String ownerID)
        Apply settings
        Parameters:
        settings - the settings to apply
        ownerID - the ID of the owner perspective, panel etc. to use when looking up our settings
      • 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​(ArrayList<Color> 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 ArrayList<PlotData2D> 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 - 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
      • main

        public static void main​(String[] args)
        Main method for testing this class
        Parameters:
        args - arguments