From help-octave-request at bevo dot che dot wisc dot edu Thu Dec 20 13:23:52 2001 Subject: Re: scatter-plotting by color From: John Day To: help-octave at bevo dot che dot wisc dot edu Date: Thu, 20 Dec 2001 14:15:35 -0500 Paul, Thanks for the tips. But I coudn't get it to run. hsv(), eopen(), eglobar(), eaxes() etc are all undefined on my system. Do I need some special toolbox for this? I'm running Octave version 2.1.33 (i586-pc-cygwin). -jday At 12:22 PM 12/20/01 -0500, Paul Kienzle wrote: >AFAIK, gnuplot doesn't have fine grained color control, so you might have >trouble with this. I don't know about plplot. > >Here's a possibility: > > # generate some data > x = rand(30,1); > y = rand(size(x)); > C = rand(size(x)); > # define a colormap that uses different colors for all its points > map=hsv(64); > map(1,:)=[1,1,1]; > colormap(map); > # convert your x,y coordinates to image coordinates > xi = 1+round((x-min(x))/(max(x)-min(x))*399); > yi = 1+round((y-min(y))/(max(y)-min(y))*399); > # use implicit sparse->full conversion to build an image array > # use conv2 to spread spread the points out a bit (ones(5) makes > # them into a 5x5 square, but you could easily define another shape > matrix = conv2(sparse(xi,yi,C,400,400),ones(5),'same'); > # if we had a proper image viewer, we could define the x and y > # axes as well: > xstep = linspace(min(x),max(x),400); > ystep = linspace(min(y),max(y),400); > imagesc(xstep,ystep,matrix); > # or if you have epsTk: > eopen("scatter.ps"); > eglobpar; > >eaxes([min(x),(max(x)-min(x))/10,max(x)],[min(y),(max(y)-min(y))/10,max(y)]); > eimagesc(matrix,map,'e'); > eclose > eview > >Paul Kienzle >pkienzle at users dot sf dot net > >On Wed, Dec 19, 2001 at 07:24:59PM -0500, John Day wrote: > > I have a file of 3-tuples (X,Y,C), where C is an integer 1-16, which I > want > > to scatter-plot, X by Y with C determining the color of the plotted dots. > > > > Does anyone know or have a ready-made function to do this? I don't care > > what the colors are as long as they are unique for each value of C. > > Different-shaped dots will do if we run out of colors. > > > > Thanks, > > John Day > > > > > > > > ------------------------------------------------------------- > > Octave is freely available under the terms of the GNU GPL. > > > > Octave's home on the web: http://www.octave.org > > How to fund new projects: http://www.octave.org/funding.html > > Subscription information: http://www.octave.org/archive.html > > ------------------------------------------------------------- > > ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------