Re: NewBie question Plot Table of points from a data file
- To: mathgroup at smc.vnet.net
- Subject: [mg53316] Re: [mg53270] NewBie question Plot Table of points from a data file
- From: "David Annetts" <davidannetts at ihug.com.au>
- Date: Wed, 5 Jan 2005 01:21:55 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi jfj, > I want to plot a file of data (x, y, z coordinate on each > line of an ascii file) I can read values with: > pts = ReadList["myfile.dat", Table[Number, {3}]] but How > display it Show[Graphics3D[pts]] give me error How access to > my Table pts? The following should get you started ... pts = Table[{i, j, Random[Real, {-5, 5}]}, {i, 10}, {j, 10}]; pts = Partition[Flatten[pts], 3] Show[Graphics3D[Point[#] & /@ pts], Axes -> True]; > How compute for instance pts[1,1] + pts[2,1] ? Your syntax is wrong for starters, so it's difficult to know what you're after. In[26]:= pts//Short pts[[1, 1]] pts[[2, 1]] pts[[1, 1]] + pts[[2, 1]] Out[26]//Short= {{1,1,3.30002},{1,2,-0.172164},\[LeftSkeleton]97\[RightSkeleton],{10,10,1.\ 63075}} Out[27]= 1 Out[28]= 1 Out[29]= 2 Which might not be what you expected. I guess what you're after is the height, or last element of each point, in which case In[50]:= Last@pts[[1]] Last@pts[[2]] Plus[ Last@pts[[1]], Last@pts[[2]]] Out[50]= 3.30002 Out[51]= -0.172164 Out[52]= 3.12785 works. For 5.0.1, Section 2.4.2 tells you all about parts of lists. Regards, Dave. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.6.8 - Release Date: 3/01/2005