RE: Plotting multi-column data
- To: mathgroup at smc.vnet.net
- Subject: [mg71160] RE: [mg71100] Plotting multi-column data
- From: "David Park" <djmp at earthlink.net>
- Date: Thu, 9 Nov 2006 03:39:55 -0500 (EST)
David, Here is some sample data (of course, it is always better if the poster provides a sample set of data so it might correspond to what he is doing and save responders the time to make up data.) data = Table[{x, Sin[x], Cos[x], x^2/(2Pi)^2} // Chop, {x, 0., 2Pi, 2Pi/20}]; The following statement picks out the i'th set of data. plotdata[i_] := Part[#, {1, i + 1}] & /@ data The following plots all the data curves in one plot. Show[Graphics[ {Table[Line[plotdata[i]], {i, 1, 3}]}], Frame -> True, ImageSize -> 350]; The following plots the curves in different colors and also adds the points. You might want to add other directives such as AbsoluteDashing and if you load MultipleListPlot you could also you Symbol or MakeSymbol (instead of Point) to mark the points. Show[Graphics[ {Line[plotdata[1]], Blue, Line[plotdata[2]], Red, Line[plotdata[3]], Black, AbsolutePointSize[4], Point /@ plotdata[1], Point /@ plotdata[2], Point /@ plotdata[3]}], Frame -> True, ImageSize -> 350]; David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: David Wood [mailto:dmwood at floyd.comcast.net] To: mathgroup at smc.vnet.net Howdy, all. I'd like to to plot multi-column data, a line of which might look like, e.g.: x1 y1 y2 y3 y4 y5 using Mathematica. (I might have several tens of columns of data.) (Yes, I know MultipleListPlot would handle sets like {{x1,f1(x1)},{x2,f1(x2},..}} etc, but this requires clumsily defining several dozen new standalone data arrays.) How to accomplish this efficiently appears mystically opaque to my untutored eyes, or perhaps I'm addled from too much US election coverage. A Google search on this group's archives, MathSource, and the Wolfram site with the inoffensive keywords plot multi-column data yielded doodly-squat (actually, less than that). Any suggestions? Many thanks!