Script for NBLUG talk on gnuplot On a thumbdrive slides script all data files for talk Take Printed copy of script and slides Pad of paper Ruler Gnuplot in action book Pointer Computer, keyboard, mouse, pad, power cords (main box and monitor) monitor cable, keyboard cable, mouse cable, power strip Acer monitor Test at O'Reilly KB works, mouse works, monitor works Projector hooks up to my computer and works Have Internet connection? MAKE SURE LINES AND TEXT OF GRAPHS SHOW UP WELL ON SCREEN! Setup before the talk Open a gedit window and open these files in it Following files in ~/roger/associations/NBLUG/gnuplotTalk script.txt prices In the File Browser, navigate to ~/roger/associations/NBLUG/gnuplotTalk Double click on NBLUGTalkGnuplot.ppt Navigate to ~/OpenSourceCode/gnuplot/doc Double click on GnuplotinAction.pdf Go to page 316 (list of math functions) Open a terminal window cd ~/roger/associations/NBLUG/gnuplotTalk gnuplot cd "/home/rhouse/roger/associations/NBLUG/gnuplotTalk" plot sin(x) Place terminal window below and graphics window above load "scripts/set_line_styles.gp" plot sin(x) (see if the lines are thick enough) plot "prices" (see if the point sizes are okay) exit (graphics window disappears) clear (terminal window empty except for prompt) Bring up first slide, full screen, and leave it up until talk starts Preamble Kyle keeps looking for smaller and smaller computers; I'm going the other way; my next machine is going to be a mainframe Title Slide Go over title slide The talk will be a combination of slides and demo (mostly demo so I don't have to prepare so many slides) Many of the demos have been shamelessly pulled right off the Internet (Thanks to the many people who have contributed.) I'm not an expert, so bear with my confusion Show the book Gnuplot in Action Bring up the terminal window (already positioned as we want) gnuplot Commands are typed in the terminal window plot sin(x) Adjust the graphics window size Plotting happens in the graphics window plot sin(x) (again to show how the window fills) "Pay no attention to the man behing the curtain" load "scripts/set_line_styles.gp" plot sin(x) (again to show how the line thickness has changed) Tips when gnuplot has just been installed set dummy x set xrange [-10:10] set yrange [-1:1] Examples of capabilities: plot sin(x), atan(x) (notice automatic colors) plot [-15:15] [-2:2] sin(x), atan(x) (notice x-range and y-range) plot [-10:10] [-3:3] sin(x), atan(x), cos(atan(x)) (notice colors again, and more complex expression) Here is a series of various plots, to show capabilities plot [-pi/2:pi] [-1:1] cos(x),-(sin(x) > sin(x+1) ? sin(x) : sin(x+1)) (note the ternary operator) plot [-5*pi:5*pi] [-5:5] real(tan(x)/atan(x)), 1/x (note the real(z) function) plot [-10:10] [-1:4.5] real(sin(x)**besj0(x)) (note the Bessel function) Functions available Show p316 of the book pdf: Math (and other functions) available How to increase the resolution plot [-30:20] [-2:2] sin(x*20)*atan(x) set samples 800, 800 replot set samples 100, 100 Three plot commands Notice the use of replot Show slide with plot, splot, replot Plot styles plot sin(x) plot sin(x) with points plot sin(x) with linespoints plot sin(x) with dots (single pixels) plot sin(x) with lines plot sin(x) with impulses plot [-30:20] [-2.5:1.5] besj0(x)*1.2 with impulses, (x**besj0(x))-2.5 Plotting data Show slide with the two things we can plot plot "prices" (look at the x-axis and y-axis and the plotted points) Look at prices file with gedit 1st column: Years (x-axis) 2nd column: Stock prices (y-axis) What about the other two columns? plot "prices" using 1:3 (notice selection of what is x and what is y) plot "prices" using 1:4 plot "prices", "prices" using 1:3, "prices" using 1:4 (notice we get three plots, all different colors, all with diff. symbols) plot "prices", "prices" using 1:3, "prices" using 1:4 with lines (note that default for data files is "with points", for functions is "with lines", but both can be overridden) plot "prices", "prices" using 1:3, "prices" using 1:4, tan(x) (we can mix plots of data and functions) Parametric plotting Circle slide 1: "What does this represent?" Circle slide 2: "How to plot a circle?" plot [-1.1:1.1] [-1.1:1.1] sqrt(1 - x**2),-sqrt(1 - x**2) set size square This is definitely NOT the way to go Circle slide 2: "Better way to plot a circle" set parametric plot [0:2*pi] cos(t), sin(t) Another example load "./scripts/spiral.gp" unset parametric set size nosquare 3d f(x,y) = exp(-(x**2 + y**2)) * cos(x/4) * sin(y) * cos(2*(x**2+y**2)) (we have defined a function) show functions splot [-2:2][-2:2] f(x,y) (doesn't look that good) We need to increase the resolution show isosamples set isosamples 30, 30 Looks better if we do this: set hidden3d More commands set view 77,77 set xyplane 0 set pm3d Two tori example unset pm3d load "./scripts/two_tori.gp" False color example unset parametric load "./scripts/falsecolor.gp" load "./scripts/squaresymmetry.gp" unset pm3d Terminals show terminal help wxt set terminal (58 terminals in the list) How to output to a different terminal Display export_jpeg.gp to show what we're about to do set title plot sin(x) call "./scripts/export_jpeg.gp" "sin.jpg" Test command Wrap up Look at 99bottles.gp load "./scripts/99bottles.gp" Last couple of slides