Plot data generated in Java

The plot below shows a collection of sinusoids plotted with each sample explicitly shown with a vertical line. Like the Fourier series demo, this one uses Java code to compute the data on the fly.

No Java Plug-in support for applet, see

The source code defines a class PlotDemo derived from Plot. This class contains a sequence of Java statements in its init() method that configures and constructs the plot. This particular example also demonstrates a number of features. In particular, the X and Y ranges are given explicitly in the Java code, but note that the Y (vertical) range is insufficient to contain all the points. The lines are clipped at the boundary of the range. Clicking on the "fill" button at the upper right brings all data within range. Note further that the Y axis is labeled with explicitly given tick marks, this time placed at non-integer positions, and again given string labels. Notice also that the "impulses" or "stems" feature is turned on, causing a line to drawn from each plotted point down to the x axis. This is sometimes called a "stem plot;" it provides an alternative way to explicitly show each sample being plotted (vs. marks as in the marks demo).