Further refinement and generalization: use "labelPoints", adjusting global
"LP" for subfunction "label1Pt" as necessary to get the labeling of the
extreme points of the example sine wave (e.g. labelPoints (1 o. 8%~i:49);0
11 36 62 87 98) to look OK.

The values for LP shown below work well for my current display.

labelPoints=: 3 : 0
   pd 'reset'
   'rpts p2l'=. y NB. Vector of points to plot, indexes of points to label.
   wh=. (<rpts) label1Pt&.>p2l
   pd 'pensize 5;type point'
   pd <"1 rpts,:~i.#rpts
   pd 'show'
   wh
NB.EG labelPoints (1 o. 8%~i:49);0 11 36 62 87 98 NB. Label extrema
)

LP=: 20 900 50 1400 10
NB.* label1Pt: allow parameter refinement to label points: use global LP:
NB. x offset, scaling, y offset, scaling, font point size.
label1Pt=: 4 : 0
   'whrp rpts'=. y;<x
   rp=. whrp{rpts
   xrnd=. ":<.(0{LP)+(1{LP)*whrp%#rpts NB. Estimate plot-area x-position
   span=. >:(>./-<./)rpts
   yrnd=. ":<.(2{LP)+(3{LP)*(rp-<./rpts)%span NB. Est. plot-area y-position
   pd 'textfont Courier ',(":4{LP),' Bold;textcolor BLACK'
   pd 'text ',xrnd,' ',yrnd,' ',":rp
   xrnd,' ',yrnd
)

> June Kim ([EMAIL PROTECTED]) wrote:
> . . .
> I'd like to label on some data points....

-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to