| 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 |
Plots.Axis.Scale
Description
Determine how to scale an axis.
Synopsis
- data AxisScaling
- data ScaleMode
- data UniformScaleStrategy
- data Extending
- noExtend :: Extending
- class HasAxisScaling f a where
- axisScaling :: LensLike' f a AxisScaling
- scaleAspectRatio :: Functor f => LensLike' f a (Maybe Double)
- scaleMode :: Functor f => LensLike' f a ScaleMode
- logScale :: Functor f => LensLike' f a LogScale
- axisExtend :: Functor f => LensLike' f a Extending
- boundMin :: Functor f => LensLike' f a (Maybe Double)
- boundMax :: Functor f => LensLike' f a (Maybe Double)
- renderSize :: Functor f => LensLike' f a (Maybe Double)
- data LogScale
- logNumber :: Floating a => LogScale -> a -> a
- logPoint :: (Additive v, Floating n) => v LogScale -> Point v n -> Point v n
- calculateBounds :: AxisScaling -> Maybe (Double, Double) -> (Double, Double)
- calculateScaling :: (HasLinearMap v, Applicative v) => v AxisScaling -> BoundingBox v Double -> (v (Double, Double), Transformation v Double, Transformation v Double)
Axis scale
data AxisScaling Source #
Data type used that concerns everything to do with the size or scale of the axis.
Instances
| Default AxisScaling Source # | |
Defined in Plots.Axis.Scale Methods def :: AxisScaling # | |
| HasAxisScaling f AxisScaling Source # | |
Defined in Plots.Axis.Scale Methods axisScaling :: LensLike' f AxisScaling AxisScaling Source # scaleAspectRatio :: LensLike' f AxisScaling (Maybe Double) Source # scaleMode :: LensLike' f AxisScaling ScaleMode Source # logScale :: LensLike' f AxisScaling LogScale Source # axisExtend :: LensLike' f AxisScaling Extending Source # boundMin :: LensLike' f AxisScaling (Maybe Double) Source # boundMax :: LensLike' f AxisScaling (Maybe Double) Source # renderSize :: LensLike' f AxisScaling (Maybe Double) Source # | |
| type N AxisScaling 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 !Double | |
| RelativeExtend !Double |
Instances
| Eq Extending Source # | |
| Ord Extending Source # | |
| Show Extending Source # | |
class HasAxisScaling f a where Source #
Class of things that have an AxisScaling.
Minimal complete definition
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.
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'(AxisbV2Double) (MaybeDouble)yMin::Lens'(AxisbV2Double) (MaybeDouble)
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'(AxisbV2Double) (MaybeDouble)yMax::Lens'(AxisbV2Double) (MaybeDouble)rMax::Lens'(Axisb 'PolarDouble) (MaybeDouble)
Default is Nothing.
renderSize :: Functor f => LensLike' f a (Maybe Double) 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.
Low level calculations
These functions are used by Plots.Axis.Render.
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.
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