Menu

Tree [e44b17] master 1.0 /
 History

HTTPS access


File Date Author Commit
 .vscode 2017-10-14 Alejandro Linarez Rangel Alejandro Linarez Rangel [3f0269] Initial commit
 docs 2017-10-14 Alejandro Linarez Rangel Alejandro Linarez Rangel [3f0269] Initial commit
 src 2017-10-14 Alejandro Linarez Rangel Alejandro Linarez Rangel [3f0269] Initial commit
 .gitignore 2017-10-14 Alejandro Linarez Rangel Alejandro Linarez Rangel [3f0269] Initial commit
 COPYING.LESSER 2017-10-14 Alejandro Linarez Rangel Alejandro Linarez Rangel [3f0269] Initial commit
 LICENSE 2017-10-14 Alejandro Linarez Rangel Alejandro Linarez Rangel [3f0269] Initial commit
 README.md 2017-10-14 Alejandro Linarez Rangel Alejandro Linarez Rangel [3f0269] Initial commit
 Setup.hs 2017-10-14 Alejandro Linarez Rangel Alejandro Linarez Rangel [3f0269] Initial commit
 hs-octoplot.cabal 2017-10-14 Alejandro Linarez Rangel Alejandro Linarez Rangel [e44b17] Added source-repository field to cabal file

Read Me

OctoPlot Haskell Library

Plotting with Haskell! this library was designed to make plotting easy and
fast.

Description

OctoPlot is a plotting library designed to be easy to used and fast to
implement. Originally designed for the hs-automata package
(the Automata library for Haskell), this library includes support for
plotting, scattering and simulations by using just one function (per-task)!

The interface of this library was based on the MATLAB / GNU-Octave plotting
functions. By using the gloss package (the Gloss library) this
library can easily plot and scatter functions.

Examples

Plotting the sin function

import Graphics.Rendering.OctoPlot

-- defined only for convenience with following examples:
mySignal :: Float -> Float
mySignal = sin

x = linspace (-2 * pi) 200.0 (2 * pi)
y = mySignal <$> x

main = plot x y mkDefaultOption

Changing the legend

import Graphics.Rendering.OctoPlot

-- defined only for convenience with following examples:
mySignal :: Float -> Float
mySignal = sin

x = linspace (-2 * pi) 200.0 (2 * pi)
y = mySignal <$> x

myOptions = mkDefaultOption { legendOption = "The sin function" }

main = plot x y myOptions

Scattering

import Graphics.Rendering.OctoPlot

x :: Linspace Float
x = linspace (-2 * pi) 20.0 (2 * pi)
y :: Linspace Float
y = (\x -> abs (sin x) * x) <$> x

opts :: Option
opts = mkDefaultOption { legendOption = "Scattering example" }

main = scatter x y opts

Simulation

import Graphics.Rendering.OctoPlot

data Model = Model { counter :: !Int }

transitionF :: Model -> Model
transitionF m = Model { counter = counter m + 1 }

displayF :: Model -> Picture
displayF Model { counter = c } = Text $ show c

main = simulate 1
                Model { counter = 1 }
                transitionF
                displayF

Dependencies

  • The Gloss library: Cabal package gloss.
  • The containers package.
  • A Haskell 2010 compiler.

Installing

This library is cabal-ized, so you can just use:

cabal configure
cabal build
cabal install

This library also has support for Haddock:

cabal haddock --html

Also, this library is on Hackage as
hs-octoplot:

cabal update
cabal install hs-octoplot

Documentation

You can see the full documentation on Hackage or the basic
tutorial on the docs/ folder.

Alternatives

The Chart package provides a full-featured support for complex
plotting (like histograms, vector-plotting and more).

The easyplot package provides a GNUPlot backend and similar
functions.

The matplotlib is a full-featured plotting library based
on the Python's matplotlib module.

None of them provides some of the functions heavily used by the main user of
this library: hs-automata.

License

LGPL-3.0

MongoDB Logo MongoDB