packages feed

matplotlib 0.4.3 → 0.4.4

raw patch · 4 files changed

+17/−8 lines, 4 filesdep +filepathPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: filepath

API changes (from Hackage documentation)

- Graphics.Matplotlib: onscreen :: Matplotlib -> IO (Either String String)
+ Graphics.Matplotlib: onscreen :: Matplotlib -> IO ()

Files

README.md view
@@ -13,9 +13,15 @@  ```haskell {-# LANGUAGE ExtendedDefaultRules #-}-import Matplotlib -onscreen $ contourF (\a b -> sin (degreesRadians a) + cos (degreesRadians b)) (-100) 100 (-200) 200 10+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.
matplotlib.cabal view
@@ -1,5 +1,5 @@ name:                matplotlib-version:             0.4.3+version:             0.4.4 synopsis:            Bindings to Matplotlib; a Python plotting library description:     Matplotlib is probably the most full featured plotting library out there.@@ -30,6 +30,8 @@                      , aeson                      , temporary                      , containers+                     , split+                     , filepath   default-language:    Haskell2010  test-suite matplotlib-test
src/Graphics/Matplotlib.hs view
@@ -70,16 +70,17 @@ import Data.List import Data.Aeson import Graphics.Matplotlib.Internal+import Control.Concurrent(forkIO)  -- * Running a plot  -- | Show a plot, blocks until the figure is closed-onscreen :: Matplotlib -> IO (Either String String)-onscreen m = withMplot m (\s -> python $ pyIncludes "" ++ s ++ pyDetach ++ pyOnscreen)+onscreen :: Matplotlib -> IO ()+onscreen m = (forkIO $ (withMplot m (\s -> python $ pyIncludes "" ++ s ++ pyOnscreen) >> return ())) >> return ()  -- | Print the python code that would be executed code :: Matplotlib -> IO String-code m = withMplot m (\s -> return $ unlines $ pyIncludes (pyBackend "agg") ++ s ++ pyDetach ++ pyOnscreen)+code m = withMplot m (\s -> return $ unlines $ pyIncludes (pyBackend "agg") ++ s ++ pyOnscreen)  -- | Save to a file file :: [Char] -> Matplotlib -> IO (Either String String)
src/Graphics/Matplotlib/Internal.hs view
@@ -64,7 +64,7 @@  -- | The io action is given a list of python commands to execute (note that -- these are commands in the sense of lines of python code; each inidivudal line--- may not be parseable on its own+-- may not be parseable on its own) withMplot :: Matplotlib -> ([String] -> IO a) -> IO a withMplot m f = preload cs []   where@@ -303,7 +303,7 @@          (\codeFile codeHandle -> do              forM_ codeStr (hPutStrLn codeHandle)              hClose codeHandle-             Right <$> readProcess "/usr/bin/env" ["python3", codeFile] ""))+             Right <$> readProcess "env" ["python3", codeFile] ""))          (\e -> return $ Left $ show (e :: IOException))  pyBackend backend = "matplotlib.use('" ++ backend ++ "')"