http://www.gnuplot.info/demo/

sudo apt-get install gnuplot-x11

This looks like a great tool for tech students of all disciplines. The basic idea is plotting the data from an already prepared data file, e.g. "gaussian.txt" then setting the visual parameters in gnuplot for the look/type of the graph, then running a final plot command e.g.

plot 'gaussian.txt' using (rounded($1)):(1) smooth frequency with boxes

(as in the bottom of page example). The file load of 2000 random numbers is at the site also - or generate your own from...

for i in {1..30}; do echo $RANDOM; done > random.txt

26142

17913

3855

24665

7401...

man 4 random

You can plot this as is:

gnuplot> plot 'random.txt'

There are some really good, flashy examples on the web, if some are a bit complex, written as scripts and requiring .dat files to run with – and this one IS rocket science…

https://www.thanassis.space/gnuplotStreaming.html

You need to download and chmod his files:

./sinuses.pl | ./driveGnuPlots.pl 2 500 500 "Sine" "Cosine"

To help myself get familiar with it, here's a basic maths lesson – graphs plotted of y over x for different values of x give characteristic curve shapes that every teenage student has been tortured with at some point…they can be plotted simply by running gnuplot at the command line – command history applies as the shell:

gnuplot> plot (x)

It defaults to a y=x=0 centred plot showing pos and neg axes for valueless equations as above.

gnuplot> plot (x*x)

= (x**2)

For "y =" value equivalents you get a zero centre axes:

gnuplot> plot y=1x**2

gnuplot> plot (x*x*x)

gnuplot> plot (x*x*x*x)

The odd and even powers now just cycle the same shapes on greater scales.

Clever - it auto sizes the x/y axis scales for you!

Other interesting examples from the web page at:

http://people.duke.edu/~hpgavin/gnuplot.html

*3. THE plot AND splot COMMANDS*

*plot and splot are the primary commands in Gnuplot. They plot functions and data in many many ways. plot is used to plot 2-d functions and data, while splot plots 3-d surfaces and data.*

*Syntax:*

* plot {[ranges]}*

* {[function] | {"[datafile]" {datafile-modifiers}}}*

* {axes [axes] } { [title-spec] } {with [style] }*

* {, {definitions,} [function] ...}*

*where either a [function] or the name of a data file enclosed in quotes is supplied. For more complete descriptions, type: help plot help plot with help plot using or help plot smooth .*

*3.1 Plotting Functions*

*To plot functions simply type: plot [function] at the gnuplot> prompt.*

**2. FUNCTIONS**

*In general, any mathematical expression accepted by C, FORTRAN, Pascal, or BASIC may be plotted. The precedence of operators is determined by the specifications of the C programming language.*

*The supported functions include:*

__________________________________________________________ Function Returns ----------- ------------------------------------------ abs(x) absolute value of x, |x| acos(x) arc-cosine of x asin(x) arc-sine of x atan(x) arc-tangent of x cos(x) cosine of x, x is in radians. cosh(x) hyperbolic cosine of x, x is in radians erf(x) error function of x exp(x) exponential function of x, base e inverf(x) inverse error function of x invnorm(x) inverse normal distribution of x log(x) log of x, base e log10(x) log of x, base 10 norm(x) normal Gaussian distribution function rand(x) pseudo-random number generator sgn(x) 1 if x > 0, -1 if x < 0, 0 if x=0 sin(x) sine of x, x is in radians sinh(x) hyperbolic sine of x, x is in radians sqrt(x) the square root of x tan(x) tangent of x, x is in radians tanh(x) hyperbolic tangent of x, x is in radians ___________________________________________________________ Bessel, gamma, ibeta, igamma, and lgamma functions are also supported. Many functions can take complex arguments. Binary and unary operators are also supported.

*The supported operators in Gnuplot are the same as the corresponding operators in the C programming language, except that most operators accept integer, real, and complex arguments. The ** operator (exponentiation) is supported as in FORTRAN. Parentheses may be used to change the order of evaluation. The variable names x, y, and z are used as the default independent variables.*

For example, try those functions above, or: gnuplot> plot sin(x)/x

gnuplot> splot sin(x*y/20)

gnuplot> plot sin(x) title 'Sine Function', tan(x) title 'Tangent'

*Your data may be in multiple data files. In this case you may make your plot by using a command like:*

* gnuplot> plot "fileA.dat" using 1:2 title 'data A', \*

* "fileB.dat" using 1:3 title 'data B'*

*For information on plotting 3-D data, type:*

* gnuplot> help splot datafile*

You can paste all this below in one go:

gnuplot>

set samples 25

set isosamples 26

set title "Test 3D gnuplot"

set contour base

set hidden3d offset 1

splot [-12:12.01] [-12:12.01] sin(sqrt(x**2+y**2))/sqrt(x**2+y**2)

A good Gaussian histogram example is here: http://psy.swansea.ac.uk/staff/carter/gnuplot/gnuplot_frequency.htm

clear

reset

set key off

set border 3

# Add a vertical dotted line at x=0 to show centre (mean) of distribution.

set yzeroaxis

# Each bar is half the (visual) width of its x-range.

set boxwidth 0.05 absolute

set style fill solid 1.0 noborder

bin_width = 0.1;

bin_number(x) = floor(x/bin_width)

rounded(x) = bin_width * ( bin_number(x) + 0.5 )

plot 'gaussian.txt' using (rounded($1)):(1) smooth frequency with boxes

(RTN)

Ace one liner for pwd file sizes from http://www.commandlinefu.com/commands/view/9781/histogram-of-file-size

gnuplot -p <(echo "set style data hist; set xtic rot by -45; plot '<(stat -c \"%n %s\" *)' u 2:xtic(1)")

Timeline plots tutorial here:

http://www.techrepublic.com/blog/linux-and-open-source/how-to-handle-time-based-data-with-gnuplot/