Pyxplot

Examples - Box


Prev
Next

Download this example:

Using the colormap plot style with the fft command to draw a diffraction pattern (II)

The Fourier transform of a rectangular box, plotted using the colormap 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 nocolorkey
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 colormap

# 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 colormap

set display
refresh