Package smile.plot.swing
Class BarPlot
java.lang.Object
smile.plot.swing.Shape
smile.plot.swing.Plot
smile.plot.swing.BarPlot
A barplot draws bars with heights proportional to the value.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfigure()
Returns a figure containing the plot.double[]
Returns the lower bound of data.double[]
Returns the upper bound of data.legends()
Returns the optional legend of shape.static BarPlot
of
(double[] data) Creates a bar plot.static BarPlot
Creates a bar plot of multiple groups/colors.static BarPlot
of
(int[] data) Creates a bar plot.void
Draws the shape.
-
Constructor Details
-
BarPlot
Constructor.- Parameters:
bars
- the bar shapes.
-
BarPlot
Constructor.- Parameters:
bars
- the bar shapes.legends
- the legends of bars.
-
-
Method Details
-
paint
Description copied from class:Shape
Draws the 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.
-
legends
Description copied from class:Plot
Returns the optional legend of shape. -
figure
Description copied from class:Plot
Returns a figure containing the plot. -
of
Creates a bar plot.- Parameters:
data
- the data.- Returns:
- a bar plot.
-
of
Creates a bar plot.- Parameters:
data
- the data.- Returns:
- a bar plot.
-
of
Creates a bar plot of multiple groups/colors.- Parameters:
data
- each row is a data set of bars (bar height).labels
- the group label of data points.- Returns:
- a bar plot.
-