-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A lightweight plotting library, exporting to SVG -- -- A lightweight plotting library, exporting to SVG @package plot-light @version 0.1.0.4 -- | `plot-light` 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 few native Haskell -- dependencies. -- -- It builds upon `blaze-svg` by adding type-safe combinators, geometry -- primitives and related functions. -- --
-- import Graphics.Rendering.Plot.Light as P ---- -- If you wish to try out the examples in this page, you will need to -- have renderSvg in scope as well: -- --
-- import Text.Blaze.Svg.Renderer.String (renderSvg) --module Graphics.Rendering.Plot.Light -- | A filled rectangle, centered at (x0, y0) rectCentered :: Point Double -> Double -> Double -> Colour Double -> Svg -- | Line segment between two Points -- --
-- > putStrLn $ renderSvg (line 0 0 1 1 0.1 C.blueviolet) -- <line x1="0.0" y1="0.0" x2="1.0" y2="1.0" stroke="#8a2be2" stroke-width="0.1" /> --line :: Point Double -> Point Double -> Double -> Colour Double -> Svg -- | An axis with tickmarks -- --
-- > putStrLn $ renderSvg $ axis X 200 2 C.red 0.05 (Point 150 10) [Point 50 1, Point 60 1, Point 70 1] -- <line x1="50.0" y1="10.0" x2="250.0" y2="10.0" stroke="#ff0000" stroke-width="2.0" /><line x1="50.0" y1="5.0" x2="50.0" y2="15.0" stroke="#ff0000" stroke-width="2.0" /><line x1="60.0" y1="5.0" x2="60.0" y2="15.0" stroke="#ff0000" stroke-width="2.0" /><line x1="70.0" y1="5.0" x2="70.0" y2="15.0" stroke="#ff0000" stroke-width="2.0" /> --axis :: (Functor t, Foldable t) => Axis -> Double -> Double -> Colour Double -> Double -> Point Double -> t (Point Double) -> Svg -- | text renders text onto the SVG canvas. It is also possible to -- rotate and move the text, however the order of these modifiers -- matters. -- -- NB1: x and y determine the position of the -- bottom-left corner of the text box. If a nonzero rotation is applied, -- the whole text box will move in a circle of radius || x^2 + y^2 || -- -- NB2: the rotate and translate attributes apply to the -- _center_ of the text box instead -- --
-- > putStrLn $ renderSvg $ text (-45) C.red "hullo!" (V2 (-30) 0) (Point 0 20) -- <text x="-30" y="0" transform="translate(0 20)rotate(-45)" fill="#ff0000">hullo!</text> --text :: (Show a, Show a1, ToValue a2) => a1 -> Colour Double -> Text -> V2 a2 -> Point a -> Svg -- | Polyline (piecewise straight line) -- --
-- > putStrLn $ renderSvg (polyline [(1,1), (2,1), (2,2), (3,4)] 0.1 C.red) -- <polyline points="1,1 2,1 2,2 3,4" fill="none" stroke="#ff0000" stroke-width="0.1" /> --polyline :: (Show a1, Show a) => [(a1, a)] -> Double -> Colour Double -> Svg data FigureData a FigData :: a -> a -> a -> a -> a -> a -> FigureData a [_width] :: FigureData a -> a [_height] :: FigureData a -> a [_xmin] :: FigureData a -> a [_xmax] :: FigureData a -> a [_ymin] :: FigureData a -> a [_ymax] :: FigureData a -> a -- | A Point defines a point in R2 data Point a Point :: a -> a -> Point a [_px] :: Point a -> a [_py] :: Point a -> a -- | A LabeledPoint 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 -- LabeledPoints. data LabeledPoint l a LabeledPoint :: Point a -> l -> LabeledPoint l a [_lp] :: LabeledPoint l a -> Point a [_lplabel] :: LabeledPoint l a -> l data Axis X :: Axis Y :: Axis -- | Create a FigureData structure from the top-left corner point -- and its side lengths mkFigureData :: Num a => Point a -> a -> a -> FigureData a -- | Create the SVG header from FigureData svgHeader :: FigureData Int -> Svg -> Svg -- | 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 -> Mat2 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 v from two endpoints p1, p2. That is v -- can be seen as pointing from p1 to p2 mkV2fromEndpoints :: Num a => Point a -> Point a -> V2 a -- | Build a V2 from a Point p (i.e. assuming the V2 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 LabeledPoint along a vector moveLabeledPointV2 :: Num a => V2 a -> LabeledPoint l a -> LabeledPoint l a -- | The vector translation from a Point p contained in the -- unit square onto a Frame -- -- NB: we do not check that p is actually contained in [0,1] x -- [0,1], This has to be supplied correctly by the user fromUnitSquare :: Num a => Frame a -> Point a -> Point a -- | The vector translation from a Point contained in a Frame -- onto the unit square -- -- NB: we do not check that p is actually contained within the -- frame. This has to be supplied correctly by the user toUnitSquare :: (Fractional a, MatrixGroup (Mat2 a) (V2 a)) => Frame a -> Point a -> Point a -- | Additive group : -- --
-- v ^+^ zero == zero ^+^ v == v ---- --
-- v ^-^ v == zero --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 Scalar 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 InnerProduct 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