Introduction

Note: Unless you wish to avoid using the GUIKit for some reason, it is recommended that you use the Super Widget Package , which contains equivalent functionality for interactive graphics, as it also makes it easy to embed your graphics in a fully-featured GUI.

This package is about genuine interactive Mathematica graphics! Mathematica lets you create superb graphics, but in essence, the graphics system is built around the concept that you create one static plot at a time and then enjoy it. This is not surprising when the definitions of the relevant functions were laid down, there simply was not enough computer resource on most machines to consider animated graphics, or graphics that respond to mouse clicks. Obviously, it is possible to create an animated plot by creating a list of graphics objects (say a list of plots), but this does not begin to tap the possibilities that exist for true interactive graphics.

In more recent times, we have seen the introduction of J/Link, and, even more recently, the GUIKit. J/Link lets you create, and control Java applications from within Mathematica. Using J/Link you can create and run interactive graphics applications, but you have to create your image using Java primitives leveraging none of the power of Mathematica graphics! Alternatively, you can put Mathematica graphics objects into a Java window, but then you can't interact with them! It is possible to attach a "mouse listener" to your Java window, and actually write Mathematica code to respond to mouse clicks yet there is no easy way to relate the mouse positions to the original graphics coordinates! Rather surprisingly, the GUIKit design does not seem to have addressed this problem, at least so far. There is also an excellent package, MathGL3D which will animate 3D objects allowing you to rotate a 3-dimentional object dynamically using the mouse. However, once again, there is no way of specifying an arbitrary interaction with the image say to use the mouse to select data points on a plot and cause those points to be included/excluded from a curve fit. The Interactive Graphics Package (IGP) is an attempt to bring really easy-to-use interactive graphics to Mathematica. Although the IGP is built upon J/Link, you can use it without any knowledge of Java. Currently, the IGP only works in 2 dimensions since there is no way to select three coordinates with a mouse! This first version of the IGP is extremely simple yet it is already possible to construct rather sophisticated programs with it, Additional features will be added as demand dictates please contact me at the above address.

Typical applications

As the user guide for this package explains, it is extremely easy to use the IGP to create a program that lets you add/remove data points on a graph. In one of the example programs a best-fit straight line is updated each time the user changes the graph.

The IGP can create windows in which a mouse drag displays a dynamic (XOR-ed) line. This makes it easy to create 'wiring up' applications such as electronic circuit creation or abstract graph construction.

Using another option, the IGP can display mouse drag operations as a dynamic (XOR-ed) rectangle. This is ideal for applications in which the user selects a small region of a graph (say to zoom in on a detail).

Complicated IGP applications can add a drop-down menu to their window, making it easy to set up a variety of 'modes'. There is also an option to temporarily hide the notebook (which can obscure a J/Link window) so that the user is focussed exclusively on the graphics window.

Obtaining the package

The IGP is available free from MathSource