matplotlib

Bindings to Matplotlib; a Python plotting library

https://github.com/abarbu/matplotlib-haskell

Version on this page:0.6.0
LTS Haskell 22.43:0.7.7
Stackage Nightly 2024-12-09:0.7.7
Latest on Hackage:0.7.7

See all snapshots matplotlib appears in

BSD-3-Clause licensed by Andrei Barbu
Maintained by [email protected]
This version can be pinned in stack with:matplotlib-0.6.0@sha256:7855f48c6c8bbfd1bb6b2dd70d4b8f9741b57a424121d7edd0de97586a0859b1,2085

Module documentation for 0.6.0

Matplotlib

Build Status Hackage

Haskell bindings to Python’s Matplotlib. It’s high time that Haskell had a fully-fledged plotting library!

matplotlib contour plot

Documentation is available on Hackage. For more examples see the tests.

{-# LANGUAGE ExtendedDefaultRules #-}

import Graphics.Matplotlib

degreesRadians a = a * pi / 180.0

main :: IO ()
main = do
  Right _ <- onscreen $ contourF (\a b -> sin (degreesRadians a) + cos (degreesRadians b)) (-100) 100 (-200) 200 10
  return ()

We need -XExtendedDefaultRules to avoid having to manually having to specify certain types.

Installation

You will need several python libraries to run this code which can be installed on Ubuntu machines with the following command:

sudo apt-get install -y python3-pip python3-matplotlib python3-numpy python-mpltoolkits.basemap

If you have instructions for other machines or OSes let me know. We require /usr/bin/python3 to be available; the path isn’t configurable right now.

Once you have the prerequisites you can install using the standard incantation

cabal install matplotlib

Examples

Click on any of the examples below to go to the corresponding test that generates it. Depending on your matplotlib version default colors might be different.

integral griddata streamplot hist2DLog quadratic spines annotation corr bivariateNormal images labelled-histogram projections histogram pcolorlog scatter stacked legend errorbar line-options quiver-fancy contour boxplot show-matrix scatterhist hinton density violinplot histMulti cumulative polar hists tex eventplot line-function density-bandwidth quiver pie