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.Scale

Contents

Description

Determine how to scale an axis.

Synopsis

Axis scale

data ScaleMode Source #

How the axis should be scaled when not all dimensions are set.

data Extending Source #

How much to extend the bounds beyond any inferred bounds.

noExtend :: Extending Source #

Do not extend the axis beyond the inferred bounds.

class HasAxisScaling f a where Source #

Class of things that have an AxisScaling.

Minimal complete definition

axisScaling

Methods

axisScaling :: LensLike' f a AxisScaling Source #

The way to scale in one direction.

scaleAspectRatio :: Functor f => LensLike' f a (Maybe Double) Source #

The ratio relative to other axis. If no ratios are set, the ratio is not enforced. If at least one is set, Nothing ratios are 1.

scaleMode :: Functor f => LensLike' f a ScaleMode Source #

The mode to determine how to scale the bounds in a direction. Choose between AutoScale, NoScale, Stretch or UniformScale.

Default is AutoScale.

logScale :: Functor f => LensLike' f a LogScale Source #

Whether the axis uses LogAxis or LinearAxis.

Default is LinearAxis.

axisExtend :: Functor f => LensLike' f a Extending Source #

How much to extend the bounds over infered bounds. This is ignored if a boundMax or boundMin is set.

boundMin :: Functor f => LensLike' f a (Maybe Double) Source #

The maximum bound the axis. There are helper functions for setting a minimum bound for a specific axis.

xMin :: Lens' (Axis b V2 Double) (Maybe Double)
yMin :: Lens' (Axis b V2 Double) (Maybe Double)

Default is Nothing.

boundMax :: Functor f => LensLike' f a (Maybe Double) Source #

The maximum bound the axis. There are helper functions for setting a maximum bound specific axis.

xMax :: Lens' (Axis b V2 Double) (Maybe Double)
yMax :: Lens' (Axis b V2 Double) (Maybe Double)
rMax :: Lens' (Axis b 'Polar Double) (Maybe Double)

Default is Nothing.

renderSize :: Functor f => LensLike' f a (Maybe Double) Source #

The size of the rendered axis. Default is Just 400.

Instances
HasAxisScaling f AxisScaling Source # 
Instance details

Defined in Plots.Axis.Scale

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

Defined in Plots.Axis

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

Defined in Plots.Axis

Log scales

data LogScale Source #

Should the axis be on a logarithmic scale. The Default is LinearAxis.

Constructors

LinearAxis 
LogAxis 
Instances
Eq LogScale Source # 
Instance details

Defined in Plots.Axis.Scale

Show LogScale Source # 
Instance details

Defined in Plots.Axis.Scale

Default LogScale Source # 
Instance details

Defined in Plots.Axis.Scale

Methods

def :: LogScale #

logNumber :: Floating a => LogScale -> a -> a Source #

Log the number for LogAxis, do nothing for LinearAxis.

logPoint :: (Additive v, Floating n) => v LogScale -> Point v n -> Point v n Source #

Transform a point according to the axis scale. Does nothing for linear scales.

Low level calculations

These functions are used by Plots.Axis.Render.

calculateBounds Source #

Arguments

:: AxisScaling

Scaling to use for this axis

-> Maybe (Double, Double)

Inferred bounds (from any plots)

-> (Double, Double)

Lower and upper bounds to use for this axis

Calculating the bounds for an axis.

calculateScaling Source #

Arguments

:: (HasLinearMap v, Applicative v) 
=> v AxisScaling

axis scaling options

-> BoundingBox v Double

bounding box from the axis plots

-> (v (Double, Double), Transformation v Double, Transformation v Double) 

Calculate the scaling for the axis.

The result returns:

  • The final bounds for the axis
  • scale to match desired scaleAspectRatio
  • scale to match desired asSizeSpec