| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Plots.Types.Smooth
- data GSmoothPlot v n a
- type SmoothPlot v n = GSmoothPlot v n (Point v n)
- mkSmoothPlotOf :: (PointLike v n p, OrderedField n) => Fold s p -> s -> SmoothPlot v n
- mkSmoothPlot :: (PointLike v n p, Foldable f, OrderedField n) => f p -> SmoothPlot v n
- drawTrail :: HasSmooth a v n d => Lens' a Bool
- testXY :: OrderedField n => [P2 n] -> (Located (Trail' Loop V2 n), Located (Trail' Line V2 n))
- smoothPlot :: (v ~ BaseSpace c, PointLike v n p, MonadState (Axis b c n) m, Plotable (SmoothPlot v n) b, Foldable f) => f p -> State (Plot (SmoothPlot v n) b) () -> m ()
- smoothPlot' :: (v ~ BaseSpace c, PointLike v n p, MonadState (Axis b c n) m, Plotable (SmoothPlot v n) b, Foldable f) => f p -> m ()
- smoothPlotOf :: (v ~ BaseSpace c, PointLike v n p, MonadState (Axis b c n) m, Plotable (SmoothPlot v n) b) => Fold s p -> s -> State (Plot (SmoothPlot v n) b) () -> m ()
- smoothPlotOf' :: (v ~ BaseSpace c, PointLike v n p, MonadState (Axis b c n) m, Plotable (SmoothPlot v n) b) => Fold s p -> s -> m ()
General smooth plot
data GSmoothPlot v n a #
Instances
| (Metric v, OrderedField n) => Enveloped (GSmoothPlot v n a) # | |
| (Typeable * a, TypeableFloat n, Renderable (Path V2 n) b) => Plotable (GSmoothPlot V2 n a) b # | |
| type V (GSmoothPlot v n a) # | |
| type N (GSmoothPlot v n a) # | |
Smooth plot
type SmoothPlot v n = GSmoothPlot v n (Point v n) #
mkSmoothPlotOf :: (PointLike v n p, OrderedField n) => Fold s p -> s -> SmoothPlot v n #
Smooth plot with a given fold.
mkSmoothPlot :: (PointLike v n p, Foldable f, OrderedField n) => f p -> SmoothPlot v n #
Plot a smooth function given data.
Helper functions
Smooth Plot
smoothPlot :: (v ~ BaseSpace c, PointLike v n p, MonadState (Axis b c n) m, Plotable (SmoothPlot v n) b, Foldable f) => f p -> State (Plot (SmoothPlot v n) b) () -> m () #
Add a SmoothPlot to the AxisState from a data set.
myaxis = r2Axis ~&
smoothPlot data1
Example
import Plots mydata1 = [(1,3), (2,5.5), (3.2, 6), (3.5, 6.1)] mydata2 = mydata1 & each . _1 *~ 0.5 mydata3 = [V2 1.2 2.7, V2 2 5.1, V2 3.2 2.6, V2 3.5 5]
smoothAxis :: Axis B V2 Double smoothAxis = r2Axis &~ do smoothPlot mydata1 $ key "data 1" smoothPlot mydata2 $ key "data 2" smoothPlot mydata3 $ key "data 3"
smoothExample = renderAxis smoothAxis
smoothPlot' :: (v ~ BaseSpace c, PointLike v n p, MonadState (Axis b c n) m, Plotable (SmoothPlot v n) b, Foldable f) => f p -> m () #
Make a SmoothPlot and take a State on the plot to alter it's
options
myaxis = r2Axis &~ do
smoothPlot' pointData1 $ do
sLine .= False
addLegendEntry "data 1"
Fold variant smooth plot
smoothPlotOf :: (v ~ BaseSpace c, PointLike v n p, MonadState (Axis b c n) m, Plotable (SmoothPlot v n) b) => Fold s p -> s -> State (Plot (SmoothPlot v n) b) () -> m () #
Add a SmoothPlot with the given name for the legend entry.
myaxis = r2Axis &~ do
smoothPlotL "blue team" pointData1
smoothPlotL "red team" pointData2
smoothPlotOf' :: (v ~ BaseSpace c, PointLike v n p, MonadState (Axis b c n) m, Plotable (SmoothPlot v n) b) => Fold s p -> s -> m () #