Transcript Document

Visualization Tools Overview:
gnuplot
Garrett Love
Shodor Education Foundation
Durham, NC
REVITALISE
Overview of this workshop
• Structured activities
– Global air temperature
plots from grid data
– Parametric plotting of
cyclic time-series data
• Open labs
QuickTime™ and a TIFF (LZW) decompressor are needed to see this picture.
– Random Number Generation
(Mathematics)
– Dynamic Contact Analysis
(Physical Science)
– Air Quality Data
(Environmental Science)
– Diabetes Dynamics (Life Science)
REVITALISE
What is gnuplot?
• Versatile visualization tool
– Command driven, interactive function plotting program
• Designed for mathematics visualization
– Student programmers looking to visualize classroom concepts
– Open source code
• Multiple Platforms
– Unix/Linux, Macs, lots of others
– Windows version has a menu-driven interface
• Copyrighted but freely distributable
– Not part of the Gnu’s Not Unix project (emacs)
REVITALISE
The good gnus (Advantages)
• Quality 2-D/3-D plots of functions and data
• Small set of commands - easy to learn
• Very transferable
– Multiple platforms
– Text file formats for input and command files
•
•
•
•
Can be automated (allows it to be run by other programs)
Can manipulate data with mathematical functions
Existing support community
Free! Free! Free!
– www.gnuplot.info (gnuplot Central)
REVITALISE
The bad gnus (Disadvantages)
•
•
•
•
•
Limited types of plots
Contour plot process a bit difficult
‘Programming’ style assumed
Limited set of styles for lines and points
Limited text abilities for titles and labels
– Greek letters and symbols difficult/not possible
– Formatted math formulas difficult/not possible
• Updates/development depends on volunteers
REVITALISE
Basic Concepts
• Console Window
– Command line
prompt
gnuplot>
– Menu selections
for Windows
version
• Plotting Window
• Help
– ?
– Help <topic>
QuickTime™ and a TIFF (LZW) decompressor are needed to see this picture.
REVITALISE
Function Plots
• 2-D variable is x
gnuplot> plot sin(x)
• Use replot to display a second function
gnuplot> replot cos(x)
• Math functions in fortran style
gnuplot> plot (1.2e-5)*(x**1.4)/exp(x)
• Many functions (use ‘help functions’ to list)
• Eg. abs() sinh() log() rand() acos() sqrt()
REVITALISE
Parametric Plots
gnuplot> set
parametric
• 2-D “dummy”
variable is t
QuickTime™ and a TIFF (LZW) decompressor are needed to see this picture.
gnuplot> plot
sin(2*t),
cos(sqrt(2)*t)
REVITALISE
Data Plots
• Single channel
gnuplot> plot '/Users/grl/Desktop/3ch.dat' using 2
REVITALISE
Data Plots
• Cross plots
gnuplot> plot '3ch.dat' using 3:2 with lines
REVITALISE
Combined Plots
gnuplot> set
parametric
gnuplot> plot
eps(t),t,
’material.dat'
REVITALISE
3-D Scatter Plots
gnuplot> splot '3ch.dat'
REVITALISE
3-D Function Plots
gnuplot> set parametric
gnuplot> splot u,u+v,sin(0.5*(u+v))
REVITALISE
Settings
gnuplot> set xlabel 'Strain(mm/mm)'; set ylabel 'Stress(MPa)' -1,0;
replot
REVITALISE
Settings
gnuplot> set title "1045 Steel";set key 0.007,150; replot
REVITALISE
Settings
gnuplot> set xtics ('low' 0, 'med' .005,'high' .0098); set grid;
set format y '%.1e'; replot
REVITALISE
More Settings
•
•
•
•
•
•
•
Relative Graph size:
Function sampling pts:
Polar Coordinates:
Contour plots:
Perspective:
Angle Units:
Style:
>set size 1,1
>set samples 1000
>set polar
>set contour base
>set view 90,0
>set angles degrees
>set data style lines
REVITALISE
Set at Last
• Show command gives current settings
gnuplot> show xlabel
• Reset recalls default settings
• Save records current settings and plot statement
gnuplot> save ‘c:\thisdir\filename.gp’
• Load executes settings from a file
gnuplot> load ‘c:\thisdir\filename.gp’
• Help is extremely useful in determining set syntax
gnuplot> help set
REVITALISE
Credits
Gnuplot short course
- Tim Langlais, University of
Minnesota
www.me.umn.edu/courses/
shortcourses/gnuplot
- www.gnuplot.info
- www.cs.uni.edu/Help/
gnuplot/
REVITALISE