code: public Grid grid(double[][][] data) {
          if (base.dimension != 2) {
              throw new IllegalArgumentException("Grid can be only painted in a 2D canvas. Try surface() for 3D grid.");
          }
  
          Grid grid = new Grid(data);
          add(grid);
          return grid;
      }
docs: Adds a 2D grid plot to the canvas.
  @param data an m x n x 2 array which are coordinates of m x n grid.