The PyXPlot logo

PyXPlot

Examples - Box


The Fourier transform of a rectangular box, plotted using the colourmap plot style.

Script

# Definition of function representing a rectangular box
box(x,y) = tophat(x,1) * tophat(y,0.5)

# Take FFT of disk
fft [-40:40:0.1][-40:40:0.1] fft() of box()

w = unit(5*cm)
set numerics complex
set nogrid
set key below
set nocolourkey
set sample grid 300x300
set size w square

set multiplot
set nodisplay

# Plot real-space image
plot [-2:2][-2:2] box(x,y) with colourmap

# Plot Fourier-domain image
set origin w+unit(5*mm),0
set axis y right
plot [-2:2][-2:2] abs(fft(x,y)) with colourmap

set display
refresh

      

Notes

The Fourier transform of a rectangular box, plotted using the colourmap plot style.