hs-octoplot: Easy and simple plotting library.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Very simple use: just call the plot or scatter family of functions. All rendering is done by the Gloss library (see the gloss package).

Also, this library includes support for animated simulations.


[Skip to Readme]

Properties

Versions 0.1.0.0
Change log None available
Dependencies base (>=4.8 && <4.9), containers (>=0.5 && <0.6), gloss (>=1.11 && <1.12), gloss-raster (>=1.11 && <1.12) [details]
License LGPL-3.0-only
Copyright (c) 2017 Alejandro Linarez
Author Alejandro Linarez Rangel
Maintainer alinarezrangel@gmail.com
Category Graphics
Home page https://hs-octoplot.sourceforge.io/
Source repo this: git clone git@github.com/alinarezrangel/hs-octoplot.git(tag 1.0)
head: git clone git@github.com/alinarezrangel/hs-octoplot.git
Uploaded by alinarezrangel at 2017-10-14T05:01:08Z

Modules

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for hs-octoplot-0.1.0.0

[back to package description]

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

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