Learn R Programming

stream (version 2.0-1)

animate_data: Animates the Plotting of a Data Streams

Description

Generates an animation of a data stream.

Usage

animate_data(dsd, horizon = 100, n = 1000, wait = 0.1, plot.args = NULL, ...)

Arguments

dsd

a DSD object

horizon

the number of points displayed at once/used for evaluation.

n

the number of points to be plotted

wait

the time interval between each frame

plot.args

a list with plotting parameters for the clusters.

...

extra arguments are added to plot.args.

Author

Michael Hahsler

Details

Animations are recorded using the library animation and can be replayed (which gives a smoother experience since the is no more computation done) and saved in various formats (see Examples section below).

Note: You need to install package animation and its system requirements.

See Also

animation::ani.replay() for replaying and saving animations.

Other DSD: DSD_BarsAndGaussians(), DSD_Benchmark(), DSD_Cubes(), DSD_Gaussians(), DSD_MG(), DSD_Memory(), DSD_Mixture(), DSD_NULL(), DSD_ReadDB(), DSD_ReadStream(), DSD_Target(), DSD_UniformNoise(), DSD_mlbenchData(), DSD_mlbenchGenerator(), DSD(), DSF(), close_stream(), get_points(), plot.DSD(), reset_stream()

Other plot: animate_cluster(), plot.DSC(), plot.DSD()

Examples

Run this code
if (interactive()) {

stream <- DSD_Benchmark(1)
animate_data(stream, horizon = 100, n = 5000, xlim = c(0,1), ylim = c(0,1))

### animations can be replayed with the animation package
library(animation)
animation::ani.options(interval = .1) ## change speed
ani.replay()

### animations can also be saved as HTML, animated gifs, etc.
saveHTML(ani.replay())
}

Run the code above in your browser using DataLab