Re: ListPlot + Colors
- To: mathgroup@smc.vnet.net
- Subject: [mg12206] Re: ListPlot + Colors
- From: "John M. Jowett" <John.Jowett@cern.ch>
- Date: Fri, 1 May 1998 03:08:55 -0400
- Organization: CERN
- References: <199804240552.BAA13327@smc.vnet.net.> <6i0sqe$8lf@smc.vnet.net> <35446191.A582035@cern.ch> <35453757.506D@worldnet.att.net>
(In an exchange of email), Sean Ross wrote: > Thanks for the information, but I regard the ColorListPlot as inadequate > as well. I want full control of color as a function of x,y and z > coordinates specified in a ColorFunction type construct. At present, > the 3-D graphs in mathematica only give that kind of control as a > function of z. The 2-D don't give any such options. ColorListPlot > progresses through the Hues as a function of the path length of the > curve. This is a wonderful step in the right direction, but still does > not give me full color control. As soon as I can figure out how to > write packages and manipulate options, I plan to write such a function. Sean, You can colour the points in various ways by giving an appropriate ColorScale function as an option. It is not difficult to make the colour depend on a third z value. Using the sample data in ColorListPlot.nb, try zvalues = (Sqrt[Mod[#[[1]]^2+#[[2]]^2,1]])& /@ data to get a list of hue values periodic in the radial coordinate of each point. Then you can use ihue[z_]:=Hue[zvalues[[Floor[1+z( Length[data]-1)+.3]]]] as a colouring function in colorListPlot[data,ColorScale->ihue] This is just an example. zvalues could be any list of the same length as data, e.g., the z coordinate of a list of {x,y,z} values. In fact you inspired me to make a simple extension of colorListPlot in the package. Now, if you download the new version of the ColorListPlot package from http://wwwslap.cern.ch/~jowett/Madtomma/ construct a list of {x,y,z} values like data3=Table[{t Cos[t],t Sin[2t],t Sin[3t]},{t,0,7Pi,Pi/16}]; and simply do colorListPlot[data3] you'll get a plot where the colour of each point indicates the z value instead of its order in the list. This is now in the Examples section of the notebook. However using the ColorScale option with 2D data still provides more possibilities. John Jowett -- ---------------------------------------------------------------------- Electronic mail: John.Jowett@cern.ch World Wide Web: http://wwwslap.cern.ch/~jowett/ Telephone: +41 22 76 76643 <-----[you can leave voice mail] Fax: +41 22 767 8480 Postal address: SL Division, CERN, CH-1211 Geneva 23, Switzerland Location: Room 1-D18, Building 865, CERN Prevessin Site, France Secretary: +41 (0)22 76 75272 or 73076 <-----[changed 12/12/97] ----------------------------------------------------------------------