code: public Histogram histogram(String id, int[] data, double[] breaks, Color color) {
          if (base.dimension != 2) {
              throw new IllegalArgumentException("Histogram can be only painted in a 2D canvas.");
          }
  
          Histogram histogram = new Histogram(data, breaks);
          histogram.setID(id);
          histogram.setColor(color);
  
          double[] lowerBound = {Math.min(data) - 0.5, 0};
          double[] upperBound = {Math.max(data) + 0.5, 0};
          double[][] freq = histogram.getHistogram();
          for (int i = 0; i < freq.length; i++) {
              if (freq[i][1] > upperBound[1]) {
                  upperBound[1] = freq[i][1];
              }
          }
  
          extendBound(lowerBound, upperBound);
          add(histogram);
  
          return histogram;
      }
docs: Adds a histogram to this canvas.
  @param id the id of the plot.
  @param data a sample set.
  @param breaks an array of size k+1 giving the breakpoints between
  histogram cells. Must be in ascending order.