Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: Plotting Data



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
>




  • Prev by Date: Re: RealValued functions and derivatives
  • Next by Date: Re: 3D histograms?
  • Prev by thread: Re: Plotting Data
  • Next by thread: RE: Plotting Data