summaryrefslogtreecommitdiff
path: root/lib/Graphics
diff options
context:
space:
mode:
authorVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-07-12 22:23:14 +0000
committerVivian McPhail <haskell.vivian.mcphail@gmail.com>2010-07-12 22:23:14 +0000
commit7659d9c67f75e1f665d6b02663ee8767e97762b4 (patch)
treecddaaf3156cadef9aaf564abf9d033b72f6e2e67 /lib/Graphics
parent007960d648485d5c161cd366d16282bc29fac68b (diff)
refactored Data.Packed.Vector to remove any numerics
Diffstat (limited to 'lib/Graphics')
-rw-r--r--lib/Graphics/Plot.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Graphics/Plot.hs b/lib/Graphics/Plot.hs
index 02b0c4c..b2acc15 100644
--- a/lib/Graphics/Plot.hs
+++ b/lib/Graphics/Plot.hs
@@ -30,7 +30,7 @@ module Graphics.Plot(
30 30
31import Data.Packed 31import Data.Packed
32import Numeric.LinearAlgebra(outer) 32import Numeric.LinearAlgebra(outer)
33import Numeric.LinearAlgebra.Linear(Vectors(..)) 33import Numeric.LinearAlgebra.Linear
34import Data.List(intersperse) 34import Data.List(intersperse)
35import System.Process (system) 35import System.Process (system)
36 36
@@ -153,10 +153,10 @@ matrixToPGM m = header ++ unlines (map unwords ll) where
153 maxgray = 255.0 153 maxgray = 255.0
154 maxval = vectorMax $ flatten $ m 154 maxval = vectorMax $ flatten $ m
155 minval = vectorMin $ flatten $ m 155 minval = vectorMin $ flatten $ m
156 scale = if (maxval == minval) 156 scale' = if (maxval == minval)
157 then 0.0 157 then 0.0
158 else maxgray / (maxval - minval) 158 else maxgray / (maxval - minval)
159 f x = show ( round ( scale *(x - minval) ) :: Int ) 159 f x = show ( round ( scale' *(x - minval) ) :: Int )
160 ll = map (map f) (toLists m) 160 ll = map (map f) (toLists m)
161 161
162-- | imshow shows a representation of a matrix as a gray level image using ImageMagick's display. 162-- | imshow shows a representation of a matrix as a gray level image using ImageMagick's display.