Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Category
- = Category {
- _categoryOrder :: [Int]
- _categoryValues :: [Int]
- _categoryTable :: Map Int String
- _categoryGroups :: [[Int]]
- | DefaultCategory
- = Category {
- toCat :: (Foldable f, Eq a, Show a) => f a -> Category
- toCatOrdered :: (Foldable f, Eq a, Show a) => f a -> f a -> Category
- changeOrder :: (Foldable f, Show a) => Category -> f a -> Category
- getCategoryLabels :: Category -> [String]
- getCategoryLabelFromVal :: Category -> Int -> String
- getCategoryOrder :: Category -> [Int]
- getCategoryList :: Category -> [Int]
- catSize :: Category -> Int
- catValsLength :: Category -> Int
- filterMask :: [a] -> [Bool] -> [a]
- groupByCategory :: [a] -> Category -> [[a]]
- groupCategoryBy :: Category -> Category -> Category
- getGroupAt :: Category -> Int -> Category
- getGroupWithFilterMask :: Category -> Int -> [Bool] -> Category
- data Theme = Theme {}
- data AmbyColor
- = DefaultColor
- | R
- | G
- | B
- | C
- | M
- | Y
- | K
- | W
- | CustomColor (AlphaColour Double)
- type Palette = [AlphaColour Double]
- mutedTheme :: Theme
- deepTheme :: Theme
- cleanTheme :: Theme
- plainTheme :: Theme
- easterTheme :: Theme
- springTheme :: Theme
- bgColor :: HasBgColor s a => Lens' s a
- plotBgColor :: HasPlotBgColor s a => Lens' s a
- gridLineColor :: HasGridLineColor s a => Lens' s a
- colorCycle :: HasColorCycle s a => Lens' s a
- fontFamily :: HasFontFamily s a => Lens' s a
- fontSize :: HasFontSize s a => Lens' s a
- hexToRgb :: String -> AmbyColor
- hexToRgba :: String -> Double -> AmbyColor
- toColour :: AmbyColor -> AlphaColour Double -> AlphaColour Double
- huslPalette :: Int -> Maybe Double -> Maybe Double -> Maybe Double -> Palette
- lightPalette :: AlphaColour Double -> Int -> Palette
- desaturate :: Double -> AlphaColour Double -> AlphaColour Double
- alphaToHsl :: AlphaColour Double -> (Double, Double, Double)
- hslToAlpha :: Double -> Double -> Double -> AlphaColour Double
- contDistrDomain :: ContDistr d => d -> Int -> Vector Double
- contDistrRange :: ContDistr d => d -> Vector Double -> Vector Double
- linspace :: Double -> Double -> Int -> Vector Double
- arange :: Double -> Double -> Double -> Vector Double
- random :: ContGen d => d -> Int -> IO (Vector Double)
- scoreAtPercentile :: Vector v Double => v Double -> Int -> Double
- interquartileRange :: Vector v Double => v Double -> Double
- freedmanDiaconisBins :: Vector v Double => v Double -> Int
- class AmbyContainer c where
- data AmbyState
- type AmbyChart a = State AmbyState a
- type AmbyGrid a = State AmbyGridState a
- type ChartGrid = Grid (Renderable (LayoutPick Double Double Double))
- class Saveable a where
- takeTheme :: AmbyChart Theme
- theme :: Theme -> AmbyChart ()
- xlim :: (Double, Double) -> AmbyChart ()
- ylim :: (Double, Double) -> AmbyChart ()
- size :: (Int, Int) -> AmbyChart ()
- title :: String -> AmbyChart ()
- takeLayout :: AmbyChart (EC (Layout Double Double) ())
- getLayout :: AmbyState -> EC (Layout Double Double) ()
- getSize :: SaveObject -> (Int, Int)
- putLayout :: EC (Layout Double Double) () -> AmbyChart ()
- getSaveObjectRenderable :: SaveObject -> Renderable (LayoutPick Double Double Double)
- gridTheme :: Theme -> AmbyGrid ()
- takeGridTheme :: AmbyGrid Theme
- gridSize :: (Int, Int) -> AmbyGrid ()
- gridScale :: (Double, Double) -> AmbyGrid ()
- setGrid :: Grid (Renderable (LayoutPick Double Double Double)) -> AmbyGrid ()
- chartToGrid :: AmbyChart () -> Grid (Renderable (LayoutPick Double Double Double))
- data PlotOpts
- data PlotEqOpts
- data DistPlotOpts
- data KdePlotOpts
- data RugPlotOpts
- data BoxPlotOpts = BoxPlotOpts {}
- data FactorPlotOpts = FactorPlotOpts {
- _factorPlotOptsFacL :: Category
- _factorPlotOptsHueL :: Category
- _factorPlotOptsColL :: Category
- _factorPlotOptsRowL :: Category
- _factorPlotOptsColor :: AmbyColor
- _factorPlotOptsSaturation :: Double
- _factorPlotOptsAxis :: Axis
- _factorPlotOptsKind :: PlotKind
- _factorPlotOptsDatLabel :: String
- _factorPlotOptsFacLabel :: String
- _factorPlotOptsRowLabel :: String
- _factorPlotOptsColLabel :: String
- data Bandwidth
- data Axis
- data PlotKind = Box
- bins :: HasBins s a => Lens' s a
- hist :: HasHist s a => Lens' s a
- rug :: HasRug s a => Lens' s a
- rugHeight :: HasRugHeight s a => Lens' s a
- cut :: HasCut s a => Lens' s a
- shade :: HasShade s a => Lens' s a
- kde :: HasKde s a => Lens' s a
- axis :: HasAxis s a => Lens' s a
- height :: HasHeight s a => Lens' s a
- gridsize :: HasGridsize s a => Lens' s a
- bw :: HasBw s a => Lens' s a
- color :: HasColor s a => Lens' s a
- linewidth :: HasLinewidth s a => Lens' s a
- histLinewidth :: HasHistLinewidth s a => Lens' s a
- kdeLinewidth :: HasKdeLinewidth s a => Lens' s a
- rugLinewidth :: HasRugLinewidth s a => Lens' s a
- kind :: HasKind s a => Lens' s a
- hueLegend :: HasHueLegend s a => Lens' s a
- facLegend :: HasFacLegend s a => Lens' s a
- fac :: HasFac s a b => Setter s s a b
- hue :: HasHue s a b => Setter s s a b
- row :: HasRow s a b => Setter s s a b
- col :: HasCol s a b => Setter s s a b
- saturation :: HasSaturation s a => Lens' s a
- facL :: HasFacL s a => Lens' s a
- hueL :: HasHueL s a => Lens' s a
- rowL :: HasRowL s a => Lens' s a
- colL :: HasColL s a => Lens' s a
- datLabel :: HasDatLabel s a => Lens' s a
- facLabel :: HasFacLabel s a => Lens' s a
- rowLabel :: HasRowLabel s a => Lens' s a
- colLabel :: HasColLabel s a => Lens' s a
- getEC :: AmbyChart () -> EC (Layout Double Double) ()
- getRenderable :: AmbyChart () -> Renderable (LayoutPick Double Double Double)
- save :: Saveable s => s -> IO ()
- saveSvg :: Saveable s => s -> IO ()
- cairoDefSave :: FilePath
- diagramsDefSave :: FilePath
- loadDataset :: Dataset a -> IO [a]
- getCol :: Loader a => Lens (RowValue a) (RowValue a) b b -> a -> b
- data Tip = Tip {
- _tipTotalBill :: !Double
- _tipTip :: !Double
- _tipSex :: !String
- _tipSmoker :: !String
- _tipDay :: !String
- _tipTime :: !String
- _tipTipSize :: !Int
- data Iris = Iris {}
- tips :: Dataset Tip
- getTipColumns :: [Tip] -> IO ([Double], [Double], Category, Category, Category, Category, [Int])
- iris :: Dataset Iris
- getIrisColumns :: [Iris] -> IO ([Double], [Double], [Double], [Double], Category)
- totalBill :: HasTotalBill s a => Lens' s a
- tip :: HasTip s a => Lens' s a
- sex :: HasSex s a => Lens' s a
- day :: HasDay s a => Lens' s a
- smoker :: HasSmoker s a => Lens' s a
- time :: HasTime s a => Lens' s a
- tipSize :: HasTipSize s a => Lens' s a
- sepalLength :: HasSepalLength s a => Lens' s a
- sepalWidth :: HasSepalWidth s a => Lens' s a
- petalLength :: HasPetalLength s a => Lens' s a
- petalWidth :: HasPetalWidth s a => Lens' s a
- irisClass :: HasIrisClass s a => Lens' s a
- (.=) :: MonadState s m => ASetter s s a b -> b -> m ()
Modules
Types
Category | |
| |
DefaultCategory |
Methods
getCategoryLabels :: Category -> [String] Source #
Get list of category labels in order.
getCategoryOrder :: Category -> [Int] Source #
getCategoryList :: Category -> [Int] Source #
catSize :: Category -> Int Source #
Find number of distinct elements in a category.
Examples:
>>>
catSize $ toCat ["dog", "cat", "dog"]
2
catValsLength :: Category -> Int Source #
Find the number of elements in a category.
filterMask :: [a] -> [Bool] -> [a] Source #
Filter list based on another equal sized list of bools.
Examples:
>>>
filterMask [1..5] [True, False, True, False, False]
[1,3]
groupByCategory :: [a] -> Category -> [[a]] Source #
Group by category.
Examples:
>>>
groupByCategory [1..5] (toCat [1, 1, 3, 2, 4])
[[1,2],[3],[4],[5]]
Used to style a chart.
Api facing color selection.
DefaultColor | |
R | |
G | |
B | |
C | |
M | |
Y | |
K | |
W | |
CustomColor (AlphaColour Double) |
type Palette = [AlphaColour Double] Source #
Themes
mutedTheme :: Theme Source #
cleanTheme :: Theme Source #
plainTheme :: Theme Source #
easterTheme :: Theme Source #
springTheme :: Theme Source #
Lenses
plotBgColor :: HasPlotBgColor s a => Lens' s a Source #
gridLineColor :: HasGridLineColor s a => Lens' s a Source #
colorCycle :: HasColorCycle s a => Lens' s a Source #
fontFamily :: HasFontFamily s a => Lens' s a Source #
Color helpers
toColour :: AmbyColor -> AlphaColour Double -> AlphaColour Double Source #
Conversion from Amby Api Color
to underlying Colour
type.
huslPalette :: Int -> Maybe Double -> Maybe Double -> Maybe Double -> Palette Source #
Get a set of evenly spaced colors in the HUSL space.
lightPalette :: AlphaColour Double -> Int -> Palette Source #
Get sequential palette of colors from light to dark
desaturate :: Double -> AlphaColour Double -> AlphaColour Double Source #
Desaturate color by a proporation.
alphaToHsl :: AlphaColour Double -> (Double, Double, Double) Source #
Converts 'AlphaColour Double' to triplet of Double
s in hsl encoding.
Examples:
>>>
import qualified Data.Colour.Names as Colour
>>>
alphaToHsl (opaque Colour.black)
(0.0,0.0,0.0)
>>>
alphaToHsl (opaque Colour.blue)
(240.0,1.0,0.5)
hslToAlpha :: Double -> Double -> Double -> AlphaColour Double Source #
Converts hsl triplet of Double
s to 'AlphaColour Double'.
Ranges
contDistrDomain :: ContDistr d => d -> Int -> Vector Double Source #
contDistrDomain d n
generates a domain of n
evenly spaced points
for the continuous distribution d
.
contDistrRange :: ContDistr d => d -> Vector Double -> Vector Double Source #
contDistrRange d xs
generates the pdf value of the continious distribution
d
for each value in xs
.
linspace :: Double -> Double -> Int -> Vector Double Source #
linspace s e n
generates n
evenly spaced values between [s
, e
].
arange :: Double -> Double -> Double -> Vector Double Source #
arange s e i
generates numbers between [s
, e
] spaced by amount i
.
arange
is the equivalent of haskell's range notation except that it generates
a Vector
. As a result, the last element may be greater than less than, or
greater than the stop point.
random :: ContGen d => d -> Int -> IO (Vector Double) Source #
Generates an unboxed vectors of random numbers from a distribution
that is an instance of ContGen
. This function is meant for ease of use
and is expensive.
Frequencies
scoreAtPercentile :: Vector v Double => v Double -> Int -> Double Source #
scoreAtPercentile xs p
calculates the score at percentile p
.
Examples:
>>>
let a = arange 0 99 1
>>>
scoreAtPercentile a 50
49.5
interquartileRange :: Vector v Double => v Double -> Double Source #
Calculate the interquartile range.
Examples:
>>>
interquartileRange demoData
2.5
freedmanDiaconisBins :: Vector v Double => v Double -> Int Source #
Estimate a good default bin size.
Examples:
>>>
freedmanDiaconisBins demoData
2
class AmbyContainer c where Source #
plot, plot', plotEq, plotEq', distPlot, distPlot', kdePlot, kdePlot', rugPlot, rugPlot', boxPlot, boxPlot', factorPlot
plot :: c -> c -> State PlotOpts () -> AmbyChart () Source #
plot' :: c -> c -> AmbyChart () Source #
plotEq :: c -> (Value c -> Value c) -> State PlotEqOpts () -> AmbyChart () Source #
plotEq' :: c -> (Value c -> Value c) -> AmbyChart () Source #
distPlot :: c -> State DistPlotOpts () -> AmbyChart () Source #
distPlot' :: c -> AmbyChart () Source #
kdePlot :: c -> State KdePlotOpts () -> AmbyChart () Source #
kdePlot' :: c -> AmbyChart () Source #
rugPlot :: c -> State RugPlotOpts () -> AmbyChart () Source #
rugPlot' :: c -> AmbyChart () Source #
boxPlot :: c -> State BoxPlotOpts () -> AmbyChart () Source #
boxPlot' :: c -> AmbyChart () Source #
factorPlot :: c -> State FactorPlotOpts () -> AmbyGrid () Source #
type ChartGrid = Grid (Renderable (LayoutPick Double Double Double)) Source #
General accessors
getSaveObjectRenderable :: SaveObject -> Renderable (LayoutPick Double Double Double) Source #
Grid
gridScale :: (Double, Double) -> AmbyGrid () Source #
Scale current grid size by percentage. Scaling will snap to nearest integer point.
setGrid :: Grid (Renderable (LayoutPick Double Double Double)) -> AmbyGrid () Source #
chartToGrid :: AmbyChart () -> Grid (Renderable (LayoutPick Double Double Double)) Source #
Plot options
data BoxPlotOpts Source #
data FactorPlotOpts Source #
histLinewidth :: HasHistLinewidth s a => Lens' s a Source #
kdeLinewidth :: HasKdeLinewidth s a => Lens' s a Source #
rugLinewidth :: HasRugLinewidth s a => Lens' s a Source #
Categorical options
saturation :: HasSaturation s a => Lens' s a Source #
getEC :: AmbyChart () -> EC (Layout Double Double) () Source #
Convert AmbyChart
into Chart's 'EC (Layout Double Double) ()'.
getRenderable :: AmbyChart () -> Renderable (LayoutPick Double Double Double) Source #
Convert AmbyGrid
into Chart's 'Renderable a'.
cairoDefSave :: FilePath Source #
Default save filename for Cairo.
diagramsDefSave :: FilePath Source #
Default save filename for Diagrams.
loadDataset :: Dataset a -> IO [a] Source #
Datasets
Tip | |
|
getTipColumns :: [Tip] -> IO ([Double], [Double], Category, Category, Category, Category, [Int]) Source #
Tip lenses
Iris lenses
sepalLength :: HasSepalLength s a => Lens' s a Source #
sepalWidth :: HasSepalWidth s a => Lens' s a Source #
petalLength :: HasPetalLength s a => Lens' s a Source #
petalWidth :: HasPetalWidth s a => Lens' s a Source #
Lens operators
(.=) :: MonadState s m => ASetter s s a b -> b -> m () infix 4 #
Replace the target of a Lens
or all of the targets of a Setter
or Traversal
in our monadic state with a new value, irrespective of the
old.
This is an infix version of assign
.
>>>
execState (do _1 .= c; _2 .= d) (a,b)
(c,d)
>>>
execState (both .= c) (a,b)
(c,c)
(.=
) ::MonadState
s m =>Iso'
s a -> a -> m () (.=
) ::MonadState
s m =>Lens'
s a -> a -> m () (.=
) ::MonadState
s m =>Traversal'
s a -> a -> m () (.=
) ::MonadState
s m =>Setter'
s a -> a -> m ()
It puts the state in the monad or it gets the hose again.