module Graphics.Rendering.Plot.Figure.Simple (
plot
, loglog, semilog, linlog, loglin
, parametric
, title
, subtitle
, Simple()
, grid
, xrange, yrange
, xautorange, yautorange
, xautorangeLog, yautorangeLog
, xlabel, ylabel
) where
import Numeric.LinearAlgebra.Data
import Graphics.Rendering.Plot.Figure
plot :: Dataset d => d -> Figure ()
plot ds = do
setPlots 1 1
withPlot (1,1) $ do
setDataset ds
addAxis XAxis (Side Lower) $ return ()
addAxis YAxis (Side Lower) $ return ()
setRangeFromData XAxis Lower Linear
setRangeFromData YAxis Lower Linear
semilog :: Dataset d => d -> Figure ()
semilog = linlog
linlog :: Dataset d => d -> Figure ()
linlog ds = do
setPlots 1 1
withPlot (1,1) $ do
setDataset ds
addAxis XAxis (Side Lower) $ return ()
addAxis YAxis (Side Lower) $ return ()
setRangeFromData XAxis Lower Linear
setRangeFromData YAxis Lower Log
loglin :: Dataset d => d -> Figure ()
loglin ds = do
setPlots 1 1
withPlot (1,1) $ do
setDataset ds
addAxis XAxis (Side Lower) $ return ()
addAxis YAxis (Side Lower) $ return ()
setRangeFromData XAxis Lower Log
setRangeFromData YAxis Lower Linear
loglog :: Dataset d => d -> Figure ()
loglog ds = do
setPlots 1 1
withPlot (1,1) $ do
setDataset ds
addAxis XAxis (Side Lower) $ return ()
addAxis YAxis (Side Lower) $ return ()
setRangeFromData XAxis Lower Log
setRangeFromData YAxis Lower Log
parametric :: (Double -> Double,Double -> Double) -> (Double,Double) -> Int -> Figure ()
parametric (fx,fy) (l,h) n = do
setPlots 1 1
withPlot (1,1) $ do
let t = linspace n (l,h)
setDataset (Line,cmap fx t,[cmap fy t])
addAxis XAxis (Side Lower) $ return ()
addAxis YAxis (Side Lower) $ return ()
setRangeFromData XAxis Lower Linear
setRangeFromData YAxis Lower Linear
title :: String -> Figure ()
title s = withTitle $ setText s
subtitle :: String -> Figure ()
subtitle s = withSubTitle $ setText s
class Simple m where
simple :: Plot () -> m ()
instance Simple Plot where
simple m = m
instance Simple Figure where
simple m = withPlot (1,1) m
grid :: Simple m => Bool -> m ()
grid b = simple $ do
withAxis XAxis (Side Lower) $ setGridlines Major b
withAxis YAxis (Side Lower) $ setGridlines Major b
xrange :: Simple m => Scale -> Double -> Double -> m ()
xrange s l h = simple $ setRange XAxis Lower s l h
yrange :: Simple m => Scale -> Double -> Double -> m ()
yrange s l h = simple $ setRange YAxis Lower s l h
xautorange :: Simple m => m ()
xautorange = simple $ setRangeFromData XAxis Lower Linear
yautorange :: Simple m => m ()
yautorange = simple $ setRangeFromData YAxis Lower Linear
xautorangeLog :: Simple m => m ()
xautorangeLog = simple $ setRangeFromData XAxis Lower Log
yautorangeLog :: Simple m => m ()
yautorangeLog = simple $ setRangeFromData YAxis Lower Log
xlabel :: Simple m => String -> m ()
xlabel s = simple $ withAxis XAxis (Side Lower) $ withAxisLabel $ setText s
ylabel :: Simple m => String -> m ()
ylabel s = simple $ withAxis YAxis (Side Lower) $ withAxisLabel $ setText s