Here's what I tried in jhs and it doesn't work.
load 'plot'
open 'numeric'
open '~addons/general/misc/numeric.ijs'
steps=: {. + (1&{ - {.) * (i.@>: % ])@{:
X=. steps _2 1.9 50
dat=. cutxyz 40 surfacerev (2+*:X);X
CLR=: (RED,:YELLOW) hue _8}.8}.int01 32
pd 'backcolor teal;color CLR'
pd 'edgecolor 64 64 64'
pd 'type surface'
pd dat
RED=: 255 0 0
YELLOW=: 255 255 0
[CLR=: (RED,:YELLOW) hue 0.1*i.11
255 0 0
255 25.5 0
255 51 0
255 76.5 0
255 102 0
255 127.5 0
255 153 0
255 178.5 0
255 204 0
255 229.5 0
255 255 0
pd 'type dot'
pd 'pensize 5'
pd 'color CLR'
pd i.11
pd 'show'
result:
X=. steps _2 1.9 50
dat=. cutxyz 40 surfacerev (2+*:X);X
|value error: surfacerev
| dat=.cutxyz 40 surfacerev(2+*:X);X
|[-8]
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ric Sherlock
Sent: Friday, April 20, 2012 9:46 AM
To: Programming forum
Subject: Re: [Jprogramming] Colouring dots in plot
Actually that's only sort of true. The Plot demo loads the numeric script
(general/misc/numeric) which defines the verb steps. It is also documented
there. Try:
open 'numeric'
If you're using the JHS IDE you'll need to use the full form for now:
open '~addons/general/misc/numeric.ijs'
The same verb is also defined by the 'stats/base/combinatorial' script.
On Sat, Apr 21, 2012 at 1:09 AM, Ric Sherlock <[email protected]> wrote:
> It is defined in demos/plot/plotdemo as:
>
> steps=: {. + (1&{ - {.) * (i.@>: % ])@{:
>
>
> On Sat, Apr 21, 2012 at 1:05 AM, Linda Alvord <[email protected]>
wrote:
>> What is the definition of steps?
>>
>> Linda
>>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Graham
>> Parkhouse
>> Sent: Friday, April 20, 2012 6:13 AM
>> To: [email protected]
>> Subject: [Jprogramming] Colouring dots in plot
>>
>> I am producing 2D dot scatter plots of (x,y) data in monochrome. How
>> can I increase the information by colouring the dots according to a
>> colour band indexed by a variable z?
>>
>> A clue is given in the definition of the Surface of Revolution in the
>> 3D examples, i.e.
>>
>> X=. steps _2 1.9 50
>> dat=. cutxyz 40 surfacerev (2+*:X);X
>> CLR=: (RED,:YELLOW) hue _8}.8}.int01 32
>>
>> pd 'backcolor teal;color CLR'
>> pd 'edgecolor 64 64 64'
>> pd 'type surface'
>> pd dat
>>
>> Developing the ideas shown above, I have tried:
>>
>> RED=: 255 0 0
>> YELLOW=: 255 255 0
>> [CLR=: (RED,:YELLOW) hue 0.1*i.11
>> 255 0 0
>> 255 25.5 0
>> 255 51 0
>> 255 76.5 0
>> 255 102 0
>> 255 127.5 0
>> 255 153 0
>> 255 178.5 0
>> 255 204 0
>> 255 229.5 0
>> 255 255 0
>> pd 'type dot'
>> pd 'pensize 5'
>> pd 'color CLR'
>> pd i.11
>> pd 'show'
>>
>> This gives me a line of blue dots. If I try itemcolor instead of
>> color I get the same plot followed by this error message:
>>
>> |length error: gppshape
>> | e=.(#p) $e
>>
>> Can anybody help me, please?
>>
>> Graham
>>
>>
>>
>> ---------------------------------------------------------------------
>> - For information about J forums see
>> http://www.jsoftware.com/forums.htm
>>
>> ---------------------------------------------------------------------
>> - For information about J forums see
>> http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm