Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Plot Lists of values from excel to mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95344] Re: [mg95310] Plot Lists of values from excel to mathematica
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Fri, 16 Jan 2009 06:08:22 -0500 (EST)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200901151110.GAA18969@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

I presume your data comes from Excel in the form of a list of lists, 
with each constituent list being a row of your table, i.e.:

   xy = {{1,5,2,4},{2,6,1,2},{3,2,2,1},{4,1,7,2}};

Define an auxiliary function to associate the first entry in each row 
with each of the remaining entries in its row:

   f[lis_] := Flatten[Outer[List, {First[lis]}, Rest[lis]], 1]

Now Apply that function to each row (but do it all at once) and do a 
ListPlot of the result:

   ListPlot[f/@xy,PlotStyle->{PointSize[Large]}]

I don't know whether this is the "simplest" way, but it's a reasonably 
straightforward way.

dinodeblasio at gmail.com wrote:
> Hello everybody I'd like to plot in mathematica one four columns data
> that i have in excel, how i can do that in mathematica? For example I
> have:
> 1 5 2 4
> 2 6 1 2
> 3 2 2 1
> 4 1 7 2
> 
> I'd like to have a plot wher on the x axis I have 1,2,3,4 and for the
> x=1 the point are at: 5,2,4; at x=2 the points are at 6,1,2 and so on.
> What is the simplest way to do that in mathematica?
> Thanks very much.
> Dino
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Mathematica Player Pro 7 now available
  • Next by Date: Re: Problem in generating a DO cycle (mathematica 6.0)
  • Previous by thread: Re: Plot Lists of values from excel to mathematica
  • Next by thread: Which editor do you use for math articles