gnuplot-0.5.5: 2D and 3D plots using gnuplot

Safe HaskellSafe
LanguageHaskell98

Graphics.Gnuplot.Advanced

Description

Modularized interface to gnuplot that allows complex graphics and fine control of their components. It is designed for non-interactive use, e.g. scripts for plotting statistics.

The hierarchy of objects is as follows:

Although the Haskell wrapper shall save you from the burden of learning gnuplot script syntax, it happens frequently that people ask, how to express a certain gnuplot script using this package. Thus let's annotate the gnuplot script generated by Demo.multiplot in order to show, what belongs to where:

# the terminal selection is part of the 'plot' command of this module
set terminal x11
# multiplot initialization belongs to MultiPlot - of course
set multiplot layout 3, 5
# hiding the names of the temporary files is a FrameOption
unset key
set xrange [-1.0:1.0]
# this plot contains only one graph,
# but several graphs could be given separated by commas
plot "curve0.csv" using 1:2 with lines
plot "curve1.csv" using 1:2 with lines
plot "curve2.csv" using 1:2 with lines
plot "curve3.csv" using 1:2 with lines
plot "curve4.csv" using 1:2 with lines
plot "curve5.csv" using 1:2 with lines
plot "curve6.csv" using 1:2 with lines
set xrange [-2.5:2.5]
set yrange [-2.5:2.5]
# this is a plot build from a Graph3D
splot "curve7.csv" using 1:2:3 with pm3d
set xrange [-1.0:1.0]
set yrange [*:*]
plot "curve8.csv" using 1:2 with lines
plot "curve9.csv" using 1:2 with lines
plot "curve10.csv" using 1:2 with lines
plot "curve11.csv" using 1:2 with lines
plot "curve12.csv" using 1:2 with lines
plot "curve13.csv" using 1:2 with lines
plot "curve14.csv" using 1:2 with lines
unset multiplot

Synopsis

Documentation

plot :: (C terminal, C gfx) => terminal -> gfx -> IO ExitCode Source #

The plot function returns ExitCode, which is nice for programming but ugly for interactive GHCi sessions. For interactive sessions, better use Graphics.Gnuplot.Simple. gfx must be one of the types Plot, Frame, MultiPlot.

This function runs gnuplot asynchronously for interactive terminals (X11, WX) and synchronously for file terminals (PostScript, PNG, etc.). This emulates the behaviour of gnuplot --persist. However, when running asynchronous we cannot obtain a real ExitCode. Thus, in this case we will always return ExitSuccess.

plotDefault :: C gfx => gfx -> IO ExitCode Source #

Plot using the default gnuplot terminal.

plotSync :: (C terminal, C gfx) => terminal -> gfx -> IO ExitCode Source #

plotAsync :: (C terminal, C gfx) => terminal -> gfx -> IO ThreadId Source #

fileContents :: (C terminal, C gfx) => FilePath -> terminal -> gfx -> (String, [T]) Source #

Return the gnuplot script and the curve files corresponding to your plot data. The first parameter is the directory where the curve files are located. This directory is baked into the gnuplot script and the paths of the curve files.

Don't make any assumptions about the structure of the files. Feeding the files to gnuplot, archiving them or study them are the intended uses of them.