code: public static PlotCanvas plot(String id, double[][] data, int[] y, char[] legend, Color[] palette) {
          if (data[0].length != 2 && data[0].length != 3) {
              throw new IllegalArgumentException("Invalid data dimension: " + data[0].length);
          }
  
          double[] lowerBound = Math.colMin(data);
          double[] upperBound = Math.colMax(data);
          PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound);
  
          ScatterPlot plot = new ScatterPlot(data, y, legend, palette);
          plot.setID(id);
          canvas.add(plot);
  
          return canvas;
      }
docs: Create a plot canvas with the scatter plot of given data with specific legend and color.
  @param id the id of the plot.
  @param data a n-by-2 or n-by-3 matrix that describes coordinates of points.
  @param y the class labels of data.
  @param palette the colors for each class.
  @param legend the legend used to draw points.
  <ul>
  <li> . : dot
  <li> + : +
  <li> - : -
  <li> | : |
  <li> * : star
  <li> x : x
  <li> o : circle
  <li> O : large circle
  <li> @ : solid circle
  <li> # : large solid circle
  <li> s : square
  <li> S : large square
  <li> q : solid square
  <li> Q : large solid square
  <li> others : dot
  </ul>