/** * Returns a new plot with a points view of specified values f(x). * Uses default sampling of x = 0, 1, 2, .... * @param f array of sampled function values f(x). * @return the plot. */ public static SimplePlot asPoints(float[] f) { SimplePlot plot = new SimplePlot(Origin.LOWER_LEFT); plot.addPoints(f); return plot; }
/** * Adds a pixels view of the specified sampled function f(x1,x2). * @param s1 the sampling of the variable x1; must be uniform. * @param s2 the sampling of the variable x2; must be uniform. * @param f array[n2][n1] of sampled function values f(x1,x2), where * n1 = f[0].length and n2 = f.length. * @return the pixels view. */ public PixelsView addPixels(Sampling s1, Sampling s2, double[][] f) { return addPixels(s1,s2,convertToFloat(f)); }
/** * Returns a new plot with a pixels view of a sampled function f(x1,x2). * @param s1 the sampling of the x1 coordinate. * @param s2 the sampling of the x2 coordinate. * @param f array[n2][n1] of sampled function values f(x1,x2), where * n1 = f[0].length and n2 = f.length. * @return the plot. */ public static SimplePlot asPixels(Sampling s1, Sampling s2, double[][] f) { return SimplePlot.asPixels(s1,s2,convertToFloat(f)); }
/** * Returns a new plot with a points view of a sampled function f(x). * @param s the sampling of the x coordinate. * @param f array of sampled function values f(x). * @return the plot. */ public static SimplePlot asPoints(Sampling s, double[] f) { return SimplePlot.asPoints(s,convertToFloat(f)); }
/** * Returns a new plot with a sequence view of specified values f(x). * Uses default sampling of x = 0, 1, 2, .... * @param f array of sampled function values f(x). * @return the plot. */ public static SimplePlot asSequence(float[] f) { SimplePlot plot = new SimplePlot(Origin.LOWER_LEFT); plot.addSequence(f); return plot; }
public void run() { System.out.println("min="+ min(g)+" max="+ max(g)); SimplePlot sp = new SimplePlot(); sp.setTitle(method); sp.setSize(847,740); sp.addColorBar(); sp.getPlotPanel().setColorBarWidthMinimum(100); PixelsView pv = sp.addPixels(SX,SX,g); pv.setColorModel(ColorMap.JET); pv.setInterpolation(PixelsView.Interpolation.LINEAR); if (cmin<cmax) pv.setClips(cmin,cmax); PointsView px = sp.addPoints(x1,x2); px.setLineStyle(PointsView.Line.NONE); px.setMarkStyle(PointsView.Mark.FILLED_CIRCLE); px.setMarkSize(6); } });
private static void plot3() { SimplePlot plot = new SimplePlot(); plot.addGrid("H-.V-."); float[] f = sin(rampfloat(0.0f,0.1f,63)); plot.addPoints(f).setStyle("r-o"); float[] g = cos(rampfloat(0.0f,0.1f,63)); plot.addPoints(g).setStyle("b-x"); plot.setTitle("A simple plot of two arrays"); plot.setVLabel("array value"); plot.setHLabel("array index"); } }
private static void plot(float[][] f) { trace("plot f min="+ min(f)+" max="+max(f)); edu.mines.jtk.mosaic.SimplePlot sp = new edu.mines.jtk.mosaic.SimplePlot( edu.mines.jtk.mosaic.SimplePlot.Origin.UPPER_LEFT); sp.setSize(920,900); edu.mines.jtk.mosaic.PixelsView pv = sp.addPixels(f); pv.setColorModel(edu.mines.jtk.awt.ColorMap.JET); pv.setInterpolation(edu.mines.jtk.mosaic.PixelsView.Interpolation.NEAREST); } }
/** * Returns a new plot with a pixels view of a sampled function f(x1,x2). * @param s1 the sampling of the x1 coordinate. * @param s2 the sampling of the x2 coordinate. * @param f array[n2][n1] of sampled function values f(x1,x2), where * n1 = f[0].length and n2 = f.length. * @return the plot. */ public static SimplePlot asPixels(Sampling s1, Sampling s2, float[][] f) { SimplePlot plot = new SimplePlot(Origin.UPPER_LEFT); PixelsView pv = plot.addPixels(s1,s2,f); pv.setInterpolation(PixelsView.Interpolation.NEAREST); return plot; }
/** * Adds a points view of a sampled function f(x). * @param s the sampling of the x coordinate. * @param f array of sampled function values f(x). * @return the points view. */ public PointsView addPoints(Sampling s, double[] f) { return addPoints(s,convertToFloat(f)); }
/** * Returns a new plot with a contours view of a sampled function f(x1,x2). * @param f array[n2][n1] of sampled function values f(x1,x2), where * n1 = f[0].length and n2 = f.length. * @return the plot. */ public static SimplePlot asContours(float[][] f) { SimplePlot plot = new SimplePlot(Origin.UPPER_LEFT); plot.addContours(f); return plot; }
private static void plot2() { float[][] f = sin(rampfloat(0.0f,0.1f,0.1f,101,101)); SimplePlot.asPixels(f).addColorBar(); } private static void plot3() {
/** * Returns a new plot with a sequence view of specified values f(x). * Uses default sampling of x = 0, 1, 2, .... * @param f array of sampled function values f(x). * @return the plot. */ public static SimplePlot asSequence(double[] f) { return SimplePlot.asSequence(convertToFloat(f)); }
private static void plot0() { float[] f = sin(rampfloat(0.0f,0.1f,63)); SimplePlot.asSequence(f); } private static void plot1() {
private static void plot1() { int nx = 301; float dx = 0.1f; float fx = 0.0f; Sampling sx = new Sampling(nx,dx,fx); float[] x = rampfloat(fx,dx,nx); float[] f = sub(mul(x,sin(x)),1.0f); SimplePlot.asPoints(sx,f); } private static void plot2() {
public void run() { System.out.println("min="+ min(g)+" max="+ max(g)); SimplePlot sp = new SimplePlot(); sp.setTitle(method); sp.setSize(847,740); sp.addColorBar(); sp.getPlotPanel().setColorBarWidthMinimum(100); PixelsView pv = sp.addPixels(SX,SX,g); pv.setColorModel(ColorMap.JET); pv.setInterpolation(PixelsView.Interpolation.LINEAR); if (cmin<cmax) pv.setClips(cmin,cmax); PointsView px = sp.addPoints(x1,x2); px.setLineStyle(PointsView.Line.NONE); px.setMarkStyle(PointsView.Mark.FILLED_CIRCLE); px.setMarkSize(6); } });
private static void plot(float[][] f) { trace("plot f min="+ min(f)+" max="+max(f)); edu.mines.jtk.mosaic.SimplePlot sp = new edu.mines.jtk.mosaic.SimplePlot( edu.mines.jtk.mosaic.SimplePlot.Origin.UPPER_LEFT); sp.setSize(920,900); edu.mines.jtk.mosaic.PixelsView pv = sp.addPixels(f); pv.setColorModel(edu.mines.jtk.awt.ColorMap.JET); pv.setInterpolation(edu.mines.jtk.mosaic.PixelsView.Interpolation.NEAREST); } }
/** * Returns a new plot with a pixels view of a sampled function f(x1,x2). * Assumes zero first-sample values and unit sampling intervals. * @param f array[n2][n1] of sampled function values f(x1,x2), where * n1 = f[0].length and n2 = f.length. * @return the plot. */ public static SimplePlot asPixels(float[][] f) { SimplePlot plot = new SimplePlot(Origin.UPPER_LEFT); PixelsView pv = plot.addPixels(f); pv.setInterpolation(PixelsView.Interpolation.NEAREST); return plot; }
/** * Adds a points view of specified values f(x). * Uses default sampling of x = 0, 1, 2, .... * @param f array of sampled function values f(x). * @return the points view. */ public PointsView addPoints(double[] f) { return addPoints(convertToFloat(f)); }
/** * Returns a new plot with a sequence view of a sampled function f(x). * @param s the sampling of the x coordinate. * @param f array of sampled function values f(x). * @return the plot. */ public static SimplePlot asSequence(Sampling s, float[] f) { SimplePlot plot = new SimplePlot(Origin.LOWER_LEFT); plot.addSequence(s,f); return plot; }