Graham, I think the error you are getting is because the noun defining the list of itemcolors to use isn't found. It seems that the name of the noun must be all uppercase, and must be in the copath of the jzplot locale so it is found while the plot is being constructed. The following example should work in J6, J7 (both Gtk IDE and JHS). If you are using JHS, try copying it into the scratch (action|scratch...) and then run it from there (action|scratch)
require 'plot numeric' hue=: 4 : 0 y=. y*<:#x b=. x {~ <.y t=. x {~ >.y k=. y-<.y (t*k)+b*-.k ) noise=: 100 ((?@$ >:@+:) + -@]) 7 NB. random noise dat=: (noise + i.) 100 NB. data to plot datgrp=: <.@(%&10) dat NB. assign groups for dat NB. build a list of colors of about the right number (y) NB. from red to yellow. Name must be uppercase and NB. in the copath of jzplot locale (e.g. the z locale) MYCLR_z_=: (255 0 0,:255 255 0) hue int01 #~.datgrp pd 'reset' pd 'type point' pd 'itemcolor myclr' NB. myclr will be forced to uppercase pd 'pensize 4' NB. box into groups with x coordinate and plot them NB. in order of magnitude so the color progression works pd@> ;/@|: &.> (~.datgrp) /:~ (datgrp </. ] ,.~ i.@#) dat pd 'show' On Fri, Apr 20, 2012 at 10:12 PM, Graham Parkhouse <graham.parkho...@ntlworld.com> wrote: > 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