From aa8debb5ab389de7bc5b47c5ae5f038349b6efc1 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Tue, 11 May 2010 09:07:52 +0000 Subject: simplify modules --- lib/Graphics/Plot.hs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'lib/Graphics/Plot.hs') 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( matrixToPGM, imshow, - gnuplotX, gnuplotpdf + gnuplotX, gnuplotpdf, gnuplotWin ) where @@ -204,3 +204,19 @@ gnuplotpdf title command ds = gnuplot (prelude ++ command ++" "++ draw) >> postp _ <- system "gnuplot gnuplotcommand" _ <- system "rm gnuplotcommand" return () + +gnuplotWin :: String -> String -> [([[Double]], String)] -> IO () +gnuplotWin title command ds = gnuplot (prelude ++ command ++" "++ draw) where + (dats,defs) = unzip ds + draw = concat (intersperse ", " (map ("\"-\" "++) defs)) ++ "\n" ++ + concatMap pr dats + + pr = (++"e\n") . unlines . map (unwords . (map show)) + + prelude = "set title \""++title++"\";" + + gnuplot cmd = do + writeFile "gnuplotcommand" cmd + _ <- system "gnuplot -persist gnuplotcommand" + _ <- system "rm gnuplotcommand" + return () -- cgit v1.2.3