Pyxplot

Examples - Cosine amplitude


Prev
Next

Download this example:

An example of the surface plotting style, with variable color

Pyxplot's surface plotting style evaluates a function at a grid of points in the x-y plane, and draws a 3D surface showing how the function varies across the plane. For added prettiness, an expression is also given for the color of the line, which varies from point to point. As in expressions passed to the using modifier, the columns of data are referred to as $1 for the first column, i.e. x; $2 for the second column, y; etc. The expression given here uses the built-in function hsb() to produce a color object with the specified hue, saturation and brightness.

Script

set numerics complex
set xlabel r"$x$"
set ylabel r"$y$"
set zlabel r"$\left|\cos(x+iy)\right|$"
set xformat r"%s$\pi$"%(x/pi)
set key below
set size 6 ratio 1 zratio 0.5
set grid
plot 3d [-pi:pi][-1:1] abs(cos(x+i*y)) with surface \
            fillc hsb($1/pi/2+0.5,0.9,0.8)