I don't think you can give text as "x values". You can however have text
x axis labels.
The following command should give you what you want.

'bar;xlabel "apples" "oranges" "red plum" "oranges"' plot 3 2 5 3
(note the quotes are only necessary if your labels contain more than one
word each)

If you have to start from your tally, you could create this command as
follows (I'm sure others will have more elegant methods!!)

tally
+--------+-+
|apples  |3|
+--------+-+
|oranges |2|
+--------+-+
|red plum|5|
+--------+-+
|oranges |3|
+--------+-+
   ('bar;xlabel ',' 'makecsv{."1 tally) plot ;{:"1 tally

Where makecsv is an edited version of writecsv from the csv script, that
takes an optional left argument.
   
makecsv=: 3 : 0
  ',' makecsv y
:
  dat=. ,each 8!:2 each y
  f=. '"'&,@(,&('"',x))@(#~ >:@(=&'"'))
  dat=. f each dat
  f=. <@(,&LF)@}:@;
  dat=. ;f"1 dat
)

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
> Sent: Saturday, 16 June 2007 02:30
> To: [email protected]
> Subject: [Jgeneral] plotting collected data
> 
> Hello,
> 
> I have a tally of some data in box form.
> 
>        -----------------
>        | apples   | 3  |
>        ----------------- 
>        | oranges  | 2  |
>        ----------------- 
>        | red plum | 5  |
>        ----------------- 
>        | oranges  | 3  |
>        ----------------- 
> 
> and would like to box plot it. 
> 
> According to plot data I can use a boxed array. Unfortunately 
> I'm not sure how to get my tally into a boxed array. I tried 
> 

I think when it talks about a "boxed array" it means this:
+---------+--------------+
|0 1 2 3 4|90 47 58 29 22|
+---------+--------------+
Where the first box is a list of x values, and the 2nd is the list of y
values
'bar' plot (i.5);[EMAIL PROTECTED] 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to