/** * Adds a poly line 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. */ public LinePlot line(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); LinePlot plot = new LinePlot(data); plot.setID(id); add(plot); return plot; }
/** * Adds a poly line 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 style the stroke style of line. */ public LinePlot line(String id, double[][] data, Line.Style style) { 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); LinePlot plot = new LinePlot(data, style); plot.setID(id); add(plot); return plot; }
/** * Create a plot canvas with the poly line 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 points. * @param style the stroke style of line. */ public static PlotCanvas plot(String id, double[][] data, Line.Style style) { 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); LinePlot plot = new LinePlot(data, style); plot.setID(id); canvas.add(plot); return canvas; }
/** * Adds a poly line 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 of line. */ public LinePlot line(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); LinePlot plot = new LinePlot(data); plot.setID(id); plot.setColor(color); add(plot); return plot; }
/** * Adds a poly line plot to this canvas. * @param id the id of the plot. * @param data a n x 2 or n x 3 matrix that describes coordinates of points. * @param style the stroke style of line. * @param color the color of line. */ public LinePlot line(String id, double[][] data, Line.Style style, 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); LinePlot plot = new LinePlot(data, style); plot.setID(id); plot.setColor(color); add(plot); return plot; }
/** * Create a plot canvas with the poly line 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 points. * @param style the stroke style of line. * @param color the color of line. */ public static PlotCanvas plot(String id, double[][] data, Line.Style style, 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); LinePlot plot = new LinePlot(data, style); 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()); } }
/** * 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()); } }
/** * Adds a poly line plot to this canvas. * @param id the id of the plot. * @param y a data vector that describes y coordinates of points. The x * coordinates will be [0, n), where n is the length of y. */ public LinePlot line(String id, double[] y) { double[] lowerBound = {0, Math.min(y)}; double[] upperBound = {y.length, Math.max(y)}; extendBound(lowerBound, upperBound); double[][] data = new double[y.length][2]; for (int i = 0; i < data.length; i++) { data[i][0] = i; data[i][1] = y[i]; } LinePlot plot = new LinePlot(data); plot.setID(id); add(plot); return plot; }
/** * Adds a poly line plot to this canvas. * @param id the id of the plot. * @param y a data vector that describes y coordinates of points. The x * coordinates will be [0, n), where n is the length of y. * @param style the stroke style of line. */ public LinePlot line(String id, double[] y, Line.Style style) { double[] lowerBound = {0, Math.min(y)}; double[] upperBound = {y.length, Math.max(y)}; extendBound(lowerBound, upperBound); double[][] data = new double[y.length][2]; for (int i = 0; i < data.length; i++) { data[i][0] = i; data[i][1] = y[i]; } LinePlot plot = new LinePlot(data, style); plot.setID(id); add(plot); return plot; }
/** * Create a plot canvas with the poly line plot of given data. * @param id the id of the plot. * @param y a data vector that describes y coordinates of points. The x * coordinates will be [0, n), where n is the length of y. */ public static PlotCanvas plot(String id, double[] y) { double[] lowerBound = {0, Math.min(y)}; double[] upperBound = {y.length, Math.max(y)}; PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound, false); canvas.base.extendBound(1); double[][] data = new double[y.length][2]; for (int i = 0; i < data.length; i++) { data[i][0] = i; data[i][1] = y[i]; } LinePlot plot = new LinePlot(data); plot.setID(id); canvas.add(plot); return canvas; }
/** * Add a poly line plot of given data into the current canvas. * @param id the id of the plot. * @param y a data vector that describes y coordinates of points. The x * coordinates will be [0, n), where n is the length of y. * @param style the stroke style of line. * @param color the color of line. */ public LinePlot line(String id, double[] y, Line.Style style, Color color) { double[] lowerBound = {0, Math.min(y)}; double[] upperBound = {y.length, Math.max(y)}; extendBound(lowerBound, upperBound); double[][] data = new double[y.length][2]; for (int i = 0; i < data.length; i++) { data[i][0] = i; data[i][1] = y[i]; } LinePlot plot = new LinePlot(data, style); plot.setID(id); plot.setColor(color); add(plot); return plot; }
/** * Create a plot canvas with the poly line plot of given data. * @param id the id of the plot. * @param y a data vector that describes y coordinates of points. The x * coordinates will be [0, n), where n is the length of y. * @param style the stroke style of line. */ public static PlotCanvas plot(String id, double[] y, Line.Style style) { double[] lowerBound = {0, Math.min(y)}; double[] upperBound = {y.length, Math.max(y)}; PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound, false); canvas.base.extendBound(1); double[][] data = new double[y.length][2]; for (int i = 0; i < data.length; i++) { data[i][0] = i; data[i][1] = y[i]; } LinePlot plot = new LinePlot(data, style); plot.setID(id); canvas.add(plot); return canvas; }
/** * Adds a poly line plot to this canvas. * @param id the id of the plot. * @param y a data vector that describes y coordinates of points. The x * coordinates will be [0, n), where n is the length of y. * @param color the color of line. */ public LinePlot line(String id, double[] y, Color color) { double[] lowerBound = {0, Math.min(y)}; double[] upperBound = {y.length, Math.max(y)}; extendBound(lowerBound, upperBound); double[][] data = new double[y.length][2]; for (int i = 0; i < data.length; i++) { data[i][0] = i; data[i][1] = y[i]; } LinePlot plot = new LinePlot(data); plot.setID(id); plot.setColor(color); add(plot); return plot; }
/** * Create a plot canvas with the poly line plot of given data. * @param id the id of the plot. * @param y a data vector that describes y coordinates of points. The x * coordinates will be [0, n), where n is the length of y. * @param style the stroke style of line. * @param color the color of line. */ public static PlotCanvas plot(String id, double[] y, Line.Style style, Color color) { double[] lowerBound = {0, Math.min(y)}; double[] upperBound = {y.length, Math.max(y)}; PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound, false); canvas.base.extendBound(1); double[][] data = new double[y.length][2]; for (int i = 0; i < data.length; i++) { data[i][0] = i; data[i][1] = y[i]; } LinePlot plot = new LinePlot(data, style); plot.setID(id); plot.setColor(color); canvas.add(plot); return canvas; }