Copyright | (C) 2015 Christopher Chalmers |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Christopher Chalmers |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Ticks for being placed on an axis or a ColourBar
.
Synopsis
- data MajorTicks v
- class HasMajorTicks f a where
- majorTicks :: LensLike' f a (MajorTicks (V a))
- majorTicksFunction :: Functor f => LensLike' f a ((Double, Double) -> [Double])
- majorTicksAlignment :: Functor f => LensLike' f a TicksAlignment
- majorTicksLength :: Functor f => LensLike' f a Double
- majorTicksStyle :: Functor f => LensLike' f a (Style (V a) Double)
- majorTicksHelper :: (RealFrac n, Floating n) => [n] -> n -> (n, n) -> [n]
- logMajorTicks :: (RealFrac n, Floating n) => n -> (n, n) -> [n]
- data MinorTicks v
- class HasMinorTicks f a where
- minorTicks :: LensLike' f a (MinorTicks (V a))
- minorTicksFunction :: Functor f => LensLike' f a ([Double] -> (Double, Double) -> [Double])
- minorTicksAlignment :: Functor f => LensLike' f a TicksAlignment
- minorTicksLength :: Functor f => LensLike' f a Double
- minorTicksStyle :: Functor f => LensLike' f a (Style (V a) Double)
- minorTicksHelper :: Fractional n => Int -> [n] -> (n, n) -> [n]
- data Ticks v
- class (HasMinorTicks f a, HasMajorTicks f a) => HasTicks f a where
- ticksAlign :: (HasTicks f a, Applicative f) => LensLike' f a TicksAlignment
- ticksStyle :: (HasTicks f a, Applicative f) => LensLike' f a (Style (V a) Double)
- ticksVisible :: (HasTicks f a, Applicative f) => LensLike' f a Bool
- data TicksAlignment
- autoTicks :: TicksAlignment
- centreTicks :: TicksAlignment
- centerTicks :: TicksAlignment
- insideTicks :: TicksAlignment
- outsideTicks :: TicksAlignment
- hideTicks :: HasTicks Identity a => a -> a
- majorTickPositions :: (HasMajorTicks f a, Settable f) => LensLike' f a [Double]
- minorTickPositions :: (HasMinorTicks f a, Settable f) => LensLike' f a [Double]
- linearMajorTicks :: (RealFrac n, Floating n) => n -> (n, n) -> [n]
Major ticks
data MajorTicks v Source #
The big ticks on the axis line.
Instances
class HasMajorTicks f a where Source #
Class of things that have a MajorTicks
.
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
(subject to change).lwO
0.6 mempty
Instances
:: (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
class HasMinorTicks f a where Source #
Class of things that have a single MinorTicks
.
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
(subject to change).lwO
0.4 mempty
Instances
:: 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
Both MajorTicks
and MinorTicks
together.
Instances
class (HasMinorTicks f a, HasMajorTicks f a) => HasTicks f a where Source #
Class of things with both MajorTicks
and MinorTicks
.
Instances
Functor f => HasTicks f (Ticks v) Source # | |
(Applicative f, Traversable c) => HasTicks f (Axis c) Source # | |
Functor f => HasTicks f (SingleAxis v) Source # | |
Defined in Plots.Axis bothTicks :: LensLike' f (SingleAxis v) (Ticks (V (SingleAxis v))) 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) 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.
Instances
Eq TicksAlignment Source # | |
Defined in Plots.Axis.Ticks (==) :: TicksAlignment -> TicksAlignment -> Bool # (/=) :: TicksAlignment -> TicksAlignment -> Bool # | |
Show TicksAlignment Source # | |
Defined in Plots.Axis.Ticks showsPrec :: Int -> TicksAlignment -> ShowS # show :: TicksAlignment -> String # showList :: [TicksAlignment] -> ShowS # |
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.
centerTicks :: TicksAlignment Source #
Synonym for centreTicks
.
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 nhideTicks
::SingleAxis
b v n ->SingleAxis
b v nhideTicks
::Ticks
v n ->Ticks
v nhideTicks
::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).