profun/app/Plot.hs

15 lines
587 B
Haskell

module Plot where
import Graphics.Rendering.Chart.Easy
import Graphics.Rendering.Chart.Backend.Diagrams
formatData :: Double -> Double -> Double -> [(Int, Double)]
formatData yday tday tmrw = [(0, yday), (1, tday), (2, tmrw)]
generatePlot :: Double -> Double -> Double -> IO ()
generatePlot yday tday tmrw = toFile def "plot/weather.svg" $ do
layout_title .= "Yesterday, Today, and Tomorrow's Temperatures"
layout_margin .= 30
layout_x_axis . laxis_generate .= autoIndexAxis ["Yesterday", "Today", "Tomorrow"]
plot $ line "Degrees Celsius" [formatData yday tday tmrw]