| Copyright | (C) 2015 Christopher Chalmers |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Christopher Chalmers |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Plots.Axis.Scale
Description
Determine how to scale an axis.
Synopsis
- data AxisScaling n
- data ScaleMode
- data UniformScaleStrategy
- data Extending n
- = AbsoluteExtend n
- | RelativeExtend n
- noExtend :: Num n => Extending n
- class HasAxisScaling f a where
- axisScaling :: LensLike' f a (AxisScaling (N a))
- scaleAspectRatio :: Functor f => LensLike' f a (Maybe (N a))
- scaleMode :: Functor f => LensLike' f a ScaleMode
- logScale :: Functor f => LensLike' f a LogScale
- axisExtend :: Functor f => LensLike' f a (Extending (N a))
- boundMin :: Functor f => LensLike' f a (Maybe (N a))
- boundMax :: Functor f => LensLike' f a (Maybe (N a))
- renderSize :: Functor f => LensLike' f a (Maybe (N a))
- data LogScale
- logNumber :: Floating a => LogScale -> a -> a
- logPoint :: (Additive v, Floating n) => v LogScale -> Point v n -> Point v n
- logDeform :: (InSpace v n a, Foldable v, Floating n, Deformable a a) => v LogScale -> a -> a
- calculateBounds :: OrderedField n => AxisScaling n -> Maybe (n, n) -> (n, n)
- calculateScaling :: (HasLinearMap v, OrderedField n, Applicative v) => v (AxisScaling n) -> BoundingBox v n -> (v (n, n), Transformation v n, Transformation v n)
Axis scale
data AxisScaling n Source #
Data type used that concerns everything to do with the size or scale of the axis.
Instances
| HasAxisScaling f (AxisScaling n) Source # | |
Defined in Plots.Axis.Scale Methods axisScaling :: LensLike' f (AxisScaling n) (AxisScaling (N (AxisScaling n))) Source # scaleAspectRatio :: LensLike' f (AxisScaling n) (Maybe (N (AxisScaling n))) Source # scaleMode :: LensLike' f (AxisScaling n) ScaleMode Source # logScale :: LensLike' f (AxisScaling n) LogScale Source # axisExtend :: LensLike' f (AxisScaling n) (Extending (N (AxisScaling n))) Source # boundMin :: LensLike' f (AxisScaling n) (Maybe (N (AxisScaling n))) Source # boundMax :: LensLike' f (AxisScaling n) (Maybe (N (AxisScaling n))) Source # renderSize :: LensLike' f (AxisScaling n) (Maybe (N (AxisScaling n))) Source # | |
| Fractional n => Default (AxisScaling n) Source # | |
Defined in Plots.Axis.Scale Methods def :: AxisScaling n # | |
| type N (AxisScaling n) Source # | |
Defined in Plots.Axis.Scale | |
How the axis should be scaled when not all dimensions are set.
Constructors
| AutoScale | |
| NoScale | |
| Stretch | |
| UniformScale UniformScaleStrategy |
data UniformScaleStrategy Source #
?
Instances
| Read UniformScaleStrategy Source # | |
Defined in Plots.Axis.Scale Methods readsPrec :: Int -> ReadS UniformScaleStrategy # readList :: ReadS [UniformScaleStrategy] # | |
| Show UniformScaleStrategy Source # | |
Defined in Plots.Axis.Scale Methods showsPrec :: Int -> UniformScaleStrategy -> ShowS # show :: UniformScaleStrategy -> String # showList :: [UniformScaleStrategy] -> ShowS # | |
How much to extend the bounds beyond any inferred bounds.
Constructors
| AbsoluteExtend n | |
| RelativeExtend n |
Instances
| Functor Extending Source # | |
| Show n => Show (Extending n) Source # | |
| Eq n => Eq (Extending n) Source # | |
| Ord n => Ord (Extending n) Source # | |
Defined in Plots.Axis.Scale | |
class HasAxisScaling f a where Source #
Class of things that have an AxisScaling.
Minimal complete definition
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.
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'(AxisbV2Double) (MaybeDouble)yMin::Lens'(AxisbV2Double) (MaybeDouble)
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'(AxisbV2Double) (MaybeDouble)yMax::Lens'(AxisbV2Double) (MaybeDouble)rMax::Lens'(Axisb 'PolarDouble) (MaybeDouble)
Default is Nothing.
renderSize :: Functor f => LensLike' f a (Maybe (N a)) Source #
The size of the rendered axis. Default is .Just 400
Instances
Log scales
Should the axis be on a logarithmic scale. The Default is
LinearAxis.
Constructors
| LinearAxis | |
| LogAxis |
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.
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.
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