Re: Help Creating 3D List Line Plot

*To*: mathgroup at smc.vnet.net*Subject*: [mg103763] Re: [mg103729] Help Creating 3D List Line Plot*From*: Bob Hanlon <hanlonr at cox.net>*Date*: Mon, 5 Oct 2009 07:38:50 -0400 (EDT)*Reply-to*: hanlonr at cox.net

data = {{0, -8, 0}, {0, -7, .1}, {0, -6, .1}, {0, -5, .2}, {0, -4, .25}, {0, -3, .3}, {0, \ -2, .37}, {0, -1, .4}, {0, 0, .38}, {1, -7, 0}, {1, -6, 0}, {1, -5, 0}, {1, -4, .2}, {1, -3, .2}, {1, -2, .3}, {1, -1, .33}, {1, 0, .36}, {2, -3, 0}, {2, -2, .1}, {2, -1, .3}, {2, 0, .42}}; Separate the data using Split or, in version 7, use SplitBy data01 = Split[data, #1[[1]] == #2[[1]] &]; data02 = SplitBy[data, First]; data01 == data02 True ListLinePlot[ Rest /@ # & /@ data01, Frame -> True, Axes -> False] Graphics3D[ Transpose[ {{Red, Blue, Green}, Line /@ data01}], BoxRatios -> {.25, 1, 1/GoldenRatio}, Axes -> True] Bob Hanlon ---- Aaron Bramson <aaronbramson at gmail.com> wrote: ============= Hello there, I'm trying to plot the output of my simulations as lines in a 3D Plot but I can't coerce Mathematica do manipulate the data to make this possible. Each experiment is conducted for 100 runs and they each go for different durations of time. Getting the individual points from the output csv is easy enough: MyData := Import["OutputFile1.csv"] MyPoints := Table[List[MyData[[i, 1]], MyData[[i, 20]], MyData[[i, 30]]], {i, Length[MyData]}] where -1 is the column with the run number -20 is the column with the time step -30 is the column for measure I want to see change over time across runs This produces something of the form: {{0, -8, 0}, {0, -7, .1}, {0, -6, .1}, {0, -5, .2}, {0, -4, .25}, {0, -3, .3}, {0, -2, .37}, {0, -1, .4}, {0, 0, .38}, {1, -7, 0}, {1, -6, 0}, {1, -5, 0}, {1, -4, .2}, {1, -3, .2}, {1, -2, .3}, {1, -1, .33}, {1, 0, .36}, {2, -3, 0}, {2, -2, .1}, {2, -1, .3}, {2, 0, .42}} But to plot the data the way I want to see them I need something like: dat01 := {{0, -8, 0}, {0, -7, .1}, {0, -6, .1}, {0, -5, .2}, {0, -4, .25}, {0, -3, .3}, {0, -2, .37}, {0, -1, .4}, {0, 0, .38}} dat02 := {{1, -7, 0}, {1, -6, 0}, {1, -5, 0}, {1, -4, .2}, {1, -3, .2}, {1, -2, .3}, {1, -1, .33}, {1, 0, .36}} dat03 := {{2, -3, 0}, {2, -2, .1}, {2, -1, .3}, {2, 0, .42}} Show[Graphics3D[Line[Partition[dat01, Length[dat01]]]], Graphics3D[Line[Partition[dat02, Length[dat02]]]], Graphics3D[Line[Partition[dat03, Length[dat03]]]]] but in an iterative fashion that goes through MyPoints and collates the points from run# as a separate list. (I'll worry about opacity and color gradients later and just hope it won't be a problem.) The data are sorted by run number and time already, but as an added bonus I'd really like to sort the runs by the z-value of the last element of the list..which seems not difficult once I have the individual lists by run#. None of this would be hard in Java but indices and constructors work differently here. What I came up with is: List[For[i = 1, i < 101, i++, Select[TestData, TestData[[#, 1]] = i &]]] but that gives me an error: "Set::pspec: Part specification #1 is neither an integer nor a list of integers. >>" Apparently I can't refer to an element of the sublist as an part specification. TakeWhile had a similar problem...I can't figure out how to tell Mathematica to take an element if its subelement satisfies a property. Of course there might be a much easier way to make a 3D List Line Plot but I haven't found anything like it anywhere. Any help you can provide would be greatly appreciated. Best, Aaron

**Re: confused about == vs === in this equality**

**Re: Re: Incorrect symbolic improper integral**

**Re: Help Creating 3D List Line Plot**

**Re: Help Creating 3D List Line Plot**