-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A lightweight plotting library, exporting to SVG
--   
--   This library provides drawing and plotting datastructures and
--   functions; it is aimed in particular at scientific visualization, but
--   it also exposes its plotting primitives and a general purpose 2D
--   geometry library.
@package plot-light
@version 0.2.9

module Data.TimeSeries

-- | An instant, defined by date (Day) and TimeOfDay
data Tick
Tick :: Day -> TimeOfDay -> Tick

-- | Create a Tick from valid (year, month, day, hour, minute, second)
mkTick :: Integer -> Int -> Int -> Int -> Int -> Pico -> Maybe Tick

-- | A point in a time series
data TsPoint a
Tsp :: Tick -> a -> TsPoint a
[_tick] :: TsPoint a -> Tick
[_val] :: TsPoint a -> a
tickToFractional :: Fractional b => TsPoint a -> b

-- | Map a Tick onto the rationals
fromTick :: Tick -> Rational

-- | Map a rational onto a Tick
toTick :: Rational -> Tick
hourTick :: Double
halfHourTick :: Double
quarterHourTick :: Double
instance GHC.Show.Show a => GHC.Show.Show (Data.TimeSeries.TsPoint a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.TimeSeries.TsPoint a)
instance GHC.Classes.Ord Data.TimeSeries.Tick
instance GHC.Show.Show Data.TimeSeries.Tick
instance GHC.Classes.Eq Data.TimeSeries.Tick

module Graphics.Rendering.Plot.Light.PlotTypes


-- | <tt>plot-light</tt> provides functionality for rendering vector
--   graphics in SVG format. It is geared in particular towards scientific
--   plotting, and it is termed "light" because it only requires a few
--   common Haskell dependencies and no external libraries.
--   
--   <h2>Usage</h2>
--   
--   To incorporate this library in your projects you just need <tt>import
--   Graphics.Rendering.Plot.Light</tt>. If GHC complains of name
--   collisions you must import the module in "qualified" form.
--   
--   <h2>Examples</h2>
--   
--   If you wish to try out the examples in this page, you will need to
--   have these import statements as well :
--   
--   <pre>
--   import Text.Blaze.Svg.Renderer.String (renderSvg) 
--   import qualified Data.Colour.Names as C
--   import qualified Data.Text.IO as T (readFile, writeFile)
--   import qualified Data.Text as T
--   </pre>
--   
--   <h3>1. Heatmap plot of a 2D function</h3>
--   
--   
--   This example renders the function
--   
--   &lt;math&gt; where &lt;math&gt; and &lt;math&gt;.
--   
--   <pre>
--   xPlot = 400
--   yPlot = 300
--   
--   fdat = FigureData xPlot yPlot 0.1 0.8 0.1 0.9 10
--   
--   palette0 = palette [C.red, C.white, C.blue] 15
--   
--   plotFun2ex1 = do
--    let 
--      p1 = Point (-2) (-2)
--      p2 = Point 2 2
--      frame = mkFrame p1 p2
--      nx = 50 
--      ny = 50
--      f x y = cos ( pi * theta ) * sin r 
--        where
--          r = x'**2 + y'**2
--          theta = atan2 y' x'
--          (x', y') = (fromRational x, fromRational y)
--      lps = plotFun2 f $ meshGrid frame nx ny
--      vmin = minimum $ _lplabel &lt;$&gt; lps
--      vmax = maximum $ _lplabel &lt;$&gt; lps   
--      pixels = heatmap' fdat palette0 frame nx ny lps
--      cbar = colourBar fdat palette0 10 vmin vmax 10 TopRight 100
--      svg_t = svgHeader xPlot yPlot $ do
--         axes fdat frame 2 C.black 10 10
--         pixels
--         cbar
--    T.writeFile "heatmap.svg" $ T.pack $ renderSvg svg_t
--   </pre>
--   
--   This example demonstrates how to plot a 2D scalar function and write
--   the output to SVG file.
--   
--   First, we define a <a>FigureData</a> object (which holds the SVG
--   figure dimensions and parameters for the white margin around the
--   rendering canvas) and a <a>palette</a>.
--   
--   Afterwards we declare a <a>Frame</a> that bounds the rendering canvas
--   using <a>mkFrame</a>. This is discretized in <tt>nx</tt> by
--   <tt>ny</tt> pixels with <a>meshGrid</a>, and the function <tt>f</tt>
--   is computed at the <i>intersections</i> of the mesh with
--   <a>plotFun2</a>.
--   
--   The <a>axes</a> function adds labeled axes to the figure; the user
--   just needs to specify stroke width and color and how many ticks to
--   display.
--   
--   The data to be plotted (represented in this case as a list of
--   <a>LabeledPoint</a>s, in which the "label" carries the function value)
--   are then mapped onto the given colour palette and drawn to the SVG
--   canvas as a <a>heatmap'</a>, i.e. a mesh of filled rectangles
--   (Caution: do not exceed resolutions of ~ hundred pixels per side).
--   
--   Next, we create the legend; in this case this is a <a>colourBar</a>
--   element that requires the data bounds <tt>vmin</tt>, <tt>vmax</tt>.
--   
--   As a last step, the SVG content is wrapped in the appropriate markdown
--   by <a>svgHeader</a> and written to file.
--   
--   <h3>2. Scatter plot of 3D data</h3>
--   
--   
--   This example shows how to plot a collection of labelled points in the
--   plane. Each sample row is represented by a <a>LabeledPoint</a>, in
--   which the label is a scalar quantity.
--   
--   The <a>scatterLP</a> function renders each data row as a glyph, by
--   modifying a <a>ScatterPointData</a> record of default values via three
--   functions that control the glyph size, contour line thickness and
--   colour. This functionality can be exploited in creative ways to
--   achieve effective infographics.
--   
--   <pre>
--   xPlot = 400
--   yPlot = 300
--   fnameOut = "data/scatter-1.svg"
--   
--   fdat = FigureData xPlot yPlot 0.1 0.8 0.1 0.9 10
--   
--   dats = zipWith LabeledPoint p_ l_ where
--     l_ = [-5, -4 .. ]
--     p_ = zipWith Point [4,7,12,23,90,34,24,5,6,12,3] [43,23,1,23,8,11,17,25,4,5]
--   
--   spdata = ScatterPointData Circle 3 3 C.red
--   
--   
--   main = do
--    let
--      frameTo = frameFromFigData fdat
--      frameFrom = frameFromPoints $ _lp &lt;$&gt; dats
--      vmin = minimum $ _lplabel &lt;$&gt; dats
--      vmax = maximum $ _lplabel &lt;$&gt; dats     
--      f l sz = 10/(1 + exp(-(0.3 * x)))
--        where x = l + sz
--      g _ w = w
--      h l col = C.blend l' C.blue col
--        where
--          l' = (l - vmin)/(vmax - vmin)
--      dats' = moveLabeledPointBwFrames frameFrom frameTo False True &lt;$&gt; dats
--      svg_t = svgHeader xPlot yPlot $ do
--        axes fdat frameFrom 2 C.black 10 10
--        scatterLP f g h spdata dats'
--        scatterLPBar fdat 50 vmin vmax 3 TopRight 100 f g h spdata
--     T.writeFile fnameOut $ T.pack $ renderSvg svg_t
--   </pre>
module Graphics.Rendering.Plot.Light

-- | <a>heatmap</a> assumes the input data corresponds to evenly sampled
--   values of a scalar-valued field, and it maps the data values onto the
--   provided <a>palette</a> (which can be created e.g. with
--   <a>brewerSet</a>).
heatmap :: FigureData Rational -> [Colour Double] -> [[Scientific]] -> Svg

-- | <a>heatmap'</a> renders one SVG pixel for every <a>LabeledPoint</a>
--   supplied as input. The <a>LabeledPoint</a>s must be bounded by the
--   <a>Frame</a>.
heatmap' :: (Foldable f, Functor f, Show a, RealFrac a, RealFrac t) => FigureData a -> [Colour Double] -> Frame a -> a -> a -> f (LabeledPoint t a) -> Svg

-- | Plot a scalar function <tt>f</tt> of points in the plane (i.e.
--   &lt;math&gt;)
plotFun2 :: Functor f => (t -> t -> l) -> f (Point t) -> f (LabeledPoint l t)

-- | A colour bar legend, to be used within <tt>heatmap</tt>-style plots.
colourBar :: (RealFrac t, RealFrac a, Show a, Enum t, Floating a) => FigureData (Ratio Integer) -> [Colour Double] -> a -> t -> t -> Int -> LegendPosition_ -> a -> Svg

-- | Scatter plot
--   
--   Every point in the plot has the same parameters, as declared in the
--   <a>ScatterPointData</a> record
scatter :: (Foldable t, Show a, RealFrac a) => ScatterPointData a -> t (Point a) -> Svg

-- | Parametric scatter plot
--   
--   The parameters of every point in the scatter plot are modulated
--   according to the label, using the three functions.
--   
--   This can be used to produce rich infographics, in which e.g. the
--   colour and size of the glyphs carry additional information.
scatterLP :: (Foldable t, RealFrac a, Show a) => (l -> b -> a) -> (l -> b -> a) -> (l -> Colour Double -> Colour Double) -> ScatterPointData b -> t (LabeledPoint l a) -> Svg
scatterLPBar :: (RealFrac t, Enum t, RealFrac b, Show b) => FigureData b -> b -> t -> t -> Int -> LegendPosition_ -> b -> (t -> b -> b) -> (t -> b -> b) -> (t -> Colour Double -> Colour Double) -> ScatterPointData b -> Svg

-- | Parameters for a scatterplot glyph
data ScatterPointData a
ScatterPointData :: GlyphShape_ -> a -> a -> Colour Double -> ScatterPointData a
[spGlyphShape] :: ScatterPointData a -> GlyphShape_
[spSize] :: ScatterPointData a -> a
[spStrokeWidth] :: ScatterPointData a -> a
[spColour] :: ScatterPointData a -> Colour Double

-- | Glyph shape
data GlyphShape_
Square :: GlyphShape_
Circle :: GlyphShape_
Cross :: GlyphShape_
Plus :: GlyphShape_

-- | A rectangle, defined by its anchor point coordinates and side lengths
--   
--   <pre>
--   &gt; putStrLn $ renderSvg $ rect (Point 100 200) 30 60 2 Nothing (Just C.aquamarine)
--   &lt;rect x="100.0" y="200.0" width="30.0" height="60.0" fill="#7fffd4" stroke="none" stroke-width="2.0" /&gt;
--   </pre>
rect :: (Show a, RealFrac a) => a -> a -> a -> Maybe (Colour Double) -> Maybe (Colour Double) -> Point a -> Svg

-- | A rectangle, defined by its center coordinates and side lengths
--   
--   <pre>
--   &gt; putStrLn $ renderSvg $ rectCentered 15 30 1 (Just C.blue) (Just C.red) (Point 20 30)
--   &lt;rect x="12.5" y="15.0" width="15.0" height="30.0" fill="#ff0000" stroke="#0000ff" stroke-width="1.0" /&gt;
--   </pre>
rectCentered :: (Show a, RealFrac a) => a -> a -> a -> Maybe (Colour Double) -> Maybe (Colour Double) -> Point a -> Svg
squareCentered :: (Show a, RealFrac a) => a -> a -> Maybe (Colour Double) -> Maybe (Colour Double) -> Point a -> Svg

-- | A circle
--   
--   <pre>
--   &gt; putStrLn $ renderSvg $ circle (Point 20 30) 15 (Just C.blue) (Just C.red)
--   &lt;circle cx="20.0" cy="30.0" r="15.0" fill="#ff0000" stroke="#0000ff" /&gt;
--   </pre>
circle :: (Real a1, Real a) => a -> a -> Maybe (Colour Double) -> Maybe (Colour Double) -> Point a1 -> Svg

-- | Line segment between two <a>Point</a>s
--   
--   <pre>
--   &gt; putStrLn $ renderSvg $ line (Point 0 0) (Point 1 1) 0.1 Continuous C.blueviolet
--   &lt;line x1="0.0" y1="0.0" x2="1.0" y2="1.0" stroke="#8a2be2" stroke-width="0.1" /&gt;
--   </pre>
--   
--   <pre>
--   &gt; putStrLn $ renderSvg (line (Point 0 0) (Point 1 1) 0.1 (Dashed [0.2, 0.3]) C.blueviolet)
--   &lt;line x1="0.0" y1="0.0" x2="1.0" y2="1.0" stroke="#8a2be2" stroke-width="0.1" stroke-dasharray="0.2, 0.3" /&gt;
--   </pre>
line :: (Show a, RealFrac a) => Point a -> Point a -> a -> LineStroke_ a -> Colour Double -> Svg

-- | <a>text</a> renders text onto the SVG canvas
--   
--   <h3>Conventions</h3>
--   
--   The <a>Point</a> argument <tt>p</tt> refers to the <i>lower-left</i>
--   corner of the text box.
--   
--   The text box can be rotated by <tt>rot</tt> degrees around <tt>p</tt>
--   and then anchored at either its beginning, middle or end to <tt>p</tt>
--   with the <a>TextAnchor_</a> flag.
--   
--   The user can supply an additional <a>V2</a> displacement which will be
--   applied <i>after</i> rotation and anchoring and refers to the rotated
--   text box frame.
--   
--   <pre>
--   &gt; putStrLn $ renderSvg $ text (-45) C.green TAEnd "blah" (V2 (- 10) 0) (Point 250 0)
--   &lt;text x="-10.0" y="0.0" transform="translate(250.0 0.0)rotate(-45.0)" fill="#008000" text-anchor="end"&gt;blah&lt;/text&gt;
--   </pre>
text :: (Show a, Real a) => a -> Int -> Colour Double -> TextAnchor_ -> Text -> V2 a -> Point a -> Svg

-- | Polyline (piecewise straight line)
--   
--   <pre>
--   &gt; putStrLn $ renderSvg (polyline [Point 100 50, Point 120 20, Point 230 50] 4 (Dashed [3, 5]) Round C.blueviolet)
--   &lt;polyline points="100.0,50.0 120.0,20.0 230.0,50.0" fill="none" stroke="#8a2be2" stroke-width="4.0" stroke-linejoin="round" stroke-dasharray="3.0, 5.0" /&gt;
--   </pre>
polyline :: (Foldable t, Show a1, Show a, RealFrac a, RealFrac a1) => a1 -> LineStroke_ a -> StrokeLineJoin_ -> Colour Double -> t (Point a) -> Svg

-- | A filled polyline
--   
--   <pre>
--   &gt; putStrLn $ renderSvg $ filledPolyline C.coral 0.3 [(Point 0 1), (Point 10 40), Point 34 50, Point 30 5]
--   &lt;polyline points="0,1 10,40 34,50 30,5" fill="#ff7f50" fill-opacity="0.3" /&gt;
--   </pre>
filledPolyline :: (Foldable t, Show a, Real o) => Colour Double -> o -> t (Point a) -> Svg
pixel :: (Show a, RealFrac a) => [Colour Double] -> a -> a -> Scientific -> Scientific -> LabeledPoint Scientific a -> Svg
pixel' :: (Show a, RealFrac a, RealFrac t) => [Colour Double] -> a -> a -> t -> t -> LabeledPoint t a -> Svg

-- | A filled band of colour, given the coordinates of its center line
--   
--   This element can be used to overlay uncertainty ranges (e.g. the first
--   standard deviation) associated with a given data series.
filledBand :: (Foldable t, Real o, Show a) => Colour Double -> o -> (l -> a) -> (l -> a) -> t (LabeledPoint l a) -> Svg

-- | A <a>candlestick</a> glyph for time series plots. This is a type of
--   box glyph, commonly used in plotting financial time series.
--   
--   Some financial market quantities such as currency exchange rates are
--   aggregated over some time period (e.g. a day) and summarized by
--   various quantities, for example opening and closing rates, as well as
--   maximum and minimum over the period.
--   
--   By convention, the <a>candlestick</a> colour depends on the derivative
--   sign of one such quantity (e.g. it is green if the market closes
--   higher than it opened, and red otherwise).
candlestick :: (Show a, RealFrac a) => (a -> a -> Bool) -> (l -> a) -> (l -> a) -> (l -> a) -> (l -> a) -> a -> a -> Colour Double -> Colour Double -> Colour Double -> LabeledPoint l a -> Svg

-- | A pair of Cartesian axes
axes :: (Show a, RealFrac a) => FigureData a -> Frame a -> a -> Colour Double -> Int -> Int -> Svg

-- | <a>toPlot</a> performs a number of related operations:
--   
--   <ul>
--   <li>Maps the dataset to the figure frame</li>
--   <li>Renders the X, Y axes</li>
--   <li>Renders the transformed dataset onto the newly created plot
--   canvas</li>
--   </ul>
toPlot :: (Functor t, Foldable t, Show a, RealFrac a) => FigureData a -> (l -> Text) -> (l -> Text) -> a -> a -> a -> Colour Double -> Maybe (t (LabeledPoint l a)) -> Maybe (t (LabeledPoint l a)) -> (t (LabeledPoint l a) -> Svg) -> t (LabeledPoint l a) -> Svg

-- | Figure data
data FigureData a
FigureData :: a -> a -> a -> a -> a -> a -> Int -> FigureData a

-- | Figure width
[figWidth] :: FigureData a -> a

-- | Figure height
[figHeight] :: FigureData a -> a

-- | Left margin fraction (w.r.t figure width)
[figLeftMFrac] :: FigureData a -> a

-- | Right margin fraction (w.r.t figure width)
[figRightMFrac] :: FigureData a -> a

-- | Top margin fraction (w.r.t figure height)
[figTopMFrac] :: FigureData a -> a

-- | Bottom margin fraction (w.r.t figure height)
[figBottomMFrac] :: FigureData a -> a

-- | Tick label font size
[figLabelFontSize] :: FigureData a -> Int

-- | Specify a continuous or dashed stroke
data LineStroke_ a
Continuous :: LineStroke_ a
Dashed :: [a] -> LineStroke_ a

-- | Specify the type of connection between line segments
data StrokeLineJoin_
Miter :: StrokeLineJoin_
Round :: StrokeLineJoin_
Bevel :: StrokeLineJoin_
Inherit :: StrokeLineJoin_

-- | Specify at which end should the text be anchored to its current point
data TextAnchor_
TAStart :: TextAnchor_
TAMiddle :: TextAnchor_
TAEnd :: TextAnchor_
data LegendPosition_
TopLeft :: LegendPosition_
TopRight :: LegendPosition_
BottomLeft :: LegendPosition_
BottomRight :: LegendPosition_

-- | `blendTwo c1 c2 n` creates a palette of <tt>n</tt> intermediate
--   colours, interpolated linearly between <tt>c1</tt> and <tt>c2</tt>.
blendTwo :: Colour Double -> Colour Double -> Int -> [Colour Double]

-- | `palette cs n` blends linearly a list of colours <tt>cs</tt>, by
--   generating <tt>n</tt> intermediate colours between each consecutive
--   pair.
palette :: [Colour Double] -> Int -> [Colour Double]
pickColour :: RealFrac t => [Colour Double] -> t -> t -> t -> Colour Double

-- | Create the SVG header
svgHeader :: Real a => a -> a -> Svg -> Svg

-- | Move a Svg entity to a new position
translateSvg :: Show a => Point a -> Svg -> Svg

-- | A frame, i.e. a bounding box for objects
data Frame a
Frame :: Point a -> Point a -> Frame a
[_fpmin] :: Frame a -> Point a
[_fpmax] :: Frame a -> Point a

-- | A <a>Point</a> object defines a point in the plane
data Point a
Point :: a -> a -> Point a
[_px] :: Point a -> a
[_py] :: Point a -> a

-- | A <a>LabeledPoint</a> carries a "label" (i.e. any additional
--   information such as a text tag, or any other data structure), in
--   addition to position information. Data points on a plot are
--   <a>LabeledPoint</a>s.
data LabeledPoint l a
LabeledPoint :: Point a -> l -> LabeledPoint l a

-- | The coordinates of the <a>LabeledPoint</a> (i.e. where in the figure
--   it will be rendered)
[_lp] :: LabeledPoint l a -> Point a

-- | Data associated with the <a>LabeledPoint</a>
[_lplabel] :: LabeledPoint l a -> l

-- | Given a labelling function and a <a>Point</a> <tt>p</tt>, returned a
--   <a>LabeledPoint</a> containing <tt>p</tt> and the computed label
labelPoint :: (Point a -> l) -> Point a -> LabeledPoint l a

-- | Apply a function to the label
mapLabel :: (l1 -> l2) -> LabeledPoint l1 a -> LabeledPoint l2 a
data Axis
X :: Axis
Y :: Axis

-- | V2 is a vector in R^2
data V2 a
V2 :: a -> a -> V2 a

-- | A Mat2 can be seen as a linear operator that acts on points in the
--   plane
data Mat2 a
Mat2 :: a -> a -> a -> a -> Mat2 a

-- | Diagonal matrices in R2 behave as scaling transformations
data DiagMat2 a
DMat2 :: a -> a -> DiagMat2 a

-- | Create a diagonal matrix
diagMat2 :: Num a => a -> a -> DiagMat2 a

-- | The origin of the axes, point (0, 0)
origin :: Num a => Point a

-- | X-aligned unit vector
e1 :: Num a => V2 a

-- | Y-aligned unit vector
e2 :: Num a => V2 a

-- | Euclidean (L^2) norm
norm2 :: (Hermitian v, Floating n, n ~ (InnerProduct v)) => v -> n

-- | Normalize a V2 w.r.t. its Euclidean norm
normalize2 :: (InnerProduct v ~ Scalar v, Floating (Scalar v), Hermitian v) => v -> v

-- | Create a V2 <tt>v</tt> from two endpoints p1, p2. That is <tt>v</tt>
--   can be seen as pointing from <tt>p1</tt> to <tt>p2</tt>
v2fromEndpoints :: Num a => Point a -> Point a -> V2 a

-- | Build a <a>V2</a> v from a <a>Point</a> p (i.e. assuming v points from
--   the origin (0,0) to p)
v2fromPoint :: Num a => Point a -> V2 a

-- | Move a point along a vector
movePoint :: Num a => V2 a -> Point a -> Point a

-- | Move a <a>LabeledPoint</a> along a vector
moveLabeledPointV2 :: Num a => V2 a -> LabeledPoint l a -> LabeledPoint l a
moveLabeledPointBwFrames :: Fractional a => Frame a -> Frame a -> Bool -> Bool -> LabeledPoint l a -> LabeledPoint l a

-- | Create a V2 <tt>v</tt> from two endpoints p1, p2. That is <tt>v</tt>
--   can be seen as pointing from <tt>p1</tt> to <tt>p2</tt>
(-.) :: Num a => Point a -> Point a -> V2 a

-- | Move point to the SVG frame of reference (for which the origing is a
--   the top-left corner of the screen)
toSvgFrame :: Fractional a => Frame a -> Frame a -> Bool -> Point a -> Point a

-- | Move LabeledPoint to the SVG frame of reference (uses
--   <a>toSvgFrame</a> )
toSvgFrameLP :: Fractional a => Frame a -> Frame a -> Bool -> LabeledPoint l a -> LabeledPoint l a

-- | `pointRange n p q` returns a list of equi-spaced <a>Point</a>s between
--   <tt>p</tt> and <tt>q</tt>.
pointRange :: (Fractional a, Integral n) => n -> Point a -> Point a -> [Point a]

-- | Given two frames <tt>F1</tt> and <tt>F2</tt>, returns a function
--   <tt>f</tt> that maps an arbitrary vector <tt>v</tt> contained within
--   <tt>F1</tt> onto one contained within <tt>F2</tt>.
--   
--   This function is composed of three affine maps :
--   
--   <ol>
--   <li>map <tt>v</tt> into a vector <tt>v01</tt> that points within the
--   unit square,</li>
--   <li>map <tt>v01</tt> onto <tt>v01'</tt>. This transformation serves to
--   e.g. flip the dataset along the y axis (since the origin of the SVG
--   canvas is the top-left corner of the screen). If this is not needed
--   one can just supply the identity matrix and the zero vector,</li>
--   <li>map <tt>v01'</tt> onto the target frame <tt>F2</tt>.</li>
--   </ol>
--   
--   NB: we do not check that <tt>v</tt> is actually contained within the
--   <tt>F1</tt>, nor that <tt>v01'</tt> is still contained within [0,1] x
--   [0, 1]. This has to be supplied correctly by the user.
frameToFrame :: Fractional a => Frame a -> Frame a -> Bool -> Bool -> V2 a -> V2 a

-- | Create a <a>Frame</a> from a container of <a>Point</a>s <tt>P</tt>,
--   i.e. construct two points <tt>p1</tt> and <tt>p2</tt> such that :
--   
--   p1 := inf(x,y) P
--   
--   p2 := sup(x,y) P
frameFromPoints :: (Ord a, Foldable t, Functor t) => t (Point a) -> Frame a
frameFromFigData :: Num a => FigureData a -> Frame a
mkFrame :: Point a -> Point a -> Frame a

-- | Build a frame rooted at the origin (0, 0)
mkFrameOrigin :: Num a => a -> a -> Frame a

-- | The <a>width</a> is the extent in the <tt>x</tt> direction and
--   <a>height</a> is the extent in the <tt>y</tt> direction
width :: Num a => Frame a -> a

-- | The <a>width</a> is the extent in the <tt>x</tt> direction and
--   <a>height</a> is the extent in the <tt>y</tt> direction
height :: Num a => Frame a -> a
figFWidth :: Num a => FigureData a -> a
figFHeight :: Num a => FigureData a -> a

-- | Additive group :
--   
--   <pre>
--   v ^+^ zero == zero ^+^ v == v
--   </pre>
--   
--   <pre>
--   v ^-^ v == zero
--   </pre>
class AdditiveGroup v

-- | Identity element
zero :: AdditiveGroup v => v

-- | Group action ("sum")
(^+^) :: AdditiveGroup v => v -> v -> v

-- | Inverse group action ("subtraction")
(^-^) :: AdditiveGroup v => v -> v -> v

-- | Vector space : multiplication by a scalar quantity
class AdditiveGroup v => VectorSpace v where {
    type family Scalar v :: *;
}

-- | Scalar multiplication
(.*) :: VectorSpace v => Scalar v -> v -> v

-- | Hermitian space : inner product
class VectorSpace v => Hermitian v where {
    type family InnerProduct v :: *;
}

-- | Inner product
(<.>) :: Hermitian v => v -> v -> InnerProduct v

-- | Linear maps, i.e. linear transformations of vectors
class Hermitian v => LinearMap m v

-- | Matrix action, i.e. linear transformation of a vector
(#>) :: LinearMap m v => m -> v -> v

-- | Multiplicative matrix semigroup ("multiplying" two matrices together)
class MultiplicativeSemigroup m

-- | Matrix product
(##) :: MultiplicativeSemigroup m => m -> m -> m

-- | The class of invertible linear transformations
class LinearMap m v => MatrixGroup m v

-- | Inverse matrix action on a vector
(<\>) :: MatrixGroup m v => m -> v -> v

-- | Numerical equality
class Eps a

-- | Comparison within numerical precision
(~=) :: Eps a => a -> a -> Bool

-- | A list of <tt>nx</tt> by <tt>ny</tt> points in the plane arranged on
--   the vertices of a rectangular mesh.
--   
--   NB: Only the minimum x, y coordinate point is included in the output
--   mesh. This is intentional, since the output from this can be used as
--   an input to functions that use a corner rather than the center point
--   as refernce (e.g. <tt>rect</tt>)
meshGrid :: (Enum a, RealFrac a) => Frame a -> Int -> Int -> [Point a]
toFloat :: Scientific -> Float

-- | Separate whole and decimal part of a fractional number e.g.
--   
--   <pre>
--   &gt; wholeDecimal 
--   </pre>
wholeDecimal :: (Integral a, RealFrac b) => b -> (a, b)
