summaryrefslogtreecommitdiff
path: root/lib/Graphics
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2010-05-11 09:07:52 +0000
committerAlberto Ruiz <aruiz@um.es>2010-05-11 09:07:52 +0000
commitaa8debb5ab389de7bc5b47c5ae5f038349b6efc1 (patch)
treeceb1ae6932ef0769616089fd05a7ba099b9a5b30 /lib/Graphics
parent0c1b8611b9cc55cc646c708b63442f3aaac1249d (diff)
simplify modules
Diffstat (limited to 'lib/Graphics')
-rw-r--r--lib/Graphics/Plot.hs18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Graphics/Plot.hs b/lib/Graphics/Plot.hs
index 3f66d98..b4e8a11 100644
--- a/lib/Graphics/Plot.hs
+++ b/lib/Graphics/Plot.hs
@@ -24,7 +24,7 @@ module Graphics.Plot(
24 24
25 matrixToPGM, imshow, 25 matrixToPGM, imshow,
26 26
27 gnuplotX, gnuplotpdf 27 gnuplotX, gnuplotpdf, gnuplotWin
28 28
29) where 29) where
30 30
@@ -204,3 +204,19 @@ gnuplotpdf title command ds = gnuplot (prelude ++ command ++" "++ draw) >> postp
204 _ <- system "gnuplot gnuplotcommand" 204 _ <- system "gnuplot gnuplotcommand"
205 _ <- system "rm gnuplotcommand" 205 _ <- system "rm gnuplotcommand"
206 return () 206 return ()
207
208gnuplotWin :: String -> String -> [([[Double]], String)] -> IO ()
209gnuplotWin title command ds = gnuplot (prelude ++ command ++" "++ draw) where
210 (dats,defs) = unzip ds
211 draw = concat (intersperse ", " (map ("\"-\" "++) defs)) ++ "\n" ++
212 concatMap pr dats
213
214 pr = (++"e\n") . unlines . map (unwords . (map show))
215
216 prelude = "set title \""++title++"\";"
217
218 gnuplot cmd = do
219 writeFile "gnuplotcommand" cmd
220 _ <- system "gnuplot -persist gnuplotcommand"
221 _ <- system "rm gnuplotcommand"
222 return ()