Re: Visualization of a list of 3D points
- To: mathgroup at smc.vnet.net
- Subject: [mg89389] Re: Visualization of a list of 3D points
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sun, 8 Jun 2008 02:31:20 -0400 (EDT)
- References: <g25nta$hu5$1@smc.vnet.net> <39600.1212644089509.JavaMail.root@m08> <g2dbkt$9me$1@smc.vnet.net>
Hi, I had a reason why I don't use Through[] ! Regards Jens Syd Geraghty wrote: > Bobby & Jens, > > Regarding:- > >> Through is SO underutilised, don't you think? And why use Transpose >> then >> Part, when Part does the job on its own? > > > I thought you might be interested (and perhaps surprised as I was) to > see that using Through & Part was so much slower! > > lst = Table[Table[RandomReal[{-5, 5}], {i, 3}], {x, 10^6}]; > > Timing[{ymin, ymax} = Through[{Min, Max}@lst[[All, 2]]]] > > {0.186833, {-4.99997, 4.99999}} > > Timing[{ymin, ymax} = {Min[#], Max[#]} &[Transpose[lst][[2]]]] > > {0.059739, {-4.99997, 4.99999}} > > > Both are very elegant but Bobby's seems much more intuitive to me but > it is slower on large data sets. > > Cheers ... Syd > > > Syd Geraghty B.Sc, M.Sc. > > sydgeraghty at mac.com > > My System > > Mathematica 6.0.2.1 for Mac OS X x86 (64 - bit) (March 13, 2008) > MacOS X V 10.5.2 > MacBook Pro 2.33 Ghz Intel Core 2 Duo 2GB RAM > > > > > > > On Jun 6, 2008, at 6:45 AM, DrMajorBob wrote: > >> Through is SO underutilised, don't you think? And why use Transpose >> then >> Part, when Part does the job on its own? >> >> lst = {{3.30414, -2.86064, -2.54648}, {4.06572, 3.80403, >> 1.68897}, {-1.72822, -2.03097, -4.1024}}; >> {ymin, ymax} = Through[{Min, Max}@lst[[All, 2]]] >> >> Graphics3D[{Hue[0.8*(#[[2]] - ymin)/(ymax - ymin)], >> Sphere[#, 1/(2 + #[[2]] - ymin)]} & /@ lst] >> >> {-2.86064, 3.80403} >> >> Bobby >> >> On Wed, 04 Jun 2008 23:45:14 -0500, Jens-Peer Kuska >> <kuska at informatik.uni-leipzig.de> wrote: >> >>> Hi, >>> >>> lst = {{3.30414, -2.86064, -2.54648}, {4.06572, 3.80403, >>> 1.68897}, {-1.72822, -2.03097, -4.1024}}; >>> >>> and >>> {ymin, ymax} = {Min[#], Max[#]} &[Transpose[lst][[2]]] >>> Graphics3D[ >>> {Hue[0.8*(#[[2]] - ymin)/(ymax - ymin)], >>> Sphere[#, 1/(2 + #[[2]] - ymin)]} & /@ lst] >>> >>> Regards >>> Jens >>> >>> >>> Alexei Boulbitch wrote: >>>> Dear MathGroup members, >>>> >>>> I have a list containing 3D coordinates of a number of points, like >>>> this one >>>> lst={{3.30414, -2.86064, -2.54648}, {4.06572, 3.80403, >>>> 1.68897}, {-1.72822, -2.03097, -4.1024}, ...} >>>> >>>> I would like to visualize them by plotting them. To plot them as a >>>> set >>>> of points may be trivially done by say, ListPointPlot3D. >>>> Alternatively, >>>> it may be visualized as a set of spheres with unit radius and >>>> centered >>>> in the points specified by the list, e.g. in the point {3.30414, >>>> -2.86064, -2.54648}, in {4.06572, 3.80403, 1.68897} etc. >>>> >>>> Now comes the question. I would like to do it in such a way that the >>>> size (and may be the color) of each point or sphere would depend >>>> upon >>>> one of the coordinates (say, y). In other words, the size and the >>>> of the >>>> first point specified by lst with y=-2.86064 would be smaller than >>>> that >>>> of the second point that has y=3.80403. The color or darkness may >>>> also >>>> depend upon y. This would give a feeling of a perspective. >>>> >>>> Do you have an idea of how to do this? >>>> >>>> Best, Alexei >>>> >>> >> >> >> -- >> >> DrMajorBob at longhorns.com >> > >