Class Line
java.lang.Object
smile.plot.swing.Shape
smile.plot.swing.Line
This class represents a poly line in the plot.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionLine(double[][] points, Line.Style style, char mark, Color color) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic Lineof(double[][] points) Creates a Line with solid stroke and black color.static Lineof(double[][] points, char mark) Creates a Line.static LineCreates a Line.static Lineof(double[][] points, Line.Style style) Creates a Line.static Lineof(double[][] points, Line.Style style, Color color) Creates a Line.voidDraws the shape.static double[][]zipWithIndex(double[] y) Returns a 2-dimensional array with the index as the x coordinate.
-
Constructor Details
-
Line
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
-
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.- Returns:
- 2-dimensional array with the index as the x coordinate.
-
of
Creates a Line with solid stroke and black color.- Parameters:
points- the points.- Returns:
- the line.
-
of
Creates a Line.- Parameters:
points- the points.style- the line style.- Returns:
- the line.
-
of
Creates a Line.- Parameters:
points- the points.mark- the point mark.- Returns:
- the line.
-
of
-
of
Creates a Line.- Parameters:
points- the points.style- the line style.color- the color of line.- Returns:
- the line.
-