Gnuplot¶
Module¶
Gnuplot is now available as module in 2022r2
software stack:
Do you want X11 terminal to splash windows?
The gnuplot
module available on login and worker nodes is not compiled with the X11 terminal support (i.e. it will not be able to splash windows with your graphs, only save them as files). This functionality is included in the gnuplot
module available on visual nodes.
However, you can compile your own version of gnuplot
, which will support X11 (see below).
Compiling locally¶
Gnuplot is available in the 2022r2
software stack. It is also possible to compile it locally (in the example below, in your /scratch/$USER/tools
directory).
Load necessary modules:
module load 2022r2
module load fontconfig
module load freetype
module load gettext
module load libffi
module load libiconv
module load pcre
module load perl
module load python
module load zlib
module load glib
module load pixman
module load cairo
module load libcerf
module load libgd
module load libxpm
module load fribidi
module load gobject-introspection
module load icu4c
module load harfbuzz
module load pango
module load readline
Export necessary environment variables:
export CPATH=$CAIRO_ROOT/include/cairo:$CPATH
export CPATH=$LIBGD_ROOT/include:$CPATH
export LIBRARY_PATH=$LIBGD_ROOT/lib:$LIBRARY_PATH
export CPATH=$GLIB_ROOT/include/glib-2.0:$CPATH
export CPATH=$GLIB_ROOT/lib/glib-2.0/include:$CPATH
export CPATH=$PANGO_ROOT/include/pango-1.0:$CPATH
export CPATH=$LIBICONV_ROOT/include:$CPATH
export LIBRARY_PATH=$LIBICONV_ROOT/lib:$LIBRARY_PATH
Download the source:
cd /scratch/$USER/tools
wget https://sourceforge.net/projects/gnuplot/files/gnuplot/5.4.3/gnuplot-5.4.3.tar.gz
Unpack:
Prepare the installation folders:
Configure, compile, and install:
Cleanup:
Test:
Create a simple script sinx.p
:
# Set the output to a png file
set terminal png size 500,500
# The file we'll write to
set output 'sinx.png'
# The graphic title
set title 'Sin(x)'
#plot the graphic
plot sin(x)
Execute:
Output should be a sinx.png
file:
Equally, an interactive splash window functionality is there (provided, you are connected to DelftBlue with X-forwarding):
G N U P L O T
Version 5.4 patchlevel 3 last modified 2021-12-24
Copyright (C) 1986-1993, 1998, 2004, 2007-2021
Thomas Williams, Colin Kelley and many others
gnuplot home: http://www.gnuplot.info
faq, bugs, etc: type "help FAQ"
immediate help: type "help" (plot window: hit 'h')
Terminal type is now 'x11'
Actually, you do not only get an X11 terminal, but also a lot of other options:
gnuplot> set terminal
Available terminal types:
cairolatex LaTeX picture environment using graphicx package and Cairo backend
canvas HTML Canvas object
cgm Computer Graphics Metafile
context ConTeXt with MetaFun (for PDF documents)
domterm DomTerm terminal emulator with embedded SVG
dumb ascii art for anything that prints text
dxf dxf-file for AutoCad (default size 120x80)
emf Enhanced Metafile format
epscairo eps terminal based on cairo
epslatex LaTeX picture environment using graphicx package
fig FIG graphics language V3.2 for XFIG graphics editor
gif GIF images using libgd and TrueType fonts
hpgl HP7475 and relatives [number of pens] [eject]
jpeg JPEG images using libgd and TrueType fonts
mf Metafont plotting standard
mp MetaPost plotting standard
pcl5 PCL5e/PCL5c printers using HP-GL/2
pdfcairo pdf terminal based on cairo
pict2e LaTeX2e picture environment
png PNG images using libgd and TrueType fonts
pngcairo png terminal based on cairo
Press return for more:
postscript PostScript graphics, including EPSF embedded files (*.eps)
pslatex LaTeX picture environment with PostScript \specials
pstex plain TeX with PostScript \specials
pstricks LaTeX picture environment with PSTricks macros
sixelgd sixel using libgd and TrueType fonts
svg W3C Scalable Vector Graphics
tek40xx Tektronix 4010 and others; most TEK emulators
tek410x Tektronix 4106, 4107, 4109 and 420X terminals
texdraw LaTeX texdraw environment
tkcanvas Tk canvas widget
unknown Unknown terminal type - not a plotting device
vttek VT-like tek40xx terminal emulator
x11 X11 Window System interactive terminal
xlib X11 Window System (dump of gnuplot_x11 command stream)
xterm Xterm Tektronix 4014 Mode