Locator controls are 2D markers that you can drag directly in the contents of graphics or other backgrounds to obtain the coordinates of points.

In a Manipulate...

Add a locator control to a Manipulate by giving an initial coordinate position and specifying control type Locator:

Add multiple locators by giving a list of initial positions:

  • Locators can be used in combination with any other control types in Manipulate.

In Graphics...

To use a locator in Graphics, wrap a Graphics expression with DynamicModule and initialize a locator variable there. Add a Locator object to the graphic to control the value of the locator variable, and use the variable in other Graphics elements to make them respond when the locator is dragged. All uses of the locator variable must be wrapped with Dynamic:

On an Arbitrary Background...

You can use a locator on any backgroundgraphic, image, text or expressionwith LocatorPane. Initialize a locator variable in a DynamicModule and control the value of the variable in a LocatorPane object, specifying the background in the second argument. All uses of the locator variable must be wrapped with Dynamic:

To add multiple locators to a background, initialize the LocatorPane variable with a list of positions:

  • The default LocatorPane coordinate system is that of the background object when the background is a graphic or an image. The default LocatorPane coordinate system ranges from 0 to 1 along each dimension when the background is text or an expression.