Re: Q:Nicer than: Function[x,MapAt[Im,x,2]]/@data
- To: mathgroup at smc.vnet.net
- Subject: [mg5415] Re: Q:Nicer than: Function[x,MapAt[Im,x,2]]/@data
- From: "David B. Wagner" <dbwagner at princon.com>
- Date: Sat, 7 Dec 1996 00:25:42 -0500
- Organization: Principia Consulting
- Sender: owner-wri-mathgroup at wolfram.com
rommel at bc.edu wrote: > > I want to ListPlot the imaginary part of data: > > data={{x0,z0},{x1,z1},{x2,z2}} > > The x? are real, the z? complex. > > My simple but ugly solution was > > Transpose[{Transpose[data][[1]],Im[Transpose[data][[2]]]}] > > after reading a little I came to the shorter > > Function[x,MapAt[Im,x,2]]/@data > > Is there a nicer way to do it? Use rule-based programming: --