plots-0.1.1.1: Diagrams based plotting library.

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

Plots.Axis.Labels

Contents

Description

There are two kinds of labels this module deals with: The AxisLabel labels are placed next to an axis line. The TickLabels are the numbers (usually) next to each major tick on an axis line.

Synopsis

Axis line labels

class HasAxisLabel f a where Source #

Minimal complete definition

axisLabel

Methods

axisLabel :: LensLike' f a (AxisLabel (V a)) Source #

The options for the label of the axis. This can be used on various levels of the axis:

axisLabel :: Traversal' (Axis b c n)       (AxisLabel (BaseSpace c) n)
axisLabel :: Lens'      (SingleAxis v) (AxisLabel v n)
axisLabel :: Lens'      (AxisLabel v n)    (AxisLabel v n)

axisLabelText :: Functor f => LensLike' f a String Source #

The text to use when labeling the axis.

axisLabelTextFunction :: Functor f => LensLike' f a (TextFunction (V a)) Source #

The TextFunction to render the text of the axis label.

axisLabelGap :: Functor f => LensLike' f a Double Source #

The gap between the axis and the labels, in the direction corresponding to the axisLabelPosition.

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

The Style to use on the rendered text.

axisLabelPosition :: Functor f => LensLike' f a AxisLabelPosition Source #

The position the label will be placed parallel to the axis.

axisLabelPlacement :: Functor f => LensLike' f a AxisLabelPosition Source #

Whether the axis label should be placed inside or outside the axis.

Instances
HasAxisLabel f (AxisLabel v) Source # 
Instance details

Defined in Plots.Axis.Labels

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

Defined in Plots.Axis

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

Defined in Plots.Axis

data AxisLabel v Source #

AxisLabel describes the label next to each axis line. They are normally set with the xLabel and yLabel helper function:

myAxis = r2Axis &~ do
  xLabel .= "time (s)"
  yLabel .= "height (m)"

See HasAxisLabel for more advanced settings.

Instances
HasAxisLabel f (AxisLabel v) Source # 
Instance details

Defined in Plots.Axis.Labels

Default (AxisLabel V3) Source # 
Instance details

Defined in Plots.Axis.Labels

Methods

def :: AxisLabel V3 #

Default (AxisLabel V2) Source # 
Instance details

Defined in Plots.Axis.Labels

Methods

def :: AxisLabel V2 #

ApplyStyle (AxisLabel v) Source # 
Instance details

Defined in Plots.Axis.Labels

Methods

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

HasStyle (AxisLabel v) Source # 
Instance details

Defined in Plots.Axis.Labels

Methods

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

HasGap (AxisLabel v) Source # 
Instance details

Defined in Plots.Axis.Labels

HasVisibility (AxisLabel v) Source # 
Instance details

Defined in Plots.Axis.Labels

type N (AxisLabel v) Source # 
Instance details

Defined in Plots.Axis.Labels

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

Defined in Plots.Axis.Labels

type V (AxisLabel v) = v

data AxisLabelPosition Source #

The position of the AxisLabel along the axis.

data AxisLabelPlacement Source #

Whether the AxisLabel should be inside or outside the axis.

Axis tick labels

data TickLabels v Source #

TickLabels describes how to draw the labels next to ticks. See HasTickLabels for more options.

Instances
HasTickLabels f (TickLabels v) Source # 
Instance details

Defined in Plots.Axis.Labels

Default (TickLabels V3) Source # 
Instance details

Defined in Plots.Axis.Labels

Methods

def :: TickLabels V3 #

Default (TickLabels V2) Source # 
Instance details

Defined in Plots.Axis.Labels

Methods

def :: TickLabels V2 #

HasGap (TickLabels v) Source # 
Instance details

Defined in Plots.Axis.Labels

HasVisibility (TickLabels v) Source # 
Instance details

Defined in Plots.Axis.Labels

type N (TickLabels v) Source # 
Instance details

Defined in Plots.Axis.Labels

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

Defined in Plots.Axis.Labels

type V (TickLabels v) = v

class HasTickLabels f a where Source #

Minimal complete definition

tickLabel

Methods

tickLabel :: LensLike' f a (TickLabels (V a)) Source #

The options for the label of ticks. This can be used on various levels of the axis:

tickLabel :: Traversal' (Tick c)       (TickLabels (BaseSpace c))
tickLabel :: Lens'      (SingleAxis v) (TickLabels v)
tickLabel :: Lens'      (TickLabel v)  (TickLabels v)

tickLabelTextFunction :: Functor f => LensLike' f a (TextFunction (V a)) Source #

The TextFunction to render the text.

Default is mkText.

tickLabelFunction :: Functor f => LensLike' f a ([Double] -> (Double, Double) -> [(Double, String)]) Source #

Tick labels functions are used to draw the tick labels. They have access to the major ticks and the current bounds. Returns the position of the tick and label to use at that position.

Default is atMajorTicks floatShow

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

The Style to use on the rendered text.

Default is fontSize (output 11).

tickLabelGap :: Functor f => LensLike' f a Double Source #

The gap between the axis and the tick labels.

Default is 12.

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

Defined in Plots.Axis.ColourBar

HasTickLabels f (TickLabels v) Source # 
Instance details

Defined in Plots.Axis.Labels

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

Defined in Plots.Axis

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

Defined in Plots.Axis

tickLabelPositions :: (HasTickLabels f a, Settable f) => LensLike' f a [(Double, String)] Source #

Setter over the final positions the major ticks. This is not as general as tickLabelFunction 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 or to add an extra value:

xAxis . tickLabelPositions .= [(1, "apples"), (2, "oranges"), (3, "bananas"]
yAxis . tickLabelPositions <>= [(1.5, "critial mass")]

If you want to change or add normal ticks see majorTicksFunction.

atMajorTicks :: (Double -> String) -> [Double] -> (Double, Double) -> [(Double, String)] Source #

Make a TickLabelFunction by specifying how to draw a single label from a position on the axis.

Misc

type TextFunction v = TextAlignment Double -> String -> Diagram v Source #

Function to render the axis label from a string. This is very basic now and will be replace by a more sophisticated system.