lp-diagrams-2.1.1: An EDSL for diagrams based based on linear constraints

Safe HaskellNone
LanguageHaskell2010

Graphics.Diagrams.Plot

Synopsis

Documentation

axisGen :: Monad m => Point -> Point -> Anchor -> [(Constant, lab)] -> Diagram lab m [Box] Source #

Generic axis rendering. axisGen origin target anchor labels traces an axis from origin to target, attaching the labels at anchor.

scale :: forall b. Field b => b -> b -> Iso b b Source #

scale minx maxx maps the interval [minx,maxx] to [0,1]

mkSteps :: Transform a -> ShowFct lab a -> [a] -> [(Constant, lab)] Source #

Make a number of steps

hAxis :: Monad m => Box -> [(Constant, lab)] -> Diagram lab m [Box] Source #

render an horizontal axis on the given box

vAxis :: Monad m => Box -> [(Constant, lab)] -> Diagram lab m [Box] Source #

render a vertical axis on the given box

axes :: Monad m => Box -> Vec2 [(Constant, lab)] -> Diagram lab m [Box] Source #

Draw axes. Coordinates in the [0,1] fit the box.

lint :: Constant -> Expr -> Expr -> Expr Source #

Multiply the vector (origin --> target) by p. (Linear interpolation)

scatterPlot :: Monad m => PlotCanvas a -> [Vec2 a] -> Diagram lab m () Source #

Draw a scatterplot in the given box. Input data in the [0,1] interval fits the box.

functionPlot :: Monad m => Show a => PlotCanvas a -> Int -> (a -> a) -> Diagram lab m () Source #

functionPlot c n f. Plot the function f on the canvas c, using n steps (precision).

data Iso a b Source #

Constructors

Iso 

Fields

after :: Iso b c -> Iso a b -> Iso a c Source #

axisMarks :: a -> a -> Iso a Constant -> (a, [a], a) Source #

type ShowFct lab a = a -> lab Source #

mkAxes :: Vec2 (Transform a) -> Vec2 a -> Vec2 a -> (Vec2 [a], Vec2 (Transform a)) Source #

preparePlot :: Monad m => Vec2 (ShowFct lab a) -> Vec2 (Transform a) -> Vec2 a -> Vec2 a -> Diagram lab m (PlotCanvas a) Source #

simplePlot :: (Ord a, Monad m) => Vec2 (ShowFct lab a) -> Vec2 (Transform a) -> [Vec2 a] -> Diagram lab m (PlotCanvas a) Source #

Draw a 2D scatter plot, given an axis specification and a data set