packages feed

matplotlib 0.6.0 → 0.7.0

raw patch · 4 files changed

+89/−68 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Graphics.Matplotlib.Internal: instance Graphics.Matplotlib.Internal.MplotValue x => Graphics.Matplotlib.Internal.MplotValue (GHC.Base.Maybe x)
+ Graphics.Matplotlib.Internal: instance GHC.Base.Semigroup Graphics.Matplotlib.Internal.Matplotlib
+ Graphics.Matplotlib.Internal: instance Graphics.Matplotlib.Internal.MplotValue x => Graphics.Matplotlib.Internal.MplotValue (GHC.Maybe.Maybe x)
- Graphics.Matplotlib: (#) :: (MplotValue val) => Matplotlib -> val -> Matplotlib
+ Graphics.Matplotlib: (#) :: MplotValue val => Matplotlib -> val -> Matplotlib
- Graphics.Matplotlib: addSubplot :: (MplotValue val2, MplotValue val1, MplotValue val) => val2 -> val1 -> val -> Matplotlib
+ Graphics.Matplotlib: addSubplot :: (MplotValue val1, MplotValue val2, MplotValue val3) => val3 -> val2 -> val1 -> Matplotlib
- Graphics.Matplotlib: axis3DLabels :: (Foldable t, Foldable t1, Foldable t2, Foldable t3, Foldable t4, Foldable t5, Ord (t val), Ord (t2 val1), Ord (t4 val2), Ord val, Ord val1, Ord val2, MplotValue val, MplotValue val1, MplotValue val2) => t5 (t4 val2) -> t3 (t2 val1) -> t1 (t val) -> Matplotlib
+ Graphics.Matplotlib: axis3DLabels :: (MplotValue val1, MplotValue val2, MplotValue val3, Ord val1, Ord val2, Ord val3, Ord (t2 val1), Ord (t3 val2), Ord (t4 val3), Foldable t5, Foldable t2, Foldable t6, Foldable t3, Foldable t7, Foldable t4) => t5 (t2 val1) -> t6 (t3 val2) -> t7 (t4 val3) -> Matplotlib
- Graphics.Matplotlib: barDefaultWidth :: (Integral a1, Fractional a) => a1 -> a
+ Graphics.Matplotlib: barDefaultWidth :: (Fractional a1, Integral a2) => a2 -> a1
- Graphics.Matplotlib: contour :: (Foldable t, Foldable t1, Foldable t2, Foldable t3, Foldable t4, Foldable t5, Ord (t val), Ord (t2 val1), Ord (t4 val2), Ord val, Ord val1, Ord val2, MplotValue val, MplotValue val2, MplotValue val1, ToJSON (t1 (t val)), ToJSON (t3 (t2 val1)), ToJSON (t5 (t4 val2))) => t5 (t4 val2) -> t3 (t2 val1) -> t1 (t val) -> Matplotlib
+ Graphics.Matplotlib: contour :: (ToJSON (t2 (t3 val1)), ToJSON (t4 (t5 val2)), ToJSON (t6 (t7 val3)), MplotValue val2, MplotValue val1, MplotValue val3, Ord val1, Ord val2, Ord val3, Ord (t3 val1), Ord (t5 val2), Ord (t7 val3), Foldable t2, Foldable t3, Foldable t4, Foldable t5, Foldable t6, Foldable t7) => t2 (t3 val1) -> t4 (t5 val2) -> t6 (t7 val3) -> Matplotlib
- Graphics.Matplotlib: errorbar :: (ToJSON t, ToJSON t1, ToJSON t2, ToJSON t3) => t3 -> t2 -> t1 -> t -> Matplotlib
+ Graphics.Matplotlib: errorbar :: (ToJSON a, ToJSON b, ToJSON c, ToJSON d) => a -> b -> c -> d -> Matplotlib
- Graphics.Matplotlib: figText :: (MplotValue val1, MplotValue val) => val1 -> val -> String -> Matplotlib
+ Graphics.Matplotlib: figText :: (MplotValue val1, MplotValue val2) => val2 -> val1 -> String -> Matplotlib
- Graphics.Matplotlib: getSubplot :: (MplotValue val2, MplotValue val1, MplotValue val) => val2 -> val1 -> val -> Matplotlib
+ Graphics.Matplotlib: getSubplot :: (MplotValue val1, MplotValue val2, MplotValue val3) => val3 -> val2 -> val1 -> Matplotlib
- Graphics.Matplotlib: histogram2D :: ToJSON t => t -> t -> Matplotlib
+ Graphics.Matplotlib: histogram2D :: ToJSON a => a -> a -> Matplotlib
- Graphics.Matplotlib: nonUniformImage :: (ToJSON t, ToJSON t1, ToJSON t2) => t2 -> t1 -> t -> Matplotlib
+ Graphics.Matplotlib: nonUniformImage :: (ToJSON a, ToJSON b, ToJSON c) => a -> b -> c -> Matplotlib
- Graphics.Matplotlib: pcolor3 :: (ToJSON t, ToJSON t1, ToJSON t2) => t2 -> t1 -> t -> Matplotlib
+ Graphics.Matplotlib: pcolor3 :: (ToJSON a, ToJSON b, ToJSON c) => a -> b -> c -> Matplotlib
- Graphics.Matplotlib: pie :: (MplotValue val, ToJSON val) => val -> Matplotlib
+ Graphics.Matplotlib: pie :: (ToJSON val, MplotValue val) => val -> Matplotlib
- Graphics.Matplotlib: projections :: (Foldable t, Foldable t1, Foldable t2, Foldable t3, Foldable t4, Foldable t5, Ord (t val), Ord (t2 val1), Ord (t4 val2), Ord val, Ord val1, Ord val2, MplotValue val, MplotValue val2, MplotValue val1, ToJSON (t1 (t val)), ToJSON (t3 (t2 val1)), ToJSON (t5 (t4 val2))) => t5 (t4 val2) -> t3 (t2 val1) -> t1 (t val) -> Matplotlib
+ Graphics.Matplotlib: projections :: (ToJSON (t2 (t3 val1)), ToJSON (t4 (t5 val2)), ToJSON (t6 (t7 val3)), MplotValue val2, MplotValue val1, MplotValue val3, Ord val1, Ord val2, Ord val3, Ord (t3 val1), Ord (t5 val2), Ord (t7 val3), Foldable t2, Foldable t3, Foldable t4, Foldable t5, Foldable t6, Foldable t7) => t2 (t3 val1) -> t4 (t5 val2) -> t6 (t7 val3) -> Matplotlib
- Graphics.Matplotlib: quiver :: (ToJSON t, ToJSON t1, ToJSON t2, ToJSON t3, ToJSON t4) => t4 -> t3 -> t2 -> t1 -> Maybe t -> Matplotlib
+ Graphics.Matplotlib: quiver :: (ToJSON a, ToJSON b, ToJSON c, ToJSON d, ToJSON e) => a -> b -> c -> d -> Maybe e -> Matplotlib
- Graphics.Matplotlib: quiverKey :: (MplotValue val3, MplotValue val2, MplotValue val1, MplotValue val) => val3 -> val2 -> val1 -> val -> Matplotlib
+ Graphics.Matplotlib: quiverKey :: (MplotValue val1, MplotValue val2, MplotValue val3, MplotValue val4) => val4 -> val3 -> val2 -> val1 -> Matplotlib
- Graphics.Matplotlib: setSizeInches :: (MplotValue val1, MplotValue val) => val1 -> val -> Matplotlib
+ Graphics.Matplotlib: setSizeInches :: (MplotValue val1, MplotValue val2) => val2 -> val1 -> Matplotlib
- Graphics.Matplotlib: spineSetBounds :: (MplotValue val1, MplotValue val) => val1 -> val -> Matplotlib
+ Graphics.Matplotlib: spineSetBounds :: (MplotValue val1, MplotValue val2) => val2 -> val1 -> Matplotlib
- Graphics.Matplotlib: spineSetPosition :: (MplotValue val1, MplotValue val) => val1 -> val -> Matplotlib
+ Graphics.Matplotlib: spineSetPosition :: (MplotValue val1, MplotValue val2) => val2 -> val1 -> Matplotlib
- Graphics.Matplotlib: streamplot :: (ToJSON t, ToJSON t1, ToJSON t2, ToJSON t3) => t3 -> t2 -> t1 -> t -> Matplotlib
+ Graphics.Matplotlib: streamplot :: (ToJSON a, ToJSON b, ToJSON c, ToJSON d) => a -> b -> c -> d -> Matplotlib
- Graphics.Matplotlib: subplotBarsLabelled :: (MplotValue val, Foldable t, ToJSON (t a)) => [t a] -> val -> [[Option]] -> Matplotlib
+ Graphics.Matplotlib: subplotBarsLabelled :: (ToJSON (t a), Foldable t, MplotValue val) => [t a] -> val -> [[Option]] -> Matplotlib
- Graphics.Matplotlib: subplotDataBar :: (MplotValue val, MplotValue val2, MplotValue val1) => val2 -> val1 -> val -> [Option] -> Matplotlib
+ Graphics.Matplotlib: subplotDataBar :: (MplotValue val1, MplotValue val2, MplotValue val3) => val2 -> val1 -> val3 -> [Option] -> Matplotlib
- Graphics.Matplotlib: text :: (MplotValue val1, MplotValue val) => val1 -> val -> String -> Matplotlib
+ Graphics.Matplotlib: text :: (MplotValue val1, MplotValue val2) => val2 -> val1 -> String -> Matplotlib
- Graphics.Matplotlib: xacorr :: (ToJSON t, ToJSON a) => a -> t -> [Option] -> Matplotlib
+ Graphics.Matplotlib: xacorr :: (ToJSON a, ToJSON b) => a -> b -> [Option] -> Matplotlib
- Graphics.Matplotlib: xcorr :: (ToJSON t, ToJSON t1) => t1 -> t -> Matplotlib
+ Graphics.Matplotlib: xcorr :: (ToJSON a, ToJSON b) => a -> b -> Matplotlib
- Graphics.Matplotlib.Internal: (#) :: (MplotValue val) => Matplotlib -> val -> Matplotlib
+ Graphics.Matplotlib.Internal: (#) :: MplotValue val => Matplotlib -> val -> Matplotlib
- Graphics.Matplotlib.Internal: class MplotValue val where toPythonOpt = toPython
+ Graphics.Matplotlib.Internal: class MplotValue val

Files

README.md view
@@ -1,27 +1,31 @@-# Matplotlib+![matplotlib contour plot](https://github.com/abarbu/matplotlib-haskell/raw/master/imgs/contour.png) +# Matplotlib for Haskell+ [![Build Status](https://img.shields.io/circleci/project/github/abarbu/matplotlib-haskell.svg)](https://circleci.com/gh/abarbu/matplotlib-haskell) [![Hackage](https://img.shields.io/hackage/v/matplotlib.svg)](https://hackage.haskell.org/package/matplotlib)  Haskell bindings to Python's Matplotlib. It's high time that Haskell had a-fully-fledged plotting library!+fully-fledged plotting library! Examples below. -![matplotlib contour plot](https://github.com/abarbu/matplotlib-haskell/raw/master/imgs/contour.png)+[Documentation is available on Hackage](https://hackage.haskell.org/package/matplotlib). -[Documentation is available on Hackage](https://hackage.haskell.org/package/matplotlib). For-more examples see the tests.+In GHCi:  ```haskell+:set -XExtendedDefaultRules+import Graphics.Matplotlib+onscreen $ contourF (\a b -> sin (a*pi/180.0) + cos (b*pi/180.0)) (-100) 100 (-200) 200 10+```++Or in a standalone file++```haskell {-# 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 ()+main = onscreen $ contourF (\a b -> sin (a*pi/180.0) + cos (degreesRadians b)) (-100) 100 (-200) 200 10 ```  We need `-XExtendedDefaultRules` to avoid having to manually having to specify certain types.@@ -32,15 +36,28 @@ on Ubuntu machines with the following command:  ```bash-sudo apt-get install -y python3-pip python3-matplotlib python3-numpy python-mpltoolkits.basemap+sudo apt-get install -y python3 python3-pip python3-matplotlib python3-numpy python3-tk python-mpltoolkits.basemap python3-scipy dvipng ``` -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.+If you're using conda +```bash+conda install matplotlib scipy tk+```++If you have instructions for other machines or OSes let me know. We require the+`python3` binary to be available somewhere in the PATH. We run with +`env python3`.+ Once you have the prerequisites you can install using the standard incantation  ```bash+stack install matplotlib+```++or++```bash cabal install matplotlib ``` @@ -89,76 +106,76 @@ [![pie][img_pie]][url_pie]  [img_violinplot]: https://i.imgur.com/iBOfnuL.png "violinplot"-[url_violinplot]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L301+[url_violinplot]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L299 [img_contour]: https://i.imgur.com/KoAIf9Z.png "contour"-[url_contour]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L225+[url_contour]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L223 [img_tex]: https://i.imgur.com/bR8r579.png "tex"-[url_tex]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L260+[url_tex]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L258 [img_scatterhist]: https://i.imgur.com/9ZIVotE.png "scatterhist"-[url_scatterhist]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L308+[url_scatterhist]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L306 [img_line-options]: https://i.imgur.com/Fahp7QA.png "line-options"-[url_line-options]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L250+[url_line-options]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L248 [img_griddata]: https://i.imgur.com/SH83pJK.png "griddata"-[url_griddata]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L605+[url_griddata]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L603 [img_pcolorlog]: https://i.imgur.com/ZLUoUqy.png "pcolorlog"-[url_pcolorlog]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L498+[url_pcolorlog]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L496 [img_cumulative]: https://i.imgur.com/u5I8NYF.png "cumulative"-[url_cumulative]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L218+[url_cumulative]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L216 [img_annotation]: https://i.imgur.com/9tdHiaT.png "annotation"-[url_annotation]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L542-[img_hist2DLog]: https://i.imgur.com/2fL8oEX.png "hist2DLog"-[url_hist2DLog]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L278+[url_annotation]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L540 [img_density]: https://i.imgur.com/KS2OhbH.png "density"-[url_density]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L242+[url_density]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L240 [img_line-function]: https://i.imgur.com/zkpfQqW.png "line-function"-[url_line-function]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L244+[url_line-function]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L242 [img_boxplot]: https://i.imgur.com/KigvYSc.png "boxplot"-[url_boxplot]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L295+[url_boxplot]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L293 [img_show-matrix]: https://i.imgur.com/ajY0A9l.png "show-matrix"-[url_show-matrix]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L270-[img_hinton]: https://i.imgur.com/m9a4IwL.png "hinton"-[url_hinton]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L383+[url_show-matrix]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L268+[img_histMulti]: https://i.imgur.com/FxEI3EI.png "histMulti"+[url_histMulti]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L335 [img_streamplot]: https://i.imgur.com/IfHLmkC.png "streamplot"-[url_streamplot]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L585+[url_streamplot]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L583 [img_pie]: https://i.imgur.com/ljgWXf6.png "pie"-[url_pie]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L519+[url_pie]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L517 [img_corr]: https://i.imgur.com/GnBpDJL.png "corr"-[url_corr]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L255+[url_corr]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L253 [img_projections]: https://i.imgur.com/IlK7Oy3.png "projections"-[url_projections]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L248-[img_stacked]: https://i.imgur.com/rWIyizX.png "stacked"-[url_stacked]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L526+[url_projections]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L246+[img_scatter]: https://i.imgur.com/dceKS4I.png "scatter"+[url_scatter]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L218+[img_legend]: https://i.imgur.com/X46KiUJ.png "legend"+[url_legend]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L271 [img_density-bandwidth]: https://i.imgur.com/Qgjvrox.png "density-bandwidth"-[url_density-bandwidth]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L239+[url_density-bandwidth]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L237 [img_bivariateNormal]: https://i.imgur.com/fTSfEzo.png "bivariateNormal"-[url_bivariateNormal]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L468-[img_histMulti]: https://i.imgur.com/FxEI3EI.png "histMulti"-[url_histMulti]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L337+[url_bivariateNormal]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L466+[img_hinton]: https://i.imgur.com/m9a4IwL.png "hinton"+[url_hinton]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L381 [img_quadratic]: https://i.imgur.com/E4AafPD.png "quadratic"-[url_quadratic]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L246+[url_quadratic]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L244 [img_histogram]: https://i.imgur.com/X37Rmy4.png "histogram"-[url_histogram]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L215+[url_histogram]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L213 [img_polar]: https://i.imgur.com/4DAOrF1.png "polar"-[url_polar]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L453+[url_polar]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L451 [img_quiver]: https://i.imgur.com/TcayDLc.png "quiver"-[url_quiver]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L426+[url_quiver]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L424 [img_quiver-fancy]: https://i.imgur.com/NsOFHhx.png "quiver-fancy"-[url_quiver-fancy]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L437+[url_quiver-fancy]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L435+[img_stacked]: https://i.imgur.com/rWIyizX.png "stacked"+[url_stacked]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L524 [img_spines]: https://i.imgur.com/BryQOY9.png "spines"-[url_spines]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L355-[img_errorbar]: https://i.imgur.com/gi0zEiz.png "errorbar"-[url_errorbar]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L290-[img_legend]: https://i.imgur.com/X46KiUJ.png "legend"-[url_legend]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L273+[url_spines]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L353+[img_hist2DLog]: https://i.imgur.com/2fL8oEX.png "hist2DLog"+[url_hist2DLog]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L276 [img_integral]: https://i.imgur.com/PkepIKR.png "integral"-[url_integral]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L399-[img_scatter]: https://i.imgur.com/dceKS4I.png "scatter"-[url_scatter]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L220+[url_integral]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L397+[img_errorbar]: https://i.imgur.com/gi0zEiz.png "errorbar"+[url_errorbar]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L288 [img_labelled-histogram]: https://i.imgur.com/lCVEpge.png "labelled-histogram"-[url_labelled-histogram]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L227+[url_labelled-histogram]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L225 [img_eventplot]: https://i.imgur.com/UMT1yku.png "eventplot"-[url_eventplot]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L283+[url_eventplot]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L281 [img_hists]: https://i.imgur.com/KurE2Sr.png "hists"-[url_hists]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L374+[url_hists]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L372 [img_images]: https://i.imgur.com/R1fhDXC.png "images"-[url_images]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L485+[url_images]: https://github.com/abarbu/matplotlib-haskell/blob/master/test/Spec.hs#L483
matplotlib.cabal view
@@ -1,5 +1,5 @@ name:                matplotlib-version:             0.6.0+version:             0.7.0 synopsis:            Bindings to Matplotlib; a Python plotting library description:     Matplotlib is probably the most full featured plotting library out there.
src/Graphics/Matplotlib/Internal.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleInstances, ScopedTypeVariables, FlexibleContexts, ExtendedDefaultRules, ExistentialQuantification #-}+{-# LANGUAGE FlexibleInstances, ScopedTypeVariables, FlexibleContexts, ExtendedDefaultRules, ExistentialQuantification, CPP #-} -- | -- Internal representations of the Matplotlib data. These are not API-stable -- and may change. You can easily extend the provided bindings without relying@@ -35,7 +35,12 @@ -- | Monoid instance for Matplotlib type instance Monoid Matplotlib where     mempty  = mp+#if !MIN_VERSION_base(4,11,0)     mappend = (%)+#else+instance Semigroup Matplotlib where+    (<>) = (%)+#endif  instance NFData Matplotlib where     rnf (Matplotlib cs po re) = rnf cs `seq` rnf po `seq` rnf re@@ -338,6 +343,7 @@                      ,"import matplotlib.image as mpimg"                      ,"from mpl_toolkits.mplot3d import axes3d"                      ,"import numpy as np"+                     ,"from scipy import interpolate"                      ,"import os"                      ,"import sys"                      ,"import json"
test/Spec.hs view
@@ -139,7 +139,7 @@                                                        case (stderr, reads stderr) of                                                          ("inf", _) -> return Nothing                                                          (_, [(x :: Double, _)]) ->-                                                           if x < 35 then+                                                           if x < 25 then                                                              return $ Just $ "Images very different; PSNR too low " ++ show x else                                                              return Nothing)))                                    (BS.writeFile ref))@@ -148,14 +148,12 @@  -- | Test one plot; right now we just test that the command executed without -- errors. We should visually compare plots somehow.-testPlot name fn = testCase name $ tryit fn @?= Right ""+testPlot' name fn = testCase name $ tryit fn @?= Right ""   where tryit fn = unsafePerformIO $ withSystemTempFile "a.png" (\filename _ -> file filename fn)  -- | This generates examples from the test cases-testPlot' name fn = testCase name $ tryit fn name @?= Right ""+testPlot name fn = testCase name $ tryit fn name @?= Right ""   where tryit fn name = unsafePerformIO $ do-          c <- code fn-          print c           file ("/tmp/imgs/" ++ name ++ ".png") fn  basicTests f = testGroup "Basic tests"@@ -336,11 +334,11 @@  mhistMulti = subplots @@ [o2 "nrows" 2, o2 "ncols" 2]   % setSubplot 0-  % histogram x nrBins @@ [o2 "normed" 1, o2 "histtype" "bar", o2 "color" ["red", "tan", "lime"], o2 "label" ["red", "tan", "lime"]]+  % histogram x nrBins @@ [o2 "density" 1, o2 "histtype" "bar", o2 "color" ["red", "tan", "lime"], o2 "label" ["red", "tan", "lime"]]   % legend @@ [o2 "prop" $ lit "{'size': 10}"]   % title "bars with legend"   % setSubplot 1-  % histogram x nrBins @@ [o2 "normed" 1, o2 "histtype" "bar", o2 "stacked" True]+  % histogram x nrBins @@ [o2 "density" 1, o2 "histtype" "bar", o2 "stacked" True]   % title "stacked bar"   % setSubplot 2   % histogram x nrBins @@ [o2 "histtype" "step", o2 "stacked" True, o2 "fill" False]@@ -378,7 +376,7 @@   where ns mu var = map (\x -> mu + x * var) $ take 1000 normals         h mu var = histogram (ns mu var) 25 @@ [o2 "histtype" "stepfilled"                                              ,o2 "alpha" 0.8-                                             ,o2 "normed" True]+                                             ,o2 "density" True]  mhinton = mp # "ax.patch.set_facecolor('gray')"   % setAspect @@ [o1 "equal", o1 "box"]