Eric Weeks - personal pages - misc

One-liner trigonometric plot

A very simple plot created by stringing together a few things. See the bottom of the page for links to other simple algorithms like this one.
[home] [research]
[software] [pics]
[misc/links] [about me]

weeks@physics.emory.edu

This was created with the following command:

seq 0 1000 0.3 | gawk '{print $1,sin($1),(sin($1/10)+1)/2,(cos($1/10)+1)/2, (sin($1/2)+1)/2}' | psdraw -C -c 0.15 > trig.ps

The basic idea is that I'm plotting the trigonometric function sine(x) so quickly that you can't see the waves; instead, you see overlapping sine functions. I'm plotting small colored circles for each point.

This is not technically a one-liner, perhaps, as I'm using two additional programs. The program "seq" is used to print the numbers 0 to 1000 in increments of 0.3. The program psdraw takes the numbers and makes a postscript file, using the 3rd-5th columns of the input to set the RGB colors. The gawk script in the middle generates the data; I choose the various trig functions for the colors somewhat arbitrarily.

Click here if you'd like to see the source code for seq (actually, a perl script based on something I read in a book).

Click here for more information on psdraw.

Another version of this picture:

This was made with the command:

seq 0 1000 0.6 | gawk '{print $1,sin($1),(sin($1/40)+1)/2,(cos($1/40)+1)/2, (sin($1/4)+1)/2}' | psdraw -C -c 0.3 > trig2.ps

Links...


Simple trigonometric plot | Double-trigonometric contour plot | Lissajous figures | Simple diffusion limited aggregation | Spiral triangles | Polar flowers

This page created August 22, 1996.


Current address:
Eric R. Weeks
weeks@physics.emory.edu
Department of Physics
Emory University
Atlanta, GA 30322-2430