plots-0.1.1.3: Diagrams based plotting library
Copyright(C) 2015 Christopher Chalmers
LicenseBSD-style (see the file LICENSE)
MaintainerChristopher Chalmers
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Plots.Axis.Scale

Description

Determine how to scale an axis.

Synopsis

Axis scale

data AxisScaling n Source #

Data type used that concerns everything to do with the size or scale of the axis.

data ScaleMode Source #

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

Instances

Instances details
Read ScaleMode Source # 
Instance details

Defined in Plots.Axis.Scale

Show ScaleMode Source # 
Instance details

Defined in Plots.Axis.Scale

data Extending n Source #

How much to extend the bounds beyond any inferred bounds.

Constructors

AbsoluteExtend n 
RelativeExtend n 

Instances

Instances details
Functor Extending Source # 
Instance details

Defined in Plots.Axis.Scale

Methods

fmap :: (a -> b) -> Extending a -> Extending b #

(<$) :: a -> Extending b -> Extending a #

Show n => Show (Extending n) Source # 
Instance details

Defined in Plots.Axis.Scale

Eq n => Eq (Extending n) Source # 
Instance details

Defined in Plots.Axis.Scale

Methods

(==) :: Extending n -> Extending n -> Bool #

(/=) :: Extending n -> Extending n -> Bool #

Ord n => Ord (Extending n) Source # 
Instance details

Defined in Plots.Axis.Scale

noExtend :: Num n => Extending n 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 (N a)) Source #

The way to scale in one direction.

scaleAspectRatio :: Functor f => LensLike' f a (Maybe (N a)) 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 (N a)) 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 (N a)) 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 (N a)) 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 (N a)) Source #

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

Instances

Instances details
HasAxisScaling f (AxisScaling n) Source # 
Instance details

Defined in Plots.Axis.Scale

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

Defined in Plots.Axis

Methods

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

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

scaleMode :: LensLike' f (Axis b c n) ScaleMode Source #

logScale :: LensLike' f (Axis b c n) LogScale Source #

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

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

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

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

Functor f => HasAxisScaling f (SingleAxis b v n) 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

Instances details
Show LogScale Source # 
Instance details

Defined in Plots.Axis.Scale

Default LogScale Source # 
Instance details

Defined in Plots.Axis.Scale

Methods

def :: LogScale #

Eq LogScale Source # 
Instance details

Defined in Plots.Axis.Scale

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.

logDeform :: (InSpace v n a, Foldable v, Floating n, Deformable a a) => v LogScale -> a -> a Source #

Deform an object according to the axis scale. Does nothing for linear scales.

Low level calculations

These functions are used by Plots.Axis.Render.

calculateBounds Source #

Arguments

:: OrderedField n 
=> AxisScaling n

Scaling to use for this axis

-> Maybe (n, n)

Inferred bounds (from any plots)

-> (n, n)

Lower and upper bounds to use for this axis

Calculating the bounds for an axis.

calculateScaling Source #

Arguments

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

axis scaling options

-> BoundingBox v n

bounding box from the axis plots

-> (v (n, n), Transformation v n, Transformation v n) 

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