plots-0.1.1.1: 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 Source #

The big ticks on the axis line.

Instances
HasMajorTicks f (MajorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Default (MajorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Methods

def :: MajorTicks v #

ApplyStyle (MajorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Methods

applyStyle :: Style (V (MajorTicks v)) (N (MajorTicks v)) -> MajorTicks v -> MajorTicks v

HasStyle (MajorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Methods

style :: Lens' (MajorTicks v) (Style (V (MajorTicks v)) (N (MajorTicks v)))

HasVisibility (MajorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

type N (MajorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

type N (MajorTicks v) = Double
type V (MajorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

type V (MajorTicks v) = v

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)) Source #

Lens onto the MajorTicks of something.

majorTicksFunction :: Functor f => LensLike' f a ((Double, Double) -> [Double]) 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 Double Source #

The total length the major ticks.

Default is 7.

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

The style used to render the major ticks.

Default is lwO 0.6 mempty (subject to change).

Instances
Functor f => HasMajorTicks f ColourBar Source # 
Instance details

Defined in Plots.Axis.ColourBar

Functor f => HasMajorTicks f (Ticks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

HasMajorTicks f (MajorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

(Applicative f, Traversable c) => HasMajorTicks f (Axis c) Source # 
Instance details

Defined in Plots.Axis

Functor f => HasMajorTicks f (SingleAxis v) Source # 
Instance details

Defined in Plots.Axis

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 Source #

The small ticks on the axis line.

Instances
HasMinorTicks f (MinorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Default (MinorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Methods

def :: MinorTicks v #

ApplyStyle (MinorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Methods

applyStyle :: Style (V (MinorTicks v)) (N (MinorTicks v)) -> MinorTicks v -> MinorTicks v

HasStyle (MinorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Methods

style :: Lens' (MinorTicks v) (Style (V (MinorTicks v)) (N (MinorTicks v)))

HasVisibility (MinorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

type N (MinorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

type N (MinorTicks v) = Double
type V (MinorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

type V (MinorTicks v) = v

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)) Source #

Lens onto the MinorTicks of something.

minorTicksFunction :: Functor f => LensLike' f a ([Double] -> (Double, Double) -> [Double]) 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 Double Source #

The total length the minor ticks.

Default is 3.

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

The style used to render the minor ticks.

Default is lwO 0.4 mempty (subject to change).

Instances
Functor f => HasMinorTicks f ColourBar Source # 
Instance details

Defined in Plots.Axis.ColourBar

Functor f => HasMinorTicks f (Ticks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

HasMinorTicks f (MinorTicks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

(Applicative f, Traversable c) => HasMinorTicks f (Axis c) Source # 
Instance details

Defined in Plots.Axis

Functor f => HasMinorTicks f (SingleAxis v) Source # 
Instance details

Defined in Plots.Axis

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 Source #

Both MajorTicks and MinorTicks together.

Instances
Functor f => HasTicks f (Ticks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Methods

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

Functor f => HasMinorTicks f (Ticks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Functor f => HasMajorTicks f (Ticks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Default (Ticks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Methods

def :: Ticks v #

ApplyStyle (Ticks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Methods

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

type N (Ticks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

type N (Ticks v) = Double
type V (Ticks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

type V (Ticks v) = v

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

Class of things with both MajorTicks and MinorTicks.

Methods

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

Instances
Functor f => HasTicks f (Ticks v) Source # 
Instance details

Defined in Plots.Axis.Ticks

Methods

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

(Applicative f, Traversable c) => HasTicks f (Axis c) Source # 
Instance details

Defined in Plots.Axis

Methods

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

Functor f => HasTicks f (SingleAxis v) Source # 
Instance details

Defined in Plots.Axis

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) Double) 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 [Double] 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 [Double] 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).