-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heatmap Example just isn't building #48
Comments
I wanted to add on that writing the heatmap example like this also doesn't work import Plots
import Linear.V2
import Control.Lens
heatMapAxis :: Axis B V2 Double
heatMapAxis = r2Axis &~ do
display colourBar
axisExtend .= noExtend
let xs = [[1,2,3],[4,5,6]]
heatMap xs $ heatMapSize .= V2 10 10 instead it throws this error
|
You need to import a backend. Each backend exports a |
Thanks! This updated version of the example code builds {-# LANGUAGE FlexibleContexts #-}
module Main where
import Plots
import Linear.V2
import Control.Lens
import Control.Monad.IO.Class
import Diagrams.Backend.Rasterific.CmdLine
heatMapAxis :: Axis B V2 Double
heatMapAxis = r2Axis &~ do
display colourBar
axisExtend .= noExtend
let xs = [[1,2,3],[4,5,6]]
heatMap xs $ heatMapSize .= V2 10 10
main :: IO ()
main = r2AxisMain $ heatMapAxis when running the example GHC points out as follows: Is this the only way to force the output of the heatmap? Is there a way to SaveImage (like JuicyPixels) Thank you very much your answered fixed the original problem and addressed my original question :) |
as a poor man's work around I discovered you can do this: {-# LANGUAGE FlexibleContexts #-}
module Main where
import Plots
import Linear.V2
import Control.Lens
import Control.Monad.IO.Class
import Codec.Picture
import Diagrams.Backend.Rasterific.CmdLine
heatMapIndexedAxis :: Axis B V2 Double
heatMapIndexedAxis = r2Axis &~ do
display colourBar
axisExtend .= noExtend
let f (V2 x y) = fromIntegral x + fromIntegral y
heatMapIndexed (V2 3 3) f $ heatMapSize .= V2 10 10
main :: IO ()
main = r2AxisMain $ heatMapIndexedAxis Then run this in cmd: I'm sure a more standard solution will come up in time; thanks again for your help! |
Happy to help. Yes, rendering directly is possible. You can call |
I made a test to use the heatmap example in:
But it fails and is unbuildable with the following errors:
I took out heatMapAxis because it keeps complaining that it's constraint (Axis B V2 Double)
is unsolvable in terms of B and I don't understand how to remedy it not finding a backend.
There doesn't seem to be a lens for it, or any reference to the backend being used but
considering it's capitalized there has to be something?
Any advice is appreciated, Thanks
The text was updated successfully, but these errors were encountered: