code: private double[] findMinMaxWithErrorBars(double[] data, double[] errorBars) {
  
      double min = Double.MAX_VALUE;
      double max = -Double.MAX_VALUE;
  
      for (int i = 0; i < data.length; i++) {
  
        double d = data[i];
        double eb = errorBars[i];
        if (d - eb < min) {
          min = d - eb;
        }
        if (d + eb > max) {
          max = d + eb;
        }
      }
      return new double[] {min, max};
    }
docs: Finds the min and max of a dataset accounting for error bars
  
  @param data
  @param errorBars
  @return