Click on the start button to start the plotting, and on the stop button to stop it. The animation on this plot has been slowed down for visual aesthetics. On a reasonable computer, plotting is quite fast.
Such a plot is created by defining a class derived from
(which is abstract). The example shown here is the
It defines two methods,
init() method sets static properties of the plot
(title, labels, etc.)
addPoints() method is called from the body
run() method in the parent class.
run() method is called by a
thread that generates points forever (if it is allowed to).
There are still some problems with
PlotLive. The most
annoying is that this class uses the "exclusive or" drawing mode to
allow it to easily erase old points as it adds new ones. This mode,
however, introduces a number of annoying artifacts in the graph. In
particular, if marks are made at the plotted points, and lines are
drawn between points, the lines effectively erase the marks where they
intersect. Moreover, if lines or points overlap, they erase each
other. In the future we hope to replace this mechanism with one that
treats marks on the screen as graphical objects.