diff options
Diffstat (limited to 'lib/Graphics/Plot.hs')
-rw-r--r-- | lib/Graphics/Plot.hs | 18 |
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 | |||
208 | gnuplotWin :: String -> String -> [([[Double]], String)] -> IO () | ||
209 | gnuplotWin 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 () | ||