Documentation of 'smile.plot.PlotCanvas' Java class
PlotCanvas
smile.plot

Class PlotCanvas

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible


    public class PlotCanvas
    extends javax.swing.JPanel
    Canvas for mathematical plots.

    For both 2D and 3D plot, the user can zoom in/out by mouse wheel. For 2D plot, the user can shift the coordinates by moving mouse after double click. The user can also select an area by mouse for detailed view. For 3D plot, the user can rotate the view by dragging mouse.

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      • Fields inherited from class javax.swing.JComponent

        TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor and Description
      PlotCanvas(double[] lowerBound, double[] upperBound)
      Constructor
      PlotCanvas(double[] lowerBound, double[] upperBound, boolean extendBound)
      Constructor
      PlotCanvas(double[] lowerBound, double[] upperBound, java.lang.String[] axisLabels)
      Constructor
      PlotCanvas(double[] lowerBound, double[] upperBound, java.lang.String[] axisLabels, boolean extendBound)
      Constructor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void add(Plot p)
      Add a graphical shape to the canvas.
      void add(Shape p)
      Add a graphical shape to the canvas.
      void clear()
      Remove all graphic plots from the canvas.
      void extendBound(double[] lowerBound, double[] upperBound)
      Extend lower and upper bounds.
      void extendLowerBound(double[] bound)
      Extend lower bounds.
      void extendUpperBound(double[] bound)
      Extend upper bounds.
      Axis getAxis(int i)
      Returns the i-th axis.
      java.lang.String getAxisLabel(int axis)
      Returns the label/legend of an axis.
      java.lang.String[] getAxisLabels()
      Returns the labels/legends of axes.
      Base getBase()
      Returns the coordinate base.
      double[] getLowerBounds()
      Returns the lower bounds.
      double getMargin()
      Returns the size of margin, which is not used as plot area.
      java.util.List<Shape> getShapes()
      Returns the list of shapes in the canvas.
      java.lang.String getTitle()
      Returns the main title of canvas.
      java.awt.Color getTitleColor()
      Returns the color for title.
      java.awt.Font getTitleFont()
      Returns the font for title.
      javax.swing.JComponent getToolbar()
      Returns a tool bar to control the plot.
      double[] getUpperBounds()
      Returns the upper bounds.
      Grid grid(double[][][] data)
      Adds a 2D grid plot to the canvas.
      Histogram histogram(double[] data, java.awt.Color color)
      Adds a histogram to this canvas.
      Histogram histogram(double[] data, double[] breaks, java.awt.Color color)
      Adds a histogram to this canvas.
      Histogram histogram(double[] data, int k, java.awt.Color color)
      Adds a histogram to this canvas.
      Histogram histogram(int[] data, java.awt.Color color)
      Adds a histogram to this canvas.
      Histogram histogram(int[] data, double[] breaks, java.awt.Color color)
      Adds a histogram to this canvas.
      Histogram histogram(int[] data, int k, java.awt.Color color)
      Adds a histogram to this canvas.
      Histogram histogram(java.lang.String id, double[] data, java.awt.Color color)
      Adds a histogram to this canvas.
      Histogram histogram(java.lang.String id, double[] data, double[] breaks, java.awt.Color color)
      Adds a histogram to this canvas.
      Histogram histogram(java.lang.String id, double[] data, int k, java.awt.Color color)
      Adds a histogram to this canvas.
      Histogram histogram(java.lang.String id, int[] data, java.awt.Color color)
      Adds a histogram to this canvas.
      Histogram histogram(java.lang.String id, int[] data, double[] breaks, java.awt.Color color)
      Adds a histogram to this canvas.
      Histogram histogram(java.lang.String id, int[] data, int k, java.awt.Color color)
      Adds a histogram to this canvas.
      void label(java.lang.String text, java.awt.Color color, double... coord)
      Adds a label to this canvas.
      void label(java.lang.String text, double... coord)
      Adds a label to this canvas.
      void label(java.lang.String text, java.awt.Font font, java.awt.Color color, double... coord)
      Adds a label to this canvas.
      void label(java.lang.String text, java.awt.Font font, double... coord)
      Adds a label to this canvas.
      LinePlot line(double[]... data)
      Adds a poly line plot to this canvas.
      LinePlot line(double[] y)
      Adds a poly line plot to this canvas.
      LinePlot line(double[][] data, java.awt.Color color)
      Adds a poly line plot to this canvas.
      LinePlot line(double[][] data, Line.Style style)
      Adds a poly line plot to this canvas.
      LinePlot line(double[][] data, Line.Style style, java.awt.Color color)
      Adds a poly line plot to this canvas.
      LinePlot line(double[] y, java.awt.Color color)
      Adds a poly line plot to this canvas.
      LinePlot line(double[] y, Line.Style style)
      Add a poly line plot of given data into the current canvas.
      LinePlot line(double[] y, Line.Style style, java.awt.Color color)
      Adds a poly line plot to this canvas.
      LinePlot line(java.lang.String id, double[]... data)
      Adds a poly line plot to this canvas.
      LinePlot line(java.lang.String id, double[] y)
      Adds a poly line plot to this canvas.
      LinePlot line(java.lang.String id, double[][] data, java.awt.Color color)
      Adds a poly line plot to this canvas.
      LinePlot line(java.lang.String id, double[][] data, Line.Style style)
      Adds a poly line plot to this canvas.
      LinePlot line(java.lang.String id, double[][] data, Line.Style style, java.awt.Color color)
      Adds a poly line plot to this canvas.
      LinePlot line(java.lang.String id, double[] y, java.awt.Color color)
      Adds a poly line plot to this canvas.
      LinePlot line(java.lang.String id, double[] y, Line.Style style)
      Adds a poly line plot to this canvas.
      LinePlot line(java.lang.String id, double[] y, Line.Style style, java.awt.Color color)
      Add a poly line plot of given data into the current canvas.
      void point(char legend, java.awt.Color color, double... coord)
      Adds a point to this canvas.
      void point(char legend, double... coord)
      Adds a point to this canvas.
      void point(java.awt.Color color, double... coord)
      Adds a point to this canvas.
      void point(double... coord)
      Adds a point to this canvas.
      ScatterPlot points(double[]... data)
      Adds a scatter plot to this canvas.
      ScatterPlot points(double[][] data, char legend)
      Adds a scatter plot to this canvas.
      ScatterPlot points(double[][] data, char legend, java.awt.Color color)
      Adds a scatter plot to this canvas.
      ScatterPlot points(double[][] data, java.awt.Color color)
      Adds a scatter plot to this canvas.
      ScatterPlot points(double[][] data, java.lang.String[] labels)
      Adds a scatter plot to this canvas.
      ScatterPlot points(java.lang.String id, double[]... data)
      Adds a scatter plot to this canvas.
      ScatterPlot points(java.lang.String id, double[][] data, char legend)
      Adds a scatter plot to this canvas.
      ScatterPlot points(java.lang.String id, double[][] data, char legend, java.awt.Color color)
      Adds a scatter plot to this canvas.
      ScatterPlot points(java.lang.String id, double[][] data, java.awt.Color color)
      Adds a scatter plot to this canvas.
      ScatterPlot points(java.lang.String id, double[][] data, java.lang.String[] labels)
      Adds a scatter plot to this canvas.
      void print()
      Prints the plot.
      void remove(Plot p)
      Remove a graphical shape from the canvas.
      void remove(Shape p)
      Remove a graphical shape from the canvas.
      void reset()
      Resets the plot.
      void save()
      Shows a file chooser and exports the plot to the selected image file.
      void save(java.io.File file)
      Exports the plot to an image file.
      static PlotCanvas screeplot(PCA pca)
      Create a scree plot for PCA.
      PlotCanvas setAxisLabel(int axis, java.lang.String label)
      Sets the label/legend of an axis.
      PlotCanvas setAxisLabels(java.lang.String... labels)
      Sets the labels/legends of axes.
      PlotCanvas setMargin(double margin)
      Sets the size of margin in [0.0, 0.3] on each side.
      PlotCanvas setTitle(java.lang.String title)
      Set the main title of canvas.
      PlotCanvas setTitleColor(java.awt.Color color)
      Set the color for title.
      PlotCanvas setTitleFont(java.awt.Font font)
      Set the font for title.
      StaircasePlot staircase(double[][] data, java.awt.Color color)
      Adds a staircase line plot to this canvas.
      StaircasePlot staircase(java.lang.String id, double[][] data, java.awt.Color color)
      Adds a staircase line plot to this canvas.
      void zoom(boolean inout)
      Zooms in/out the plot.
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PlotCanvas

        public PlotCanvas(double[] lowerBound,
                          double[] upperBound)
        Constructor
      • PlotCanvas

        public PlotCanvas(double[] lowerBound,
                          double[] upperBound,
                          boolean extendBound)
        Constructor
      • PlotCanvas

        public PlotCanvas(double[] lowerBound,
                          double[] upperBound,
                          java.lang.String[] axisLabels)
        Constructor
      • PlotCanvas

        public PlotCanvas(double[] lowerBound,
                          double[] upperBound,
                          java.lang.String[] axisLabels,
                          boolean extendBound)
        Constructor
    • Method Detail

      • getToolbar

        public javax.swing.JComponent getToolbar()
        Returns a tool bar to control the plot.
        Returns:
        a tool bar to control the plot.
      • save

        public void save()
                  throws java.io.IOException
        Shows a file chooser and exports the plot to the selected image file.
        Throws:
        java.io.IOException - if an error occurs during writing.
      • save

        public void save(java.io.File file)
                  throws java.io.IOException
        Exports the plot to an image file.
        Parameters:
        file - the destination file.
        Throws:
        java.io.IOException - if an error occurs during writing.
      • print

        public void print()
        Prints the plot.
      • zoom

        public void zoom(boolean inout)
        Zooms in/out the plot.
        Parameters:
        inout - true if zoom in. Otherwise, zoom out.
      • reset

        public void reset()
        Resets the plot.
      • getMargin

        public double getMargin()
        Returns the size of margin, which is not used as plot area. Currently, all four sides have the same margin size.
        Returns:
        the size of margin.
      • setMargin

        public PlotCanvas setMargin(double margin)
        Sets the size of margin in [0.0, 0.3] on each side. Currently, all four sides have the same margin size.
        Parameters:
        margin - the size of margin.
      • getBase

        public Base getBase()
        Returns the coordinate base.
        Returns:
        the coordinate base.
      • getTitle

        public java.lang.String getTitle()
        Returns the main title of canvas.
      • setTitle

        public PlotCanvas setTitle(java.lang.String title)
        Set the main title of canvas.
      • getTitleFont

        public java.awt.Font getTitleFont()
        Returns the font for title.
      • getTitleColor

        public java.awt.Color getTitleColor()
        Returns the color for title.
      • setTitleFont

        public PlotCanvas setTitleFont(java.awt.Font font)
        Set the font for title.
      • setTitleColor

        public PlotCanvas setTitleColor(java.awt.Color color)
        Set the color for title.
      • getAxis

        public Axis getAxis(int i)
        Returns the i-th axis.
      • getAxisLabels

        public java.lang.String[] getAxisLabels()
        Returns the labels/legends of axes.
      • getAxisLabel

        public java.lang.String getAxisLabel(int axis)
        Returns the label/legend of an axis.
      • setAxisLabels

        public PlotCanvas setAxisLabels(java.lang.String... labels)
        Sets the labels/legends of axes.
      • setAxisLabel

        public PlotCanvas setAxisLabel(int axis,
                                       java.lang.String label)
        Sets the label/legend of an axis.
      • getShapes

        public java.util.List<Shape> getShapes()
        Returns the list of shapes in the canvas.
        Returns:
        the list of shapes in the canvas.
      • add

        public void add(Shape p)
        Add a graphical shape to the canvas.
      • remove

        public void remove(Shape p)
        Remove a graphical shape from the canvas.
      • add

        public void add(Plot p)
        Add a graphical shape to the canvas.
      • remove

        public void remove(Plot p)
        Remove a graphical shape from the canvas.
      • clear

        public void clear()
        Remove all graphic plots from the canvas.
      • getLowerBounds

        public double[] getLowerBounds()
        Returns the lower bounds.
      • getUpperBounds

        public double[] getUpperBounds()
        Returns the upper bounds.
      • extendLowerBound

        public void extendLowerBound(double[] bound)
        Extend lower bounds.
      • extendUpperBound

        public void extendUpperBound(double[] bound)
        Extend upper bounds.
      • extendBound

        public void extendBound(double[] lowerBound,
                                double[] upperBound)
        Extend lower and upper bounds.
      • label

        public void label(java.lang.String text,
                          double... coord)
        Adds a label to this canvas.
      • label

        public void label(java.lang.String text,
                          java.awt.Font font,
                          double... coord)
        Adds a label to this canvas.
      • label

        public void label(java.lang.String text,
                          java.awt.Color color,
                          double... coord)
        Adds a label to this canvas.
      • label

        public void label(java.lang.String text,
                          java.awt.Font font,
                          java.awt.Color color,
                          double... coord)
        Adds a label to this canvas.
      • point

        public void point(double... coord)
        Adds a point to this canvas.
      • point

        public void point(char legend,
                          double... coord)
        Adds a point to this canvas.
      • point

        public void point(java.awt.Color color,
                          double... coord)
        Adds a point to this canvas.
      • point

        public void point(char legend,
                          java.awt.Color color,
                          double... coord)
        Adds a point to this canvas.
      • points

        public ScatterPlot points(double[]... data)
        Adds a scatter plot to this canvas.
        Parameters:
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        Returns:
        the scatter plot for the given points.
      • points

        public ScatterPlot points(java.lang.String id,
                                  double[]... data)
        Adds a scatter plot to this canvas.
        Parameters:
        id - the id of the plot.
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        Returns:
        the scatter plot for the given points.
      • points

        public ScatterPlot points(double[][] data,
                                  java.lang.String[] labels)
        Adds a scatter plot to this canvas.
        Parameters:
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        labels - labels of points.
        Returns:
        the scatter plot for the given points.
      • points

        public ScatterPlot points(java.lang.String id,
                                  double[][] data,
                                  java.lang.String[] labels)
        Adds a scatter plot to this canvas.
        Parameters:
        id - the id of the plot.
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        labels - labels of points.
        Returns:
        the scatter plot for the given points.
      • points

        public ScatterPlot points(double[][] data,
                                  char legend)
        Adds a scatter plot to this canvas.
        Parameters:
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        legend - the legend used to draw points.
        • . : dot
        • + : +
        • - : -
        • | : |
        • * : star
        • x : x
        • o : circle
        • O : large circle
        • @ : solid circle
        • # : large solid circle
        • s : square
        • S : large square
        • q : solid square
        • Q : large solid square
        • others : dot
        Returns:
        the scatter plot for the given points.
      • points

        public ScatterPlot points(java.lang.String id,
                                  double[][] data,
                                  char legend)
        Adds a scatter plot to this canvas.
        Parameters:
        id - the id of the plot.
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        legend - the legend used to draw points.
        • . : dot
        • + : +
        • - : -
        • | : |
        • * : star
        • x : x
        • o : circle
        • O : large circle
        • @ : solid circle
        • # : large solid circle
        • s : square
        • S : large square
        • q : solid square
        • Q : large solid square
        • others : dot
        Returns:
        the scatter plot for the given points.
      • points

        public ScatterPlot points(double[][] data,
                                  java.awt.Color color)
        Adds a scatter plot to this canvas.
        Parameters:
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        color - the color used to draw points.
        Returns:
        the scatter plot for the given points.
      • points

        public ScatterPlot points(java.lang.String id,
                                  double[][] data,
                                  java.awt.Color color)
        Adds a scatter plot to this canvas.
        Parameters:
        id - the id of the plot.
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        color - the color used to draw points.
        Returns:
        the scatter plot for the given points.
      • points

        public ScatterPlot points(double[][] data,
                                  char legend,
                                  java.awt.Color color)
        Adds a scatter plot to this canvas.
        Parameters:
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        color - the color used to draw points.
        legend - the legend used to draw points.
        • . : dot
        • + : +
        • - : -
        • | : |
        • * : star
        • x : x
        • o : circle
        • O : large circle
        • @ : solid circle
        • # : large solid circle
        • s : square
        • S : large square
        • q : solid square
        • Q : large solid square
        • others : dot
        Returns:
        the scatter plot for the given points.
      • points

        public ScatterPlot points(java.lang.String id,
                                  double[][] data,
                                  char legend,
                                  java.awt.Color color)
        Adds a scatter plot to this canvas.
        Parameters:
        id - the id of the plot.
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        color - the color used to draw points.
        legend - the legend used to draw points.
        • . : dot
        • + : +
        • - : -
        • | : |
        • * : star
        • x : x
        • o : circle
        • O : large circle
        • @ : solid circle
        • # : large solid circle
        • s : square
        • S : large square
        • q : solid square
        • Q : large solid square
        • others : dot
        Returns:
        the scatter plot for the given points.
      • line

        public LinePlot line(double[] y)
        Adds a poly line plot to this canvas.
        Parameters:
        y - a data vector that describes y coordinates of points. The x coordinates will be [0, n), where n is the length of y.
      • line

        public LinePlot line(java.lang.String id,
                             double[] y)
        Adds a poly line plot to this canvas.
        Parameters:
        id - the id of the plot.
        y - a data vector that describes y coordinates of points. The x coordinates will be [0, n), where n is the length of y.
      • line

        public LinePlot line(double[] y,
                             java.awt.Color color)
        Adds a poly line plot to this canvas.
        Parameters:
        y - a data vector that describes y coordinates of points. The x coordinates will be [0, n), where n is the length of y.
        color - the color of line.
      • line

        public LinePlot line(java.lang.String id,
                             double[] y,
                             java.awt.Color color)
        Adds a poly line plot to this canvas.
        Parameters:
        id - the id of the plot.
        y - a data vector that describes y coordinates of points. The x coordinates will be [0, n), where n is the length of y.
        color - the color of line.
      • line

        public LinePlot line(double[] y,
                             Line.Style style)
        Add a poly line plot of given data into the current canvas.
        Parameters:
        y - a data vector that describes y coordinates of points. The x coordinates will be [0, n), where n is the length of y.
        style - the stroke style of line.
      • line

        public LinePlot line(java.lang.String id,
                             double[] y,
                             Line.Style style)
        Adds a poly line plot to this canvas.
        Parameters:
        id - the id of the plot.
        y - a data vector that describes y coordinates of points. The x coordinates will be [0, n), where n is the length of y.
        style - the stroke style of line.
      • line

        public LinePlot line(double[] y,
                             Line.Style style,
                             java.awt.Color color)
        Adds a poly line plot to this canvas.
        Parameters:
        y - a data vector that describes y coordinates of points. The x coordinates will be [0, n), where n is the length of y.
        style - the stroke style of line.
        color - the color of line.
      • line

        public LinePlot line(java.lang.String id,
                             double[] y,
                             Line.Style style,
                             java.awt.Color color)
        Add a poly line plot of given data into the current canvas.
        Parameters:
        id - the id of the plot.
        y - a data vector that describes y coordinates of points. The x coordinates will be [0, n), where n is the length of y.
        style - the stroke style of line.
        color - the color of line.
      • line

        public LinePlot line(double[]... data)
        Adds a poly line plot to this canvas.
        Parameters:
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
      • line

        public LinePlot line(java.lang.String id,
                             double[]... data)
        Adds a poly line plot to this canvas.
        Parameters:
        id - the id of the plot.
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
      • line

        public LinePlot line(double[][] data,
                             java.awt.Color color)
        Adds a poly line plot to this canvas.
        Parameters:
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        color - the color of line.
      • line

        public LinePlot line(java.lang.String id,
                             double[][] data,
                             java.awt.Color color)
        Adds a poly line plot to this canvas.
        Parameters:
        id - the id of the plot.
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        color - the color of line.
      • line

        public LinePlot line(double[][] data,
                             Line.Style style)
        Adds a poly line plot to this canvas.
        Parameters:
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        style - the stroke style of line.
      • line

        public LinePlot line(java.lang.String id,
                             double[][] data,
                             Line.Style style)
        Adds a poly line plot to this canvas.
        Parameters:
        id - the id of the plot.
        data - a n-by-2 or n-by-3 matrix that describes coordinates of points.
        style - the stroke style of line.
      • line

        public LinePlot line(double[][] data,
                             Line.Style style,
                             java.awt.Color color)
        Adds a poly line plot to this canvas.
        Parameters:
        data - a n x 2 or n x 3 matrix that describes coordinates of points.
        style - the stroke style of line.
        color - the color of line.
      • line

        public LinePlot line(java.lang.String id,
                             double[][] data,
                             Line.Style style,
                             java.awt.Color color)
        Adds a poly line plot to this canvas.
        Parameters:
        id - the id of the plot.
        data - a n x 2 or n x 3 matrix that describes coordinates of points.
        style - the stroke style of line.
        color - the color of line.
      • staircase

        public StaircasePlot staircase(double[][] data,
                                       java.awt.Color color)
        Adds a staircase line plot to this canvas.
        Parameters:
        data - a n x 2 or n x 3 matrix that describes coordinates of points.
        color - the color of line.
      • staircase

        public StaircasePlot staircase(java.lang.String id,
                                       double[][] data,
                                       java.awt.Color color)
        Adds a staircase line plot to this canvas.
        Parameters:
        id - the id of the plot.
        data - a n x 2 or n x 3 matrix that describes coordinates of points.
        color - the color of line.
      • histogram

        public Histogram histogram(double[] data,
                                   java.awt.Color color)
        Adds a histogram to this canvas.
        Parameters:
        data - a sample set.
      • histogram

        public Histogram histogram(java.lang.String id,
                                   double[] data,
                                   java.awt.Color color)
        Adds a histogram to this canvas.
        Parameters:
        id - the id of the plot.
        data - a sample set.
      • histogram

        public Histogram histogram(double[] data,
                                   int k,
                                   java.awt.Color color)
        Adds a histogram to this canvas.
        Parameters:
        data - a sample set.
        k - the number of bins.
      • histogram

        public Histogram histogram(java.lang.String id,
                                   double[] data,
                                   int k,
                                   java.awt.Color color)
        Adds a histogram to this canvas.
        Parameters:
        id - the id of the plot.
        data - a sample set.
        k - the number of bins.
      • histogram

        public Histogram histogram(double[] data,
                                   double[] breaks,
                                   java.awt.Color color)
        Adds a histogram to this canvas.
        Parameters:
        data - a sample set.
        breaks - an array of size k+1 giving the breakpoints between histogram cells. Must be in ascending order.
      • histogram

        public Histogram histogram(java.lang.String id,
                                   double[] data,
                                   double[] breaks,
                                   java.awt.Color color)
        Adds a histogram to this canvas.
        Parameters:
        id - the id of the plot.
        data - a sample set.
        breaks - an array of size k+1 giving the breakpoints between histogram cells. Must be in ascending order.
      • histogram

        public Histogram histogram(int[] data,
                                   java.awt.Color color)
        Adds a histogram to this canvas.
        Parameters:
        data - a sample set.
      • histogram

        public Histogram histogram(java.lang.String id,
                                   int[] data,
                                   java.awt.Color color)
        Adds a histogram to this canvas.
        Parameters:
        id - the id of the plot.
        data - a sample set.
      • histogram

        public Histogram histogram(int[] data,
                                   int k,
                                   java.awt.Color color)
        Adds a histogram to this canvas.
        Parameters:
        data - a sample set.
        k - the number of bins.
      • histogram

        public Histogram histogram(java.lang.String id,
                                   int[] data,
                                   int k,
                                   java.awt.Color color)
        Adds a histogram to this canvas.
        Parameters:
        id - the id of the plot.
        data - a sample set.
        k - the number of bins.
      • histogram

        public Histogram histogram(int[] data,
                                   double[] breaks,
                                   java.awt.Color color)
        Adds a histogram to this canvas.
        Parameters:
        data - a sample set.
        breaks - an array of size k+1 giving the breakpoints between histogram cells. Must be in ascending order.
      • histogram

        public Histogram histogram(java.lang.String id,
                                   int[] data,
                                   double[] breaks,
                                   java.awt.Color color)
        Adds a histogram to this canvas.
        Parameters:
        id - the id of the plot.
        data - a sample set.
        breaks - an array of size k+1 giving the breakpoints between histogram cells. Must be in ascending order.
      • grid

        public Grid grid(double[][][] data)
        Adds a 2D grid plot to the canvas.
        Parameters:
        data - an m x n x 2 array which are coordinates of m x n grid.
      • screeplot

        public static PlotCanvas screeplot(PCA pca)
        Create a scree plot for PCA.
        Parameters:
        pca - principal component analysis object.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.