summaryrefslogtreecommitdiff
path: root/lib/Graphics/Plot.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2008-11-15 11:50:24 +0000
committerAlberto Ruiz <aruiz@um.es>2008-11-15 11:50:24 +0000
commit1e9b6bb90273cdf192bdcf0ccf73af59241c1d95 (patch)
treef7c1656c2c3b883e8126519610a5428e7e9b7382 /lib/Graphics/Plot.hs
parentf0a2248b9d9532e0814519408bff8b886bca2bbc (diff)
zipVector
Diffstat (limited to 'lib/Graphics/Plot.hs')
-rw-r--r--lib/Graphics/Plot.hs12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/Graphics/Plot.hs b/lib/Graphics/Plot.hs
index bcb1fb3..9b64a1d 100644
--- a/lib/Graphics/Plot.hs
+++ b/lib/Graphics/Plot.hs
@@ -1,7 +1,7 @@
1----------------------------------------------------------------------------- 1-----------------------------------------------------------------------------
2-- | 2-- |
3-- Module : Graphics.Plot 3-- Module : Graphics.Plot
4-- Copyright : (c) Alberto Ruiz 2005 4-- Copyright : (c) Alberto Ruiz 2005-8
5-- License : GPL-style 5-- License : GPL-style
6-- 6--
7-- Maintainer : Alberto Ruiz (aruiz at um dot es) 7-- Maintainer : Alberto Ruiz (aruiz at um dot es)
@@ -28,14 +28,10 @@ module Graphics.Plot(
28 28
29) where 29) where
30 30
31import Data.Packed.Vector 31import Data.Packed
32import Data.Packed.Matrix
33import Numeric.LinearAlgebra(outer) 32import Numeric.LinearAlgebra(outer)
34import Numeric.GSL.Vector(FunCodeS(Max,Min),toScalarR)
35import Data.List(intersperse) 33import Data.List(intersperse)
36import System 34import System
37import Foreign hiding (rotate)
38
39 35
40size = dim 36size = dim
41 37
@@ -154,8 +150,8 @@ matrixToPGM m = header ++ unlines (map unwords ll) where
154 r = rows m 150 r = rows m
155 header = "P2 "++show c++" "++show r++" "++show (round maxgray :: Int)++"\n" 151 header = "P2 "++show c++" "++show r++" "++show (round maxgray :: Int)++"\n"
156 maxgray = 255.0 152 maxgray = 255.0
157 maxval = toScalarR Max $ flatten $ m 153 maxval = vectorMax $ flatten $ m
158 minval = toScalarR Min $ flatten $ m 154 minval = vectorMin $ flatten $ m
159 scale = if (maxval == minval) 155 scale = if (maxval == minval)
160 then 0.0 156 then 0.0
161 else maxgray / (maxval - minval) 157 else maxgray / (maxval - minval)