Class Line


public class Line extends Shape
This class represents a poly line in the plot.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The supported styles of lines.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Line(double[][] points, Line.Style style, char mark, Color color)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Line
    of(double[][] points)
    Creates a Line with solid stroke and black color.
    static Line
    of(double[][] points, char mark)
    Creates a Line.
    static Line
    of(double[][] points, Color color)
    Creates a Line.
    static Line
    of(double[][] points, Line.Style style)
    Creates a Line.
    static Line
    of(double[][] points, Line.Style style, Color color)
    Creates a Line.
    void
    Draws the shape.
    static double[][]
    zipWithIndex(double[] y)
    Returns a 2-dimensional array with the index as the x coordinate.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Line

      public Line(double[][] points, Line.Style style, char mark, Color color)
      Constructor.
      Parameters:
      points - an n-by-2 or n-by-3 matrix that are the coordinates of points.
      style - the style of line.
      mark - the mark of points.
      • white space : don't draw the 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
      color - the color of line.
  • Method Details

    • paint

      public void paint(Graphics g)
      Description copied from class: Shape
      Draws the shape.
      Specified by:
      paint in class Shape
    • zipWithIndex

      public static double[][] zipWithIndex(double[] y)
      Returns a 2-dimensional array with the index as the x coordinate.
      Parameters:
      y - the data vector of y coordinates. The x coordinates will be [0, n), where n is the length of y.
    • of

      public static Line of(double[][] points)
      Creates a Line with solid stroke and black color.
    • of

      public static Line of(double[][] points, Line.Style style)
      Creates a Line.
    • of

      public static Line of(double[][] points, char mark)
      Creates a Line.
    • of

      public static Line of(double[][] points, Color color)
      Creates a Line.
    • of

      public static Line of(double[][] points, Line.Style style, Color color)
      Creates a Line.