Live, Animated Plot

This page includes an applet, which may or may not run for you. See Troubleshooting for details.

The following plot illustrates a dynamically updated plot: No Java Plug-in support for applet, see http://www.java.com/

Click on the stop button to stop the plotting. 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 PlotLive (which is abstract). The example shown here is the PlotLiveDemo class. It defines two methods, init() and addPoints(). The init() method sets static properties of the plot (title, labels, etc.) while the addPoints() method is called repeatedly from the body of the run() method in the parent class.

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 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.