Copyright | (c) George Ungureanu KTH/ICT/ESY 2015-2017 |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | ugeorge@kth.se |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Extensions |
|
Synopsis
- data Config = Cfg {}
- defaultCfg :: Config
- silentCfg :: Config
- noJunkCfg :: Config
- prepare :: Plot a => Config -> a -> PlotData
- prepareL :: Plot a => Config -> [a] -> PlotData
- prepareV :: Plot a => Config -> Vector a -> PlotData
- showDat :: PlotData -> IO ()
- dumpDat :: PlotData -> IO [String]
- plotGnu :: PlotData -> IO ()
- heatmapGnu :: PlotData -> IO ()
- showLatex :: PlotData -> IO ()
- dumpLatex :: PlotData -> IO [String]
- plotLatex :: PlotData -> IO ()
- class Plottable a where
- class Plot a where
- data PInfo = Info {}
- type Samples = [(String, String)]
- type PlotData = (Config, PInfo, [(String, Samples)])
User API
The following commands are frequently used as part of the normal modeling routine.
Configuration settings
Record structure containing configuration settings for the plotting commands.
Cfg | |
|
defaultCfg :: Config Source #
Default configuration: verbose, dump everything possible, fire whatever program needed. Check source for settings.
Example usage:
>>>
defaultCfg {xmax = 15, verbose = False, labels = ["john","doe"]}
Cfg {verbose = False, path = "./fig", title = "plot", rate = 1.0e-2, xmax = 15.0, labels = ["john","doe"], fire = True, other = True}
Silent configuration: does not fire any program or print our unnecessary info. Check source for settings.
Clean configuration: verbose, does not dump more than necessary, fire whatever program needed. Check source for settings.
Data preparation
:: Plot a | |
=> Config | configuration settings |
-> a | plottable data type |
-> PlotData | structure ready for dumping |
Prepares a single plottable data structure to be dumped and/or plotted.
prepareL :: Plot a => Config -> [a] -> PlotData Source #
Prepares a list of plottable data structures to be dumped and/or
plotted. See prepare
.
prepareV :: Plot a => Config -> Vector a -> PlotData Source #
Prepares a vector of plottable data structures to be dumped
and/or plotted. See prepare
.
Dumping and plotting data
dumpDat :: PlotData -> IO [String] Source #
Dumps the sampled contents of a prepare
d data set into separate
.dat
files.
plotGnu :: PlotData -> IO () Source #
Generates a GNUplot script and .dat
files for plotting the
sampled contents of a prepare
d data set. Depending on the
configuration settings, it also dumps LaTeX and PDF plots, and
fires the script.
OBS: needless to say that GNUplot
needs to be installed in order to use this command. Also, in order
to fire GNUplot from a ghci session you might need to install
gnuplot-x11
.
heatmapGnu :: PlotData -> IO () Source #
Similar to plotGnu
but creates a heatmap plot using the GNUplot
engine. For this, the input needs to contain at least two columns
of data, otherwise the plot does not show anything, i.e. the
samples need to be lists or vectors of two or more elements.
OBS: same dependencies are needed as for plotGnu
.
showLatex :: PlotData -> IO () Source #
Prints out a LaTeX environment from a prepare
d data set. This
environment should be paste inside a tikzpicture
in a document
title which imports the ForSyDe-LaTeX package.
dumpLatex :: PlotData -> IO [String] Source #
Dumps a set of formatted data files with the extension .flx
that can be imported by a LaTeX document which uses the
ForSyDe-LaTeX package.
plotLatex :: PlotData -> IO () Source #
Creates a standalone LaTeX document which uses the ForSyDe-LaTeX
package, plotting a prepare
d data set. Depending on the
configuration settings, the command pdflatex
may also be invoked
to compile a pdf image.
OBS: A LaTeX compiler is required to run the pdflatex
command. The ForSyDe-LaTeX
package also needs to be installed according to the instructions on
the project web page.
The data types
Below the data types involved are shown and the plottable structures are documented.
class Plottable a where Source #
This class gathers types which can be sampled and converted to a numerical string which can be read and interpreted by a plotter engine.
Instances
(Show a, Real a) => Plottable a Source # | Real numbers that can be converted to a floating point representation |
Defined in ForSyDe.Atom.Utility.Plot | |
Plottable TimeStamp Source # | Time stamps |
Plottable a => Plottable (Vector a) Source # | Vectors of plottable types |
(Show a, Plottable a) => Plottable (AbstExt a) Source # | Absent-extended plottable types |
This class gathers all ForSyDe-Atom structures that can be plotted.
sample :: Float -> a -> Samples Source #
Samples the data according to a given step size.
sample' :: a -> Samples Source #
Samples the data according to the internal structure.
takeUntil :: Float -> a -> a Source #
Takes the first samples until a given tag.
getInfo :: a -> PInfo Source #
Returns static information about the data type.
Instances
Static information of each plottable data type.