Documentation of 'smile.plot.BarPlot' Java class
BarPlot
smile.plot

Class BarPlot

  • Direct Known Subclasses:
    Histogram


    public class BarPlot
    extends Plot
    A barplot draws bars with heights proportional to the value.
    • 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.String getToolTip(double[] coord)
      Returns a optional tool tip for the object at given coordinates.
      double getWidth()
      Returns the width of bar.
      void paint(Graphics g)
      Draw the component with given graphics object.
      static PlotCanvas plot(double[]... data)
      Create a plot canvas with the bar plot of given data.
      static PlotCanvas plot(double[] data)
      Create a plot canvas with the bar plot of given data.
      static PlotCanvas plot(double[] data, java.lang.String[] labels)
      Create a plot canvas with the bar plot of given data.
      static PlotCanvas plot(java.lang.String id, double[]... data)
      Create a plot canvas with the bar plot of given data.
      static PlotCanvas plot(java.lang.String id, double[] data)
      Create a plot canvas with the bar plot of given data.
      static PlotCanvas plot(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 java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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: Plot
        Returns a optional tool tip for the object at given coordinates.
        Overrides:
        getToolTip in class Plot
        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: Shape
        Draw the component with given graphics object.
        Specified by:
        paint in class Shape
      • 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

You see the box below because you did not login.