Package smile.plot.swing
Class ScatterPlot
java.lang.Object
smile.plot.swing.Shape
smile.plot.swing.Plot
smile.plot.swing.ScatterPlot
The data is displayed as a collection of points.
-
Constructor Summary
ConstructorsConstructorDescriptionScatterPlot
(Point... points) Constructor.ScatterPlot
(Point[] points, Legend[] legends) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
Returns the lower bound of data.double[]
Returns the upper bound of data.legends()
Returns the optional legend of shape.static ScatterPlot
of
(double[][] points) Create a scatter plot.static ScatterPlot
of
(double[][] points, char mark) Create a scatter plot.static ScatterPlot
Create a scatter plot.static ScatterPlot
of
(double[][] x, int[] y, char mark) Creates a scatter plot of multiple groups of data.static ScatterPlot
Create a scatter plot.static ScatterPlot
Creates a scatter plot of multiple groups of data.static ScatterPlot
Creates a scatter plot from a data frame.static ScatterPlot
Creates a scatter plot from a data frame.static ScatterPlot
Creates a scatter plot from a data frame.static ScatterPlot
Creates a scatter plot from a data frame.void
Draws the shape.
-
Constructor Details
-
ScatterPlot
Constructor.- Parameters:
points
- an n-by-2 or n-by-3 matrix that describes coordinates of n points.
-
ScatterPlot
Constructor.- Parameters:
points
- an n-by-2 or n-by-3 matrix that describes coordinates of n points.legends
- the legends.
-
-
Method Details
-
paint
Description copied from class:Shape
Draws the shape. -
legends
Description copied from class:Plot
Returns the optional legend of shape. -
getLowerBound
public double[] getLowerBound()Description copied from class:Plot
Returns the lower bound of data.- Specified by:
getLowerBound
in classPlot
- Returns:
- the lower bound of data.
-
getUpperBound
public double[] getUpperBound()Description copied from class:Plot
Returns the upper bound of data.- Specified by:
getUpperBound
in classPlot
- Returns:
- the upper bound of data.
-
of
Create a scatter plot.- Parameters:
points
- an n-by-2 or n-by-3 matrix that describes coordinates of n points.- Returns:
- the scatter plot.
-
of
Create a scatter plot.- Parameters:
points
- an n-by-2 or n-by-3 matrix that describes coordinates of n points.color
- the point color.- Returns:
- the scatter plot.
-
of
Create a scatter plot.- Parameters:
points
- an n-by-2 or n-by-3 matrix that describes coordinates of n points.mark
- the point mark.- Returns:
- the scatter plot.
-
of
Create a scatter plot.- Parameters:
points
- an n-by-2 or n-by-3 matrix that describes coordinates of n points.mark
- the point mark.color
- the point color.- Returns:
- the scatter plot.
-
of
Creates a scatter plot of multiple groups of data.- Parameters:
x
- the data points. The elements should be of dimension 2 or 3.y
- the group label of data points.mark
- the point mark.- Returns:
- the scatter plot.
-
of
Creates a scatter plot of multiple groups of data.- Parameters:
x
- the data points. The elements should be of dimension 2 or 3.y
- the group label of data points.mark
- the point mark.- Returns:
- the scatter plot.
-
of
Creates a scatter plot from a data frame.- Parameters:
data
- the data frame.x
- the column as x-axis.y
- the column as y-axis.mark
- the point mark.color
- the point color.- Returns:
- the scatter plot.
-
of
Creates a scatter plot from a data frame.- Parameters:
data
- the data frame.x
- the column as x-axis.y
- the column as y-axis.category
- the category column for coloring.mark
- the point mark.- Returns:
- the scatter plot.
-
of
Creates a scatter plot from a data frame.- Parameters:
data
- the data frame.x
- the column as x-axis.y
- the column as y-axis.z
- the column as z-axis.mark
- the point mark.color
- the point color.- Returns:
- the scatter plot.
-
of
public static ScatterPlot of(DataFrame data, String x, String y, String z, String category, char mark) Creates a scatter plot from a data frame.- Parameters:
data
- the data frame.x
- the column as x-axis.y
- the column as y-axis.z
- the column as z-axis.category
- the category column for coloring.mark
- the point mark.- Returns:
- the scatter plot.
-