Class BarPlot


public class BarPlot extends Plot
A barplot draws bars with heights proportional to the value.
  • Constructor Details

    • BarPlot

      public BarPlot(Bar... bars)
      Constructor.
      Parameters:
      bars - the bar shapes.
    • BarPlot

      public BarPlot(Bar[] bars, Legend[] legends)
      Constructor.
      Parameters:
      bars - the bar shapes.
      legends - the legends of bars.
  • Method Details

    • paint

      public void paint(Renderer g)
      Description copied from class: Shape
      Draws the shape.
      Specified by:
      paint in class Shape
      Parameters:
      g - the renderer.
    • getLowerBound

      public double[] getLowerBound()
      Description copied from class: Plot
      Returns the lower bound of data.
      Specified by:
      getLowerBound in class Plot
      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 class Plot
      Returns:
      the upper bound of data.
    • legends

      public Optional<Legend[]> legends()
      Description copied from class: Plot
      Returns the optional legend of shape.
      Overrides:
      legends in class Plot
      Returns:
      the optional legend of shape
    • figure

      public Figure figure()
      Description copied from class: Plot
      Returns a figure containing the plot.
      Overrides:
      figure in class Plot
      Returns:
      a figure containing the plot.
    • of

      public static BarPlot of(double[] data)
      Creates a bar plot.
      Parameters:
      data - the data.
      Returns:
      a bar plot.
    • of

      public static BarPlot of(int[] data)
      Creates a bar plot.
      Parameters:
      data - the data.
      Returns:
      a bar plot.
    • of

      public static BarPlot of(double[][] data, String[] labels)
      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.