/** * Create a plot canvas with the scatter plot of given data. * @param id the id of the plot. * @param data a n-by-2 or n-by-3 matrix that describes coordinates of n points. * @param labels labels of points. */ public static PlotCanvas plot(String id, double[][] data, String[] labels) { if (data[0].length != 2 && data[0].length != 3) { throw new IllegalArgumentException("Invalid data dimension: " + data[0].length); } if (data.length != labels.length) { throw new IllegalArgumentException("The number of points and that of labels are not same."); } double[] lowerBound = Math.colMin(data); double[] upperBound = Math.colMax(data); PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); ScatterPlot plot = new ScatterPlot(data, labels); plot.setID(id); canvas.add(plot); return canvas; }
/** * Adds a scatter plot to this canvas. * @param id the id of the plot. * @param data a n-by-2 or n-by-3 matrix that describes coordinates of points. * @param labels labels of points. * @return the scatter plot for the given points. */ public ScatterPlot points(String id, double[][] data, String[] labels) { if (data[0].length != base.dimension) { throw new IllegalArgumentException("Invalid data dimension: " + data[0].length); } if (data.length != labels.length) { throw new IllegalArgumentException("The number of points and that of labels are not same."); } double[] lowerBound = Math.colMin(data); double[] upperBound = Math.colMax(data); extendBound(lowerBound, upperBound); ScatterPlot plot = new ScatterPlot(data, labels); plot.setID(id); add(plot); return plot; }
/** * Create a plot canvas with the scatter plot of given data. * @param id the id of the plot. * @param data a n-by-2 or n-by-3 matrix that describes coordinates of n points. */ public static PlotCanvas plot(String id, double[]... data) { 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); plot.setID(id); canvas.add(plot); return canvas; }
/** * Adds a scatter plot to this canvas. * @param id the id of the plot. * @param data a n-by-2 or n-by-3 matrix that describes coordinates of points. * @return the scatter plot for the given points. */ public ScatterPlot points(String id, double[]... data) { if (data[0].length != base.dimension) { throw new IllegalArgumentException("Invalid data dimension: " + data[0].length); } double[] lowerBound = Math.colMin(data); double[] upperBound = Math.colMax(data); extendBound(lowerBound, upperBound); ScatterPlot plot = new ScatterPlot(data); plot.setID(id); add(plot); return plot; }
/** * Adds a scatter plot to this canvas. * @param id the id of the plot. * @param data a n-by-2 or n-by-3 matrix that describes coordinates of points. * @param color the color used to draw points. * @return the scatter plot for the given points. */ public ScatterPlot points(String id, double[][] data, Color color) { if (data[0].length != base.dimension) { throw new IllegalArgumentException("Invalid data dimension: " + data[0].length); } double[] lowerBound = Math.colMin(data); double[] upperBound = Math.colMax(data); extendBound(lowerBound, upperBound); ScatterPlot plot = new ScatterPlot(data); plot.setID(id); plot.setColor(color); add(plot); return plot; }
extendBound(lowerBound, upperBound); ScatterPlot plot = new ScatterPlot(data, legend); plot.setID(id); add(plot);
/** * Create a plot canvas with the scatter plot of given data and specific 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 color the color used to draw points. */ public static PlotCanvas plot(String id, double[][] data, Color color) { 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); plot.setID(id); plot.setColor(color); canvas.add(plot); return canvas; }
/** * Plot plot. * * @param pts the pts * @return the plot */ public Plot plot(final double[][] pts) { Plot plot; switch (type) { case Scatter: plot = new ScatterPlot(pts); plot.setID(name); plot.setColor(color); return plot; case Line: plot = new LinePlot(pts); plot.setID(name); plot.setColor(color); return plot; default: throw new IllegalStateException(type.toString()); } }
/** * Plot plot. * * @param pts the pts * @return the plot */ public Plot plot(final double[][] pts) { Plot plot; switch (type) { case Scatter: plot = new ScatterPlot(pts); plot.setID(name); plot.setColor(color); return plot; case Line: plot = new LinePlot(pts); plot.setID(name); plot.setColor(color); return plot; default: throw new IllegalStateException(type.toString()); } }
PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); ScatterPlot plot = new ScatterPlot(data, legend); plot.setID(id); canvas.add(plot);
/** * Plot plot. * * @param pts the pts * @return the plot */ public Plot plot(final double[][] pts) { Plot plot; switch (type) { case Scatter: plot = new ScatterPlot(pts); plot.setID(name); plot.setColor(color); return plot; case Line: plot = new LinePlot(pts); plot.setID(name); plot.setColor(color); return plot; default: throw new IllegalStateException(type.toString()); } }
PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); ScatterPlot plot = new ScatterPlot(data, y, legend, palette); plot.setID(id); canvas.add(plot);
PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); ScatterPlot plot = new ScatterPlot(data, y, legend, palette); plot.setID(id); canvas.add(plot);
PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); ScatterPlot plot = new ScatterPlot(data, legend); plot.setID(id); plot.setColor(color);
extendBound(lowerBound, upperBound); ScatterPlot plot = new ScatterPlot(data, legend); plot.setID(id); plot.setColor(color);