/** * Adds a points view of arrays x1, x2 and x3 of point (x1,x2,x3) coordinates. * @param x1 array of x1 coordinates. * @param x2 array of x2 coordinates. * @param x3 array of x3 coordinates. * @return the points view. */ public PointsView addPoints(float[] x1, float[] x2, float[] x3) { return addPoints(0,0,x1,x2,x3); }
/** * Adds a view of points (x1,x2) for a sampled function x2(x1). * @param s1 the sampling of x1 coordinates. * @param x2 array of x2 coordinates. * @return the points view. */ public PointsView addPoints(Sampling s1, float[] x2) { return addPoints(0,0,s1,x2); }
/** * Adds a points view of (x1,x2) with specified x2 coordinates. * The corresponding coordinates x1 are assumed to be 0, 1, 2, .... * @param x2 array of x2 coordinates. * @return the points view. */ public PointsView addPoints(float[] x2) { return addPoints(0,0,x2); }
/** * Adds a view of arrays of (x1,x2) coordinates for multiple plot segments. * The lengths of the specified arrays x1 and x2 must be equal. * @param x1 array of arrays of x1 coordinates. * @param x2 array of arrays of x2 coordinates. * @return a points view. */ public PointsView addPoints(float[][] x1, float[][] x2) { return addPoints(0,0,x1,x2); }
/** * Adds a points view of the arrays x1 and x2 of point (x1,x2) coordinates. * @param x1 array of x1 coordinates. * @param x2 array of x2 coordinates. * @return the points view. */ public PointsView addPoints(float[] x1, float[] x2) { return addPoints(0,0,x1,x2); }
/** * 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, float[] f) { return _panel.addPoints(s,f); }
/** * 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(float[] f) { return _panel.addPoints(f); }
/** * Adds a points view of specified values (x,y). * @param x array of x coordinates. * @param y array of y coordinates. * @return the points view. */ public PointsView addPoints(float[] x, float[] y) { return _panel.addPoints(x,y); }
private void updatePolesView() { int np = _poles.size(); float[] xp = new float[np]; float[] yp = new float[np]; for (int ip=0; ip<np; ++ip) { Cdouble p = _poles.get(ip); xp[ip] = (float)p.r; yp[ip] = (float)p.i; } if (_polesView==null) { _polesView = _plotPanel.addPoints(xp,yp); _polesView.setMarkStyle(PointsView.Mark.CROSS); _polesView.setLineStyle(PointsView.Line.NONE); } else { _polesView.set(xp,yp); } }
private void updateZerosView() { int nz = _zeros.size(); float[] xz = new float[nz]; float[] yz = new float[nz]; for (int iz=0; iz<nz; ++iz) { Cdouble z = _zeros.get(iz); xz[iz] = (float)z.r; yz[iz] = (float)z.i; } if (_zerosView==null) { _zerosView = _plotPanel.addPoints(xz,yz); _zerosView.setMarkStyle(PointsView.Mark.HOLLOW_CIRCLE); _zerosView.setLineStyle(PointsView.Line.NONE); } else { _zerosView.set(xz,yz); } }
public static void main(String args[]) { System.out.println("LogAxisPlotDemo2"); int n = 1000; float X = 300; float[] x = ArrayMath.rampfloat(0.0f,X / n,n); float[] f = new float[n]; for (int i = 0; i < n; ++i) { f[i] = pow(1.5f * x[i],2); } // new plot PlotPanel plot = new PlotPanel(2,2); pv1 = plot.addPoints(0,0,x,f); pv2 = plot.addPoints(0,1,x,f); pv3 = plot.addPoints(1,0,x,f); pv4 = plot.addPoints(1,1,x,f); // frame setup plot.setVisible(true); PlotFrame frame = new PlotFrame(plot); frame.setSize(800,500); frame.add(makeScaleOptionPanel(),BorderLayout.EAST); frame.setDefaultCloseOperation(PlotFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
_circleView = _plotPanel.addPoints(circlePoints[0],circlePoints[1]); _circleView.setLineColor(Color.RED);
private void updateViews() { Real1 h = computeImpulseResponse(); Real1[] ap = computeAmplitudeAndPhaseResponses(); Real1 a = ap[0]; Real1 p = ap[1]; if (_hView==null) { _hView = _plotPanelH.addSequence(h.getSampling(),h.getValues()); _aView = _plotPanelAP.addPoints(0,0,a.getSampling(),a.getValues()); _pView = _plotPanelAP.addPoints(1,0,p.getSampling(),p.getValues()); } else { _hView.set(h.getSampling(),h.getValues()); _aView.set(a.getSampling(),a.getValues()); _pView.set(p.getSampling(),p.getValues()); } }
private static void demo1() { int n = 50; float[] x1 = randfloat(n); float[] x2 = randfloat(n); float[] x3 = randfloat(n); PlotPanel panel = new PlotPanel(1,1); panel.setLimits(-0.1,-0.1,1.1,1.1); PointsView pv = panel.addPoints(x1,x2,x3); pv.setLineStyle(PointsView.Line.NONE); pv.setMarkStyle(PointsView.Mark.FILLED_CIRCLE); pv.setTextFormat("%4.2f"); PlotFrame frame = new PlotFrame(panel); frame.setSize(800,800); frame.setDefaultCloseOperation(PlotFrame.EXIT_ON_CLOSE); frame.setVisible(true); //frame.paintToPng(300,6,"junk.png"); } }
public PlotFrameDemo() { float[] x = rampfloat(0.0f,4.0f*FLT_PI/200.0f,201); float[] s = sin(x); _plotPanel = new PlotPanel(); _plotPanel.setTitle("The sine function"); _plotPanel.setHLabel("x"); _plotPanel.setVLabel("sin(x)"); _gridView = _plotPanel.addGrid(); _pointsView = _plotPanel.addPoints(x,s); _pointsView.setStyle("r-o"); _plotFrame = new PlotFrame(_plotPanel); _plotFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); _plotFrame.setVisible(true); _plotFrame.add( new Label("In either plot or axes, click-drag to zoom, click to unzoom."), BorderLayout.NORTH); }