diff options
Diffstat (limited to 'lib/Graphics')
-rw-r--r-- | lib/Graphics/Plot.hs | 6 |
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 | ||
31 | import Data.Packed | 31 | import Data.Packed |
32 | import Numeric.LinearAlgebra(outer) | 32 | import Numeric.LinearAlgebra(outer) |
33 | import Numeric.LinearAlgebra.Linear(Vectors(..)) | 33 | import Numeric.LinearAlgebra.Linear |
34 | import Data.List(intersperse) | 34 | import Data.List(intersperse) |
35 | import System.Process (system) | 35 | import 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. |