interactive-plot-0.1.0.0: Interactive quick time series plotting

Copyright(c) Justin Le 2018
LicenseBSD3
Maintainerjustin@jle.im
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Interactive.Plot.Run

Contents

Description

Run plots interactively in the terminal.

Synopsis

Simple

runPlot Source #

Arguments

:: PlotOpts

options (can be defaultPlotOpts)

-> Maybe String

title

-> [Series]

series data

-> IO () 

Display fixed plot and title interactively.

See runPlotDynamic for more control.

runPlotAuto Source #

Arguments

:: PlotOpts

options (can be defaultPlotOpts)

-> Maybe String

title

-> [AutoSeries]

uninitialized series data

-> IO () 

Display fixed plot and title interactively, filling in default values.

See runPlotDynamic for more control.

Animated

animatePlot Source #

Arguments

:: PlotOpts

options (can be defaultPlotOpts)

-> Double

update rate (frames per second)

-> Maybe String

title

-> [[Series]]

list of series data (potentially infinite)

-> IO () 

Display a series of plots ([SeriesF]) with a time delay between each one. Will quit when the last plot is displayed. Use lastForever on the input list to repeat the last item indefinitely, or cycle to cycle through the list forever.

Note that this behavior is pretty simple; more advanced functionality can be achieved with runPlotDynamic directly.

lastForever :: [a] -> [a] Source #

Handy function to use with animatePlot to extend the last frame into eternity.

animatePlotFunc Source #

Arguments

:: PlotOpts

options (can be defaultPlotOpts, but remember to set a framerate)

-> Maybe String

title

-> (Double -> Maybe [Series])

function from time to plot. will quit as soon as Nothing is returned.

-> IO () 

Animate (according to the framerate in the PlotOpts) a function Double -> Maybe [Series], where the input is the current time in seconds and the output is the plot to display at that time. Will quit as soon as Nothing is given.

Remember to give a PlotOpts with a Just framerate.

This is a simple wrapper over animatePlotMoore with a stateless function. For more advanced functionality, use animatePlotMoore or runPlotDynamic directly.

animatePlotMoore Source #

Arguments

:: PlotOpts

options (can be defaultPlotOpts, but remember to set a framerate)

-> Maybe String

title

-> Moore [Series]

moore machine representing progression of plot from an initial state

-> IO () 

Animate (according to the framerate in the PlotOpts) a "Moore machine" description of a plot evolving over time with some initial state.

Remember to give a PlotOpts with a Just framerate.

For a simplified version of a stateless function, see animatePlotFunc. This is implemented in terms of runPlotDynamic, but the representation of an animation in terms of a moore machine is powerful enough to represent a very general class of animations.

data Moore a Source #

Used for animatePlotMoore to specify how a plot evolves over time with some initial state.

Constructors

Moore 

Fields

Instances
Functor Moore Source # 
Instance details

Defined in Interactive.Plot.Run

Methods

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

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

Custom

runPlotDynamic Source #

Arguments

:: PlotOpts 
-> (Event -> IO Bool)

process VTY events (return False to trigger quit)

-> IO (Maybe PlotData)

action to "get" the plot data every frame. if Nothing, quit.

-> IO () 

Version of runPlot that allows you to vary the plotted data and the title. It will execute the IO PlotData to get the current plot data; you can use this with i.e. an IORef to adjust the data in real-time.

data PlotData Source #

Dynamically adjustable plot data.

Constructors

PlotData 

pdTitle :: Lens' PlotData (Maybe String) Source #

Getter/setter lens to the title field of a PlotData

pdSerieses :: Lens' PlotData [Series] Source #

Getter/setter lens to the serieses field of a PlotData

pdDesc :: Lens' PlotData (Maybe Image) Source #

Getter/setter lens to the description box field of a PlotData