Thanks Devon,
I see what you are doing but it is what I would like to avoid.  Because I am
using subplots and titles and axis labels of varying lengths & depths, the
actual plot area varies and is less predictable than what you are doing.  I
want to place single character labels which because of their narrow width
would make any error in placement look bad.  That is why I am hoping that
plot type symbol might hold the answer, but I just can not find any
information on it.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Devon McCormick
Sent: Wednesday, June 27, 2007 11:48 PM
To: Programming forum
Subject: Re: [Jprogramming] How to use Plot Type Symbol

Ed -

the following is rather crude but may be good enough for your purposes.  The
basic assumption I make is that the plot window is 1000 by 1000 units and I
scale everything accordingly.  In the example that follows, I'm trying to
label the high and low points as well as a line representing the mean.

pd 'reset'
rr=. _100+50?201 NB. Random points to plot
whhl=. rr i. (>./,<./)rr NB. Find highest and lowest and
rr=. (10 _10+whhl{rr) whhl}rr NB. exaggerate each to stand out
'hp lp'=. (>./,<./)rr NB. High and Low points to label

xhi=. ":<.0.5+(1000*(#rr)%~rr i. hp) NB. Estimate x-position of high
yhi=. ":1000-50 NB. Guess near top

xlow=. ":<.0.5+1000*(#rr)%~rr i. lp NB. Estimate x-position of low
ylow=. ":50 NB. Guess near bottom

NB. Place text for high point:
pd 'textfont Courier 12 Bold;textcolor GREEN'
pd 'text ',xhi,' ',yhi,' High=',":hp

NB. Place text for low point:
pd 'textfont Courier 12 Bold;textcolor RED'
pd 'text ',xlow,' ',ylow,' Low=',":lp

NB. Draw line at mean value
mp=. mean rr
span=. (>./-<./)rr
xmn=. ":<.0.5*1000 NB. Horizontally in middle
ymn=. (mp-lp)%span NB. Estimate distance from lowest
ymn=. ":<.0.5+1000*ymn NB. Estimate height of line
pd 'textfont Courier 14 Bold;textcolor BLACK'
pd 'text ',xmn,' ',ymn,' Mean=',":mp

pd 'pensize 3'
pd rr,:(#rr)$mp

pd 'show'

Hope this helps,

Devon

On 6/27/07, Ed Cox <[EMAIL PROTECTED]> wrote:
>
> The problem I have is that I want to add text to a plot.  However, Plot
> Text
> uses the coordinate system of the window whereas I want to use the graph
> coordinates to plot text so that it can be aligned with plotted points.
> Since I don't see any functions that convert from one coordinate system to
> the other I need to find a way to plot text using another method.  The
> only
> method that seems like it might work is Plot Type Symbol.  The
> documentation
> implies that this plot characters.  But I can not find ANY information on
> how to actually do that.  I've tried a few more obvious versions of what I
> think the command might look like, but nothing works.
>
> Can anyone confirm that plot type symbol actually can be used to plot
> characters in the graph coordinate system, and if so, tell me how to do
> it?
>
>
>
> - Ed Cox
>
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.472 / Virus Database: 269.9.6/863 - Release Date: 6/23/2007
11:08 AM
 

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to