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.
    • BarPlot

      public BarPlot(Bar[] bars, Legend[] legends)
      Constructor.
  • Method Details

    • paint

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

      public double[] getLowerBound()
      Description copied from class: Plot
      Returns the lower bound of data.
      Specified by:
      getLowerBound in class Plot
    • getUpperBound

      public double[] getUpperBound()
      Description copied from class: Plot
      Returns the upper bound of data.
      Specified by:
      getUpperBound in class Plot
    • legends

      public Optional<Legend[]> legends()
      Description copied from class: Plot
      Returns the optional name of shape, which will be used to draw a legend outside the box.
      Overrides:
      legends in class Plot
    • canvas

      public Canvas canvas()
      Description copied from class: Plot
      Returns a canvas of the plot.
      Overrides:
      canvas in class Plot
    • of

      public static BarPlot of(double[] data)
      Creates a bar plot.
    • of

      public static BarPlot of(int[] data)
      Creates 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.