summaryrefslogtreecommitdiff
path: root/lib/Graphics
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Graphics')
-rw-r--r--lib/Graphics/Plot.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Graphics/Plot.hs b/lib/Graphics/Plot.hs
index 32106df..74a2695 100644
--- a/lib/Graphics/Plot.hs
+++ b/lib/Graphics/Plot.hs
@@ -45,7 +45,7 @@ In certain versions you can interactively rotate the graphic using the mouse.
45mesh :: Matrix Double -> IO () 45mesh :: Matrix Double -> IO ()
46mesh m = gnuplotX (command++dat) where 46mesh m = gnuplotX (command++dat) where
47 command = "splot "++datafollows++" matrix with lines\n" 47 command = "splot "++datafollows++" matrix with lines\n"
48 dat = prep $ toLists $ m 48 dat = prep $ toLists m
49 49
50{- | Draws the surface represented by the function f in the desired ranges and number of points, internally using 'mesh'. 50{- | Draws the surface represented by the function f in the desired ranges and number of points, internally using 'mesh'.
51 51
@@ -104,7 +104,7 @@ matrixToPGM m = header ++ unlines (map unwords ll) where
104 maxgray = 255.0 104 maxgray = 255.0
105 maxval = maxElement m 105 maxval = maxElement m
106 minval = minElement m 106 minval = minElement m
107 scale' = if (maxval == minval) 107 scale' = if maxval == minval
108 then 0.0 108 then 0.0
109 else maxgray / (maxval - minval) 109 else maxgray / (maxval - minval)
110 f x = show ( round ( scale' *(x - minval) ) :: Int ) 110 f x = show ( round ( scale' *(x - minval) ) :: Int )
@@ -124,7 +124,7 @@ gnuplotX command = do { _ <- system cmdstr; return()} where
124 124
125datafollows = "\\\"-\\\"" 125datafollows = "\\\"-\\\""
126 126
127prep = (++"e\n\n") . unlines . map (unwords . (map show)) 127prep = (++"e\n\n") . unlines . map (unwords . map show)
128 128
129 129
130gnuplotpdf :: String -> String -> [([[Double]], String)] -> IO () 130gnuplotpdf :: String -> String -> [([[Double]], String)] -> IO ()
@@ -158,7 +158,7 @@ gnuplotpdf title command ds = gnuplot (prelude ++ command ++" "++ draw) >> postp
158 158
159 "\\end{document}" 159 "\\end{document}"
160 160
161 pr = (++"e\n") . unlines . map (unwords . (map show)) 161 pr = (++"e\n") . unlines . map (unwords . map show)
162 162
163 gnuplot cmd = do 163 gnuplot cmd = do
164 writeFile "gnuplotcommand" cmd 164 writeFile "gnuplotcommand" cmd
@@ -172,7 +172,7 @@ gnuplotWin title command ds = gnuplot (prelude ++ command ++" "++ draw) where
172 draw = concat (intersperse ", " (map ("\"-\" "++) defs)) ++ "\n" ++ 172 draw = concat (intersperse ", " (map ("\"-\" "++) defs)) ++ "\n" ++
173 concatMap pr dats 173 concatMap pr dats
174 174
175 pr = (++"e\n") . unlines . map (unwords . (map show)) 175 pr = (++"e\n") . unlines . map (unwords . map show)
176 176
177 prelude = "set title \""++title++"\";" 177 prelude = "set title \""++title++"\";"
178 178