Re: Export Plot3D as text
- To: mathgroup at smc.vnet.net
- Subject: [mg112937] Re: Export Plot3D as text
- From: Fred Klingener <gigabitbucket at BrockEng.com>
- Date: Wed, 6 Oct 2010 03:17:37 -0400 (EDT)
- References: <i8c8r0$g68$1@smc.vnet.net>
On Oct 4, 6:04 am, Laura Elizabeth McMullen <mcmul... at science.oregonstate.edu> wrote: > Hi all- > > I have functions I am plotting in 3D in Mathematica, defining ranges > of values for two of the variables in the function with the Plot3D > command. I would like to reproduce these plots in another program, > but am having difficulty exporting the data in a useful format. I > would like the data to be lists of numerical data, but when I export > the data as text, the file is huge. Any suggestions? Thanks for your > help. There are probably very terse and elegant ways to get this, but I usually have to start with brute force. Here's a Plot3D from the doc center: p = Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}] This shows the structure, a GraphicsComplex inside a Graphics3D: p // FullForm You can look at the basic structure with {Head[#], Length[#], Depth[#]} &@p {Graphics3D, 2, 11} p[[1]] is the GraphicsComplex and p[[2]] is the Option list for the Graphics3D. Looking at the GC: In[19]:= {Head[#], Length[#], Depth[#]} & /@ p[[1, 1 ;; 3]] Out[19]= GraphicsComplex[{List, 3372, 3}, {List, 2, 9}, {Rule, 2, 4}] So the simplest useful thing you probably want to export is the surface node list p[[1, 1]], but connectivity and vertex normals are in 2;;3 if you need refinement. p[[1, 1]] can be 'huge,' but as a List, it's a lot easier to handle than a text file. Hth, Fred Klingener