[R] Plotting the complex fft in 3D?

Duncan Murdoch murdoch at stats.uwo.ca
Thu Sep 4 21:19:07 CEST 2008

Oliver Bandel wrote:
> Hello,
> I'm new to R (using it since about two weeks),
> but absolutely a fan of it from the beginning on. :-)
> Best tool for working with data I found. :-)
> I tried using the fft() and other funcitons for
> analysing time series.
> What I would be glad to have, would be a
> convenient way to display the complex result
> of a fft in a way, that real and imaginary parts
> each use an axis for themselves, and the index of the
> resulting values use the third axe.
> When displaying this as a 3D->2D picture,
> it also would be nice, to change the view,
> like it can be done with persp().
> Is there already a package or script for preparing the data
> of an fft to be displayed in this way?

I don't find this very enlightening, but here you go:

x <- rnorm(1000)
f <- fft(x)

plot3d(1:length(f), Re(f), Im(f))

Duncan Murdoch

More information about the R-help mailing list