Class Histogram

java.lang.Object
smile.plot.swing.Histogram

public class Histogram extends Object
A histogram is a graphical display of tabulated frequencies, shown as bars. It shows what proportion of cases fall into each of several categories: it is a form of data binning. The categories are usually specified as non-overlapping intervals of some variable. The categories (bars) must be adjacent. The intervals (or bands, or bins) are generally of the same size, and are most easily interpreted if they are.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static BarPlot
    of(double[] data)
    Creates a histogram plot.
    static BarPlot
    of(double[] data, double[] breaks, boolean prob)
    Creates a histogram plot.
    static BarPlot
    of(double[] data, double[] breaks, boolean prob, Color color)
    Creates a histogram plot.
    static BarPlot
    of(double[] data, int k, boolean prob)
    Creates a histogram plot.
    static BarPlot
    of(double[] data, int k, boolean prob, Color color)
    Creates a histogram plot.
    static BarPlot
    of(int[] data)
    Creates a histogram plot.
    static BarPlot
    of(int[] data, double[] breaks, boolean prob)
    Creates a histogram plot.
    static BarPlot
    of(int[] data, double[] breaks, boolean prob, Color color)
    Creates a histogram plot.
    static BarPlot
    of(int[] data, int k, boolean prob)
    Creates a histogram plot.
    static BarPlot
    of(int[] data, int k, boolean prob, Color color)
    Creates a histogram plot.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Histogram

      public Histogram()
  • Method Details

    • of

      public static BarPlot of(int[] data)
      Creates a histogram plot. The number of bins will be determined by square-root rule and the y-axis will be in the probability scale.
      Parameters:
      data - a sample set.
    • of

      public static BarPlot of(int[] data, int k, boolean prob)
      Creates a histogram plot.
      Parameters:
      data - a sample set.
      k - the number of bins.
      prob - if true, the y-axis will be in the probability scale. Otherwise, y-axis will be in the frequency scale.
    • of

      public static BarPlot of(int[] data, int k, boolean prob, Color color)
      Creates a histogram plot.
      Parameters:
      data - a sample set.
      k - the number of bins.
      prob - if true, the y-axis will be in the probability scale. Otherwise, y-axis will be in the frequency scale.
    • of

      public static BarPlot of(int[] data, double[] breaks, boolean prob)
      Creates a histogram plot.
      Parameters:
      data - a sample set.
      breaks - an array of size k+1 giving the breakpoints between histogram cells. Must be in ascending order.
      prob - if true, the y-axis will be in the probability scale. Otherwise, y-axis will be in the frequency scale.
    • of

      public static BarPlot of(int[] data, double[] breaks, boolean prob, Color color)
      Creates a histogram plot.
      Parameters:
      data - a sample set.
      breaks - an array of size k+1 giving the breakpoints between histogram cells. Must be in ascending order.
      prob - if true, the y-axis will be in the probability scale. Otherwise, y-axis will be in the frequency scale.
    • of

      public static BarPlot of(double[] data)
      Creates a histogram plot. The number of bins will be determined by square-root rule and the y-axis will be in the probability scale.
      Parameters:
      data - a sample set.
    • of

      public static BarPlot of(double[] data, int k, boolean prob)
      Creates a histogram plot.
      Parameters:
      data - a sample set.
      k - the number of bins.
      prob - if true, the y-axis will be in the probability scale. Otherwise, y-axis will be in the frequency scale.
    • of

      public static BarPlot of(double[] data, int k, boolean prob, Color color)
      Creates a histogram plot.
      Parameters:
      data - a sample set.
      k - the number of bins.
      prob - if true, the y-axis will be in the probability scale. Otherwise, y-axis will be in the frequency scale.
    • of

      public static BarPlot of(double[] data, double[] breaks, boolean prob)
      Creates a histogram plot.
      Parameters:
      data - a sample set.
      breaks - an array of size k+1 giving the breakpoints between histogram cells. Must be in ascending order.
      prob - if true, the y-axis will be in the probability scale. Otherwise, y-axis will be in the frequency scale.
    • of

      public static BarPlot of(double[] data, double[] breaks, boolean prob, Color color)
      Creates a histogram plot.
      Parameters:
      data - a sample set.
      breaks - an array of size k+1 giving the breakpoints between histogram cells. Must be in ascending order.
      prob - if true, the y-axis will be in the probability scale. Otherwise, y-axis will be in the frequency scale.