summaryrefslogtreecommitdiff
path: root/lib/Graphics
diff options
context:
space:
mode:
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.