/* PLCLAB.I Label contour levels with numerical values. $Id$ */ /* Copyright (c) 1996. The Regents of the University of California. All rights reserved. */ func plc_label(z,y,x, levs, ndivs=, opaque=, lmgrid=, height=) /* DOCUMENT plc_label, z,y,x, levs, ndivs=ndivs, opaque=opaque, lmgrid=lmgrid call after plc,z,y,x in order to put labels on an existing contour plot. If you are going to set the limits (by means of the limits or range functions, or zooming or panning with the mouse), do so before calling plc_label, since it reads the current plot limits. finds points where numeric contours labels can be drawn input z : array to be contoured y: y coords of array to be contoured x: x coords of array to be contoured levs: contour levels to be labelled ndivs: divide domain into ndvis x ndivs subregions with label in each opaque: if defined, white out below label lmgrid: if defined, draw the subregion perimeters output --- none now authors: Phil Rasch and David Munro last revised: 20 July, 1996 (for 1.3 distribution) SEE ALSO: plc */ { if (is_void(ndivs)) ndivs= 6; if (is_void(opaque)) opaque= 0; if (is_void(lmgrid)) lmgrid= 0; if (is_void(height)) height= 12; /* Build list of edge indices cut by the contours: * kzp= list of edges of the form (i,j) to (i+1,j) cut by a contour * nzp= corresponding list of contour numbers * kpz= list of edges of the form (i,j) to (i,j+1) cut by a contour * npz= corresponding list of contour numbers * Mnemonic: zp= zone-point, pz= point-zone */ dims = dimsof(z); /* shape of array */ nx = dims(2); ny = dims(3); nc = numberof(levs); iar = indgen(nx)(,-:1:ny); /* used to keep track of original indices */ jar = indgen(ny)(-:1:nx,); /* Loop over contour levels - note that this is almost guaranteed * to be a much shorter loop than the number of zones in the mesh, * or even the number of rows or columns separately. */ pkzp= pkpz= array(pointer, nc); pnzp= pnpz= 0; for (n=1 ; n<=nc ; ++n) { /* find all edges cut by contour level n */ above= z > levs(n); /* 1 where z > levs, 0 elsewhere */ list= where(above(dif,)); /* where levs between two values of z */ if (numberof(list)) { pkzp(n)= &list; pnzp+= numberof(list); } list= where(above(,dif)); if (numberof(list)) { pkpz(n)= &list; pnpz+= numberof(list); } } if (pnzp) { kzp= nzp= array(0, pnzp); for (n=1,i=0 ; n<=nc && ixmin+xth) & (xcymin+yth) & (yc dmin) { plt, pr1(levs(nc(k))), xc(k),yc(k), height=height, tosys=1, justify="CH",opaque=opaque; grow, xlab, xc(k); grow, ylab, yc(k); } } }