smile.plot
Class BarPlot
- java.lang.Object
-
- smile.plot.Shape
-
- smile.plot.Plot
-
- smile.plot.BarPlot
-
-
Constructor Summary
Constructors Constructor and Description BarPlot(double[] data)Constructor.BarPlot(double[][] data)Constructor.BarPlot(int[] data)Constructor.BarPlot(int[][] data)Constructor.BarPlot(java.lang.String[] description, double[] data)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.StringgetToolTip(double[] coord)Returns a optional tool tip for the object at given coordinates.doublegetWidth()Returns the width of bar.voidpaint(Graphics g)Draw the component with given graphics object.static PlotCanvasplot(double[]... data)Create a plot canvas with the bar plot of given data.static PlotCanvasplot(double[] data)Create a plot canvas with the bar plot of given data.static PlotCanvasplot(double[] data, java.lang.String[] labels)Create a plot canvas with the bar plot of given data.static PlotCanvasplot(java.lang.String id, double[]... data)Create a plot canvas with the bar plot of given data.static PlotCanvasplot(java.lang.String id, double[] data)Create a plot canvas with the bar plot of given data.static PlotCanvasplot(java.lang.String id, double[] data, java.lang.String[] labels)Create a plot canvas with the bar plot of given data.-
Methods inherited from class smile.plot.Plot
getID, getToolBar, setID
-
-
-
-
Constructor Detail
-
BarPlot
public BarPlot(int[] data)
Constructor.
-
BarPlot
public BarPlot(double[] data)
Constructor.
-
BarPlot
public BarPlot(java.lang.String[] description, double[] data)Constructor.
-
BarPlot
public BarPlot(int[][] data)
Constructor.
-
BarPlot
public BarPlot(double[][] data)
Constructor.
-
-
Method Detail
-
getWidth
public double getWidth()
Returns the width of bar.
-
getToolTip
public java.lang.String getToolTip(double[] coord)
Description copied from class:PlotReturns a optional tool tip for the object at given coordinates.- Overrides:
getToolTipin classPlot- Parameters:
coord- the logical coordinates of current mouse position.- Returns:
- a string if an object with label close to the given coordinates. Otherwise null.
-
paint
public void paint(Graphics g)
Description copied from class:ShapeDraw the component with given graphics object.
-
plot
public static PlotCanvas plot(double[] data)
Create a plot canvas with the bar plot of given data.- Parameters:
data- a vector of which values will determine the heights of bars.
-
plot
public static PlotCanvas plot(java.lang.String id, double[] data)
Create a plot canvas with the bar plot of given data.- Parameters:
id- the id of the plot.data- a vector of which values will determine the heights of bars.
-
plot
public static PlotCanvas plot(double[] data, java.lang.String[] labels)
Create a plot canvas with the bar plot of given data.- Parameters:
data- a vector of which values will determine the heights of bars.labels- the labels for each bar.
-
plot
public static PlotCanvas plot(java.lang.String id, double[] data, java.lang.String[] labels)
Create a plot canvas with the bar plot of given data.- Parameters:
id- the id of the plot.data- a vector of which values will determine the heights of bars.labels- the labels for each bar.
-
plot
public static PlotCanvas plot(double[]... data)
Create a plot canvas with the bar plot of given data.- Parameters:
data- a n x 2 matrix of which data[][0] determine the location of bars and data[][1] determine the heights of bars. data[][0] will also be used as the labels. For best view, data[][0] should be monotonic.
-
plot
public static PlotCanvas plot(java.lang.String id, double[]... data)
Create a plot canvas with the bar plot of given data.- Parameters:
id- the id of the plot.data- a n x 2 matrix of which data[][0] determine the location of bars and data[][1] determine the heights of bars. data[][0] will also be used as the labels. For best view, data[][0] should be monotonic.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG