Graphics Previous page   Next Page

Interactive Plotting

The ginput function enables you to use the mouse or the arrow keys to select points to plot. ginput returns the coordinates of the pointer's position, either the current position or the position when a mouse button or key is pressed. See the ginput function for more information.

Example -- Selecting Plotting Points from the Screen

This example illustrates the use of ginput with the spline function to create a curve by interpolating in two dimensions.

First, select a sequence of points, [x,y], in the plane with ginput. Then pass two one-dimensional splines through the points, evaluating them with a spacing one-tenth of the original spacing.

This plot shows some typical output.

Previous page  Displaying Contours in Polar Coordinates Animation Next page

© 1994-2005 The MathWorks, Inc.