plots-0.1.0.2: Diagrams based plotting library.

Copyright(C) 2015 Christopher Chalmers
LicenseBSD-style (see the file LICENSE)
MaintainerChristopher Chalmers
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Plots.Axis.Ticks

Contents

Description

Ticks for being placed on an axis or a ColourBar.

Synopsis

Major ticks

data MajorTicks v n Source #

The big ticks on the axis line.

class HasMajorTicks f a where Source #

Class of things that have a MajorTicks.

Minimal complete definition

majorTicks

Methods

majorTicks :: LensLike' f a (MajorTicks (V a) (N a)) Source #

Lens onto the MajorTicks of something.

majorTicksFunction :: Functor f => LensLike' f a ((N a, N a) -> [N a]) Source #

The function used to place ticks for this axis, given the bounds of the axis. The result of these major ticks are also used as guides for MinorTicks, MajorGridLines and MinorGridLines.

Default is linearMinorTicks 5.

majorTicksAlignment :: Functor f => LensLike' f a TicksAlignment Source #

Alignment of the major ticks. Choose between autoTicks (default), centreTicks, insideTicks or outsideTicks.

majorTicksLength :: Functor f => LensLike' f a (N a) Source #

The total length the major ticks.

Default is 7.

majorTicksStyle :: Functor f => LensLike' f a (Style (V a) (N a)) Source #

The style used to render the major ticks.

Default is lwO 0.6 mempty (subject to change).

Instances

Functor f => HasMajorTicks f (Ticks v n) Source # 
HasMajorTicks f (MajorTicks v n) Source # 
Functor f => HasMajorTicks f (ColourBar b n) Source # 
(Applicative f, Traversable c) => HasMajorTicks f (Axis b c n) Source # 

Methods

majorTicks :: LensLike' f (Axis b c n) (MajorTicks (V (Axis b c n)) (N (Axis b c n))) Source #

majorTicksFunction :: LensLike' f (Axis b c n) ((N (Axis b c n), N (Axis b c n)) -> [N (Axis b c n)]) Source #

majorTicksAlignment :: LensLike' f (Axis b c n) TicksAlignment Source #

majorTicksLength :: LensLike' f (Axis b c n) (N (Axis b c n)) Source #

majorTicksStyle :: LensLike' f (Axis b c n) (Style (V (Axis b c n)) (N (Axis b c n))) Source #

Functor f => HasMajorTicks f (SingleAxis b v n) Source # 

majorTicksHelper Source #

Arguments

:: (RealFrac n, Floating n) 
=> [n]

Allowed numbers (up to powers of 10)

-> n

desired number of ticks

-> (n, n)

bounds

-> [n]

tick positions

Choose ticks whose step size is a multiple of 10 of the allowed numbers and tries to match the number of desired ticks.

Note that the resulting tick positions may go out of the range of the bounds. This is so the minor ticks can be chosen correctly if a tick doesn't end exactly on a bound. When we render, we ignore all ticks outside the bounds.

logMajorTicks :: (RealFrac n, Floating n) => n -> (n, n) -> [n] Source #

Place n ticks at powers of 10 on the axis.

Minor ticks

data MinorTicks v n Source #

The small ticks on the axis line.

class HasMinorTicks f a where Source #

Class of things that have a single MinorTicks.

Minimal complete definition

minorTicks

Methods

minorTicks :: LensLike' f a (MinorTicks (V a) (N a)) Source #

Lens onto the MinorTicks of something.

minorTicksFunction :: Functor f => LensLike' f a ([N a] -> (N a, N a) -> [N a]) Source #

The function used to place ticks for this axis, given the result of majorTicksFunction and the bounds of the axis.

Default is linearMinorTicks 3.

minorTicksAlignment :: Functor f => LensLike' f a TicksAlignment Source #

Alignment of the minor ticks. Choose between autoTicks (default), centreTicks, insideTicks or outsideTicks.

minorTicksLength :: Functor f => LensLike' f a (N a) Source #

The total length the minor ticks.

Default is 3.

minorTicksStyle :: Functor f => LensLike' f a (Style (V a) (N a)) Source #

The style used to render the minor ticks.

Default is lwO 0.4 mempty (subject to change).

Instances

Functor f => HasMinorTicks f (Ticks v n) Source # 

Methods

minorTicks :: LensLike' f (Ticks v n) (MinorTicks (V (Ticks v n)) (N (Ticks v n))) Source #

minorTicksFunction :: LensLike' f (Ticks v n) ([N (Ticks v n)] -> (N (Ticks v n), N (Ticks v n)) -> [N (Ticks v n)]) Source #

minorTicksAlignment :: LensLike' f (Ticks v n) TicksAlignment Source #

minorTicksLength :: LensLike' f (Ticks v n) (N (Ticks v n)) Source #

minorTicksStyle :: LensLike' f (Ticks v n) (Style (V (Ticks v n)) (N (Ticks v n))) Source #

HasMinorTicks f (MinorTicks v n) Source # 
(Applicative f, Traversable c) => HasMinorTicks f (Axis b c n) Source # 

Methods

minorTicks :: LensLike' f (Axis b c n) (MinorTicks (V (Axis b c n)) (N (Axis b c n))) Source #

minorTicksFunction :: LensLike' f (Axis b c n) ([N (Axis b c n)] -> (N (Axis b c n), N (Axis b c n)) -> [N (Axis b c n)]) Source #

minorTicksAlignment :: LensLike' f (Axis b c n) TicksAlignment Source #

minorTicksLength :: LensLike' f (Axis b c n) (N (Axis b c n)) Source #

minorTicksStyle :: LensLike' f (Axis b c n) (Style (V (Axis b c n)) (N (Axis b c n))) Source #

Functor f => HasMinorTicks f (SingleAxis b v n) Source # 

minorTicksHelper Source #

Arguments

:: Fractional n 
=> Int

Number of minor ticks between each major tick

-> [n]

Positions of major ticks

-> (n, n)

Bounds

-> [n]

Minor tick positions

Place n linear spaced ticks between each major tick.

Both major and minor ticks

data Ticks v n Source #

Both MajorTicks and MinorTicks together.

Instances

Functor f => HasTicks f (Ticks v n) Source # 

Methods

bothTicks :: LensLike' f (Ticks v n) (Ticks (V (Ticks v n)) (N (Ticks v n))) Source #

Functor f => HasMinorTicks f (Ticks v n) Source # 

Methods

minorTicks :: LensLike' f (Ticks v n) (MinorTicks (V (Ticks v n)) (N (Ticks v n))) Source #

minorTicksFunction :: LensLike' f (Ticks v n) ([N (Ticks v n)] -> (N (Ticks v n), N (Ticks v n)) -> [N (Ticks v n)]) Source #

minorTicksAlignment :: LensLike' f (Ticks v n) TicksAlignment Source #

minorTicksLength :: LensLike' f (Ticks v n) (N (Ticks v n)) Source #

minorTicksStyle :: LensLike' f (Ticks v n) (Style (V (Ticks v n)) (N (Ticks v n))) Source #

Functor f => HasMajorTicks f (Ticks v n) Source # 
TypeableFloat n => Default (Ticks v n) Source # 

Methods

def :: Ticks v n #

Typeable * n => HasStyle (Ticks v n) Source # 

Methods

applyStyle :: Style (V (Ticks v n)) (N (Ticks v n)) -> Ticks v n -> Ticks v n #

type V (Ticks v n) Source # 
type V (Ticks v n) = v
type N (Ticks v n) Source # 
type N (Ticks v n) = n

class (HasMinorTicks f a, HasMajorTicks f a) => HasTicks f a where Source #

Class of things with both MajorTicks and MinorTicks.

Minimal complete definition

bothTicks

Methods

bothTicks :: LensLike' f a (Ticks (V a) (N a)) Source #

Instances

Functor f => HasTicks f (Ticks v n) Source # 

Methods

bothTicks :: LensLike' f (Ticks v n) (Ticks (V (Ticks v n)) (N (Ticks v n))) Source #

(Applicative f, Traversable c) => HasTicks f (Axis b c n) Source # 

Methods

bothTicks :: LensLike' f (Axis b c n) (Ticks (V (Axis b c n)) (N (Axis b c n))) Source #

Functor f => HasTicks f (SingleAxis b v n) Source # 

Methods

bothTicks :: LensLike' f (SingleAxis b v n) (Ticks (V (SingleAxis b v n)) (N (SingleAxis b v n))) Source #

ticksAlign :: (HasTicks f a, Applicative f) => LensLike' f a TicksAlignment Source #

Traversal over both major and minor tick alignment.

ticksStyle :: (HasTicks f a, Applicative f) => LensLike' f a (Style (V a) (N a)) Source #

Traversal over both major and minor tick styles.

ticksVisible :: (HasTicks f a, Applicative f) => LensLike' f a Bool Source #

Traversal over the visibility of both major and minor ticks.

Tick alignment

data TicksAlignment Source #

Set the portion of the tick above and below the axis.

autoTicks :: TicksAlignment Source #

Set the tick type depending on the axis line position. centreTick for middleAxis, insideTick for everything else.

centreTicks :: TicksAlignment Source #

Set the tick to be in the centre of the axis with total length of the corresponding tick length.

insideTicks :: TicksAlignment Source #

Align the ticks to be inside a box axis.

outsideTicks :: TicksAlignment Source #

Align the ticks to be outside a box axis.

Helper functions

hideTicks :: HasTicks Identity a => a -> a Source #

Hides the Minor ticks when trying to render something. This can be used on multiple types:

hideTicks :: Axis b c n       -> Axis b c n
hideTicks :: SingleAxis b v n -> SingleAxis b v n
hideTicks :: Ticks v n        -> Ticks v n
hideTicks :: MinorTicks v n   -> MinorTicks v n

majorTickPositions :: (HasMajorTicks f a, Settable f) => LensLike' f a [N a] Source #

Setter over the final positions the major ticks. This is not as general as majorTicksFunction because you don't have access to the bounds but it can be useful when you know exactly what ticks you want to add or modify existing tick positions.

minorTickPositions :: (HasMinorTicks f a, Settable f) => LensLike' f a [N a] Source #

Setter over the final positions the major ticks. This is not as general as minorTicksFunction because you don't have access to the bounds but it can be useful when you know exactly what ticks you want to add or modify existing tick positions.

linearMajorTicks :: (RealFrac n, Floating n) => n -> (n, n) -> [n] Source #

Ticks whose value ends in 1, 0.5, 0.25, 0.2 (*10^n).