RE: Question on Ordering
- To: mathgroup at smc.vnet.net
- Subject: [mg47050] RE: [mg47007] Question on Ordering
- From: "Owen, HL (Hywel)" <H.L.Owen at dl.ac.uk>
- Date: Mon, 22 Mar 2004 05:19:17 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi David, Thanks for that. However, this only works in general for Hue, and not for, say, GrayLevel, or other color functions that take 0-1 arguments (like the really handy GradientColor function posted in the past). I can't see how to insert Normalise[list_]:=((list-#)/(Max[list]-#))&[Min[list]] into this to fix it though. Thanks for the tip on Inner though. Hywel > -----Original Message----- > From: David Park [mailto:djmp at earthlink.net] To: mathgroup at smc.vnet.net > Sent: 20 March 2004 15:18 > To: Owen, HL (Hywel); mathgroup at smc.vnet.net > Subject: [mg47050] RE: [mg47007] Question on Ordering > > > Hywel, > > When one wants to combine two equal length lists to produce a > new list in > the same order, the command to use is Inner. Here is an > example for your > type of plot. > > alist = Table[Sin[2\[Pi] x], {x, 0, 1, 0.05}]; > blist = Table[x, {x, 0, 1, 0.05}]; > > plotdata = Inner[{Hue[#2], Point[{#2, #1}]} &, alist, blist, List]; > > Needs["Graphics`Colors`"] > Show[Graphics[{AbsolutePointSize[4], plotdata}], > Frame -> True, > PlotLabel -> "Rendering Controlled by x Value", > ImageSize -> 450, > Background -> Linen]; > > Just for fun, here is another unconventional use of Inner: > dividing one > equation by another. > > eqn1 = a x == b; > eqn2 = c y == d; > > Inner[Divide, eqn1, eqn2, Equal] > (a*x)/(c*y) == b/d > > David Park > djmp at earthlink.net > http://home.earthlink.net/~djmp/ > > > > From: Owen, HL (Hywel) [mailto:H.L.Owen at dl.ac.uk] To: mathgroup at smc.vnet.net > > I have two sets of data A and B of the same length, that I'd > like to plot > one against the other - this is easy of course: > > ListPlot[Transpose[{A,B}] > > What I'd like to do next is to colour each point according to > the value of B > (or A in principle). The points are easily generated using: > > Point[#]&/@Transpose[{A,B}] > > And if I have a list of colours C I can do something like > > {Hue[#]&/@C,Point[#]&/@Transpose[{A,B}]}//Transpose//Graphics//Show > > The question is how to generate the list of colours C. Note > that I don't > want to sort A and B, since I want to leave them alone to > plot {A,D}, {A,E} > later on. > > I tried various combinations of Ordering[] and Position[] but > didn't get > anywhere. Anyone have any idea? > > Thanks, > > Hywel > > ------------------------------------------------------------------- > Hywel Owen h.owen'at'dl.ac.uk > Accelerator Science and Technology Centre > Daresbury Laboratory, Warrington WA4 4AD, UK > Tel: +44 1925 603797 Fax: +44 1925 603192 > ------------------------------------------------------------------- > This email is confidential. If you have received this email > in error, you > are in notice of its status. > Please notify the sender immediately by reply e-mail and then > delete this > message from your system. Please do not copy or use it for > any purposes, or > disclose its contents to any other person: to do so could be > a breach of > confidence. > Thank you for your co-operation. > > If this message contains information that you have requested > from us please > see our standard notice for details of how you may use that > information. If > the notice is not attached and you require a copy please > contact the FoI > Officer by emailing FOI-Officer at cclrc.ac.uk > <mailto:FOI-Officer at cclrc.ac.uk> > or visit our web site <http://www.foi.cclrc.ac.uk>, > > Any views expressed in this message are those of the > individual sender and > may not necessarily reflect the views of CCLRC. > ----------------------------------------------------------------- > >