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); } }
/** * Sets the color of lines drawn to indicate slice locations. * @param color the line color; if null, no lines are drawn. */ public void setLineColor(Color color) { if (color==null) { hideLines(); } else { showLines(); _l12.setLineColor(color); _l13.setLineColor(color); _l23.setLineColor(color); } }
/** * Sets the line color. * The default line color is the tile foreground color. * That default is used if the specified line color is null. * @param color the line color; null, for tile foreground color. */ public void setLineColor(Color color) { if (!equalColors(_lineColor,color)) { _lineColor = color; repaint(); } }
/** * Called when we might new realignment. */ private void updateBestProjectors() { updateBestProjectors(getHScale(),getVScale()); }
RenderingHints.VALUE_ANTIALIAS_ON); Projector hp = getHorizontalProjector(); Projector vp = getVerticalProjector(); Transcaler ts = getTranscaler(); float[] x1 = _x1.get(is); float[] x2 = _x2.get(is); computeXY(hp,vp,ts,n,x1,x2,x,y); paintPoint(gmark,n,x,y); } else if (_markStyle==Mark.PLUS) { paintPlus(gmark,markSize,n,x,y); } else if (_markStyle==Mark.CROSS) { paintCross(gmark,markSize,n,x,y); } else if (_markStyle==Mark.FILLED_CIRCLE) { paintFilledCircle(gmark,markSize,n,x,y); } else if (_markStyle==Mark.HOLLOW_CIRCLE) { paintHollowCircle(gmark,markSize,n,x,y); } else if (_markStyle==Mark.FILLED_SQUARE) { paintFilledSquare(gmark,markSize,n,x,y); } else if (_markStyle==Mark.HOLLOW_SQUARE) { paintHollowSquare(gmark,markSize,n,x,y); paintLabel(gtext,markSize,n,x,y,z);
setLineColor(Color.RED); setMarkColor(Color.RED); } else if (style.contains("g")) { setLineColor(Color.GREEN); setMarkColor(Color.GREEN); } else if (style.contains("b")) { setLineColor(Color.BLUE); setMarkColor(Color.BLUE); } else if (style.contains("c")) { setLineColor(Color.CYAN); setMarkColor(Color.CYAN); } else if (style.contains("m")) { setLineColor(Color.MAGENTA); setMarkColor(Color.MAGENTA); } else if (style.contains("y")) { setLineColor(Color.YELLOW); setMarkColor(Color.YELLOW); } else if (style.contains("k")) { setLineColor(Color.BLACK); setMarkColor(Color.BLACK); } else if (style.contains("w")) { setLineColor(Color.WHITE); setMarkColor(Color.WHITE); } else { setLineColor(null); setMarkColor(null); setLineStyle(Line.DASH_DOT); } else if (style.contains("--")) {
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 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"); } }
/** * Constructs a view of points (x1,x2) with 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. */ public PointsView(float[][] x1, float[][] x2) { set(x1,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 irow the tile row index. * @param icol the tile column index. * @param x1 array of arrays of x1 coordinates. * @param x2 array of arrays of x2 coordinates. * @return the points view. */ public PointsView addPoints(int irow, int icol, float[][] x1, float[][] x2) { PointsView pv = new PointsView(x1,x2); return addPointsView(irow,icol,pv); }
pv1.setLineColor(Color.BLUE); pv1.setScales(AxisScale.LOG10); pv2.setLineColor(Color.RED); pv2.setScales(AxisScale.LOG10);
int ind = getFirstPositiveInd(x1); if (ind>-1) x1min = max(x1min,x1[ind]); int ind = getSmallestPositiveInd(x2); if (ind>-1) x2min = max(x2min,x2[ind]); bvp = (x1min<x1max)?new Projector(x1min,x1max,u0,u1,vscale):null; setBestProjectors(bhp,bvp);
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); } });
/** * Sets arrays of (x1,x2) coordinates for a single plot segment. * The lengths of the specified arrays x1 and x2 must be equal. * @param x1 array of x1 coordinates. * @param x2 array of x2 coordinates. */ public void set(float[] x1, float[] x2) { set(x1,x2,null); }
/** * Adds a points view of the arrays x1 and x2 of point (x1,x2) coordinates. * @param irow the tile row index. * @param icol the tile column index. * @param x1 array of x1 coordinates. * @param x2 array of x2 coordinates. * @return the points view. */ public PointsView addPoints(int irow, int icol, float[] x1, float[] x2) { PointsView pv = new PointsView(x1,x2); return addPointsView(irow,icol,pv); }
/** * Sets the horizontal axis scaling. * @param hscale horizontal axis scaling. * @param vscale vertical axis scaling. */ @Override public PointsView setScales(AxisScale hscale, AxisScale vscale) { if(hscale!=getHScale() || vscale!=getVScale()) updateBestProjectors(hscale,vscale); return this; }
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); } }
/** * Constructs a view of points (x1,x2,x3) with a single plot segment. * The lengths of the specified arrays x1 and x2 must be equal. * If x3 is not null, its length must equal that of x1 and x2. * @param x1 array of x1 coordinates. * @param x2 array of x2 coordinates. * @param x3 array of x3 coordinates; null, if none. */ public PointsView(float[] x1, float[] x2, float[] x3) { set(x1,x2,x3); }
/** * Adds a view of points (x1,x2) for a sampled function x2(x1). * @param irow the tile row index. * @param icol the tile column index. * @param s1 the sampling of x1 coordinates. * @param x2 array of x2 coordinates. * @return the points view. */ public PointsView addPoints(int irow, int icol, Sampling s1, float[] x2) { PointsView pv = new PointsView(s1,x2); return addPointsView(irow,icol,pv); }
/** * Sets the mark color. * The default mark color is the tile foreground color. * That default is used if the specified mark color is null. * @param color the mark color. */ public void setMarkColor(Color color) { if (!equalColors(_markColor,color)) { _markColor = color; repaint(); } }