Re: Plotting Data
- To: mathgroup@smc.vnet.net
- Subject: [mg10732] Re: [mg10716] Plotting Data
- From: "JOHN C ERB" <JOHN_C_ERB@prodigy.net>
- Date: Mon, 2 Feb 1998 00:44:25 -0500
Larry, This is one way to do it. Create a table of (x,y) pairs stuff=Table[{i,2i},{i,1,10,1}] {{1,2},{2,4},{3,6},{4,8},{5,10},{6,12},{7,14},{8,16},{9,18},{10,20}} Separate the table into two lists (one list of x, and one of y) {x,y}=Transpose[stuff] {{1,2,3,4,5,6,7,8,9,10},{2,4,6,8,10,12,14,16,18,20}} Define your function, for example: func[x_]:=x+1 Apply the function to the y list and assign the result to ynew ynew=Map[func[#]&,y] {3,5,7,9,11,13,15,17,19,21} Reform your new table newstuff=Transpose[{x,ynew}] {{1,3},{2,5},{3,7},{4,9},{5,11},{6,13},{7,15},{8,17},{9,19},{10,21}} Plot the data ListPlot[newstuff] Good Luck, John C. Erb -----Original Message----- From: Larry C Linik <Larry.C.Linik@tek.COM> To: mathgroup@smc.vnet.net Subject: [mg10732] [mg10716] Plotting Data >I'm plotting data from a table (x,y] and I want to apply a function to >the y values to plot (x,f[y]]. How can I do this? > >Thanks, >Larry >