Line 10: | Line 10: | ||
Gnuplot is a command-line driven graphing utility that is copyrighted but freely distributed. Designed for efficient and interactive visualization of mathematical functions and data. It has the capacity for generating publication quality figures of 2 or 3 dimensions composed of lines, points, boxes, contours, vector fields, surfaces and texts. | Gnuplot is a command-line driven graphing utility that is copyrighted but freely distributed. Designed for efficient and interactive visualization of mathematical functions and data. It has the capacity for generating publication quality figures of 2 or 3 dimensions composed of lines, points, boxes, contours, vector fields, surfaces and texts. | ||
− | + | Gnuplot is installed on most Compute Canada/SHARCNET systems as part of the default software stack. | |
− | Gnuplot is installed on most SHARCNET systems as part of the | + | |
− | + | ||
− | + | ||
− | + | ||
=Example plots= | =Example plots= |
Revision as of 16:05, 9 May 2019
Note: This page's content only applies to the SHARCNET's legacy systems; it does not apply to Graham. |
Contents
GNUPLOT |
---|
Description: Portable command-line driven graphing utility. |
SHARCNET Package information: see GNUPLOT software page in web portal |
Full list of SHARCNET supported software |
Introduction
Gnuplot is a command-line driven graphing utility that is copyrighted but freely distributed. Designed for efficient and interactive visualization of mathematical functions and data. It has the capacity for generating publication quality figures of 2 or 3 dimensions composed of lines, points, boxes, contours, vector fields, surfaces and texts.
Gnuplot is installed on most Compute Canada/SHARCNET systems as part of the default software stack.
Example plots
Set up
The following examples can be run on SHARCNet system development nodes. For instance, in order to run these examples on an Orca development node the following steps should be followed:
- Login to the system enabling X11 forwarding with the -Y option to ssh:
bucanl-jad@bucanl-bonx8:~$ ssh -Y jdesjard@orca.sharcnet.ca Welcome to the SHARCNET cluster Orca. Please see the following URLs for status of this and other clusters: https://www.sharcnet.ca/help/index.php/Orca https://www.sharcnet.ca/my/systems *****
- Then login to a development node using the -Y option to ssh again:
[jdesjard@orc-login1:~] ssh -Y orc-dev1 Last login: Fri Dec 4 10:05:53 2015 from orc-login2.orca.sharcnet Welcome to the SHARCNET cluster Orca. Please see the following URLs for status of this and other clusters: https://www.sharcnet.ca/help/index.php/Orca https://www.sharcnet.ca/my/systems *****
- Next load the GNUPlot module:
module load gnuplot/4.4.3
- Then launch the program:
[jdesjard@orc129:~] gnuplot G N U P L O T Version 4.4 patchlevel 3 last modified March 2011 System: Linux 2.6.32-358.18.1.el6.x86_64 Copyright (C) 1986-1993, 1998, 2004, 2007-2010 Thomas Williams, Colin Kelley and many others gnuplot home: http://www.gnuplot.info faq, bugs, etc: type "help seeking-assistance" immediate help: type "help" plot window: hit 'h' Terminal type set to 'x11' gnuplot>
Once that "gnuplot>" prompt is in the terminal (that is set to 'X11') the following examples can be pasted to generate the example figures.
Example 1: multiple axis scaling
[jdesjard@bul128:~] cat /home/jdesjard/gnuplot/example1.in # # $Id: multiaxis.dem,v 1.1 2007/06/09 22:10:45 sfeam Exp $ # # Use the 3rd plot of the electronics demo to show off # the use of multiple x and y axes in the same plot. # A(jw) = ({0,1}*jw/({0,1}*jw+p1)) * (1/(1+{0,1}*jw/p2)) p1 = 10 p2 = 10000 set dummy jw set grid x y2 set key center top title " " set logscale xy set log x2 unset log y2 set title "Transistor Amplitude and Phase Frequency Response" set xlabel "jw (radians)" set xrange [1.1 : 90000.0] set x2range [1.1 : 90000.0] set ylabel "magnitude of A(jw)" set y2label "Phase of A(jw) (degrees)" set ytics nomirror set y2tics set tics out set autoscale y set autoscale y2 plot abs(A(jw)) axes x1y1, 180./pi*arg(A(jw)) axes x2y2 [jdesjard@bul128:~]
Call the script in gnuplot to generate the figure as follows:
gnuplot> call "/home/jdesjard/gnuplot/example1.in"
Example 2: 3D surface
[jdesjard@bul128:~] cat /home/jdesjard/gnuplot/example2.in # # $Id: surface1.dem,v 1.11 2004/09/17 05:01:12 sfeam Exp $ # set samples 21 set isosample 11 set xlabel "X axis" offset -3,-2 set ylabel "Y axis" offset 3,-2 set zlabel "Z axis" offset -5 set title "3D gnuplot demo" set label 1 "This is the surface boundary" at -10,-5,150 center set arrow 1 from -10,-5,120 to -10,0,0 nohead set arrow 2 from -10,-5,120 to 10,0,0 nohead set arrow 3 from -10,-5,120 to 0,10,0 nohead set arrow 4 from -10,-5,120 to 0,-10,0 nohead set xrange [-10:10] set yrange [-10:10] splot x*y [jdesjard@bul128:~]
Call the script in gnuplot to generate the figure as follows:
gnuplot> call "/home/jdesjard/gnuplot/example2.in"
[jdesjard@bul128:~] cat /home/jdesjard/gnuplot/example3.in # # Another example of pm3d hidden surface removal, # this time using pm3d depth-ordering # set multiplot title "Interlocking Tori" set title "PM3D surface\nno depth sorting" set parametric set urange [-pi:pi] set vrange [-pi:pi] set isosamples 50,20 set origin -0.02,0.0 set size 0.55, 0.9 unset key unset xtics unset ytics unset ztics set border 0 set view 60, 30, 1.5, 0.9 unset colorbox set pm3d scansbackward splot cos(u)+.5*cos(u)*cos(v),sin(u)+.5*sin(u)*cos(v),.5*sin(v) with pm3d, \ 1+cos(u)+.5*cos(u)*cos(v),.5*sin(v),sin(u)+.5*sin(u)*cos(v) with pm3d set title "PM3D surface\ndepth sorting" set origin 0.40,0.0 set size 0.55, 0.9 set colorbox vertical user origin 0.9, 0.15 size 0.02, 0.50 set format cb "%.1f" set pm3d depthorder splot cos(u)+.5*cos(u)*cos(v),sin(u)+.5*sin(u)*cos(v),.5*sin(v) with pm3d, \ 1+cos(u)+.5*cos(u)*cos(v),.5*sin(v),sin(u)+.5*sin(u)*cos(v) with pm3d unset multiplot [jdesjard@bul128:~]
Call the script in gnuplot to generate the figure as follows:
gnuplot> call "/home/jdesjard/gnuplot/example3.in"
General Notes
Note: This software requires a graphical connection to SHARCNET. Please consult our Remote Graphical Connections page for instructions. |
Visualization systems
For information regarding graphics resources follow the links from the Visualization page.
References
o Online Documentation
http://www.gnuplot.info/documentation.html
o A brief gnuplot tutorial by Henri Gavin
http://people.duke.edu/~hpgavin/gnuplot.html
o Demo Scripts for gnuplot version 5
http://www.gnuplot.info/demo/