This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Locator

Locator
represents a locator object at position in a graphic.
Locator[Dynamic[pos]]
takes the position to be the dynamically updated current value of pos, with this value being reset if the locator object is moved.
Locator
displays obj as the locator object.
Locator[{x, y}, None]
displays nothing visible as the locator object.
  • Locator[{x, y}, Automatic] uses the default "crosshairs" appearance for the locator object.
  • Locator[Dynamic[{x, y}]] will reset the values of x and y when the locator object is moved; Locator will not.
  • Locator objects that appear inside Deploy[expr] can still be manipulated interactively, just like, for example, Slider objects. »
  • If obj does not define its own absolute size, its size when used as a locator object can be specified using the ImageSize option of Locator.
  • The center of the locator object is taken to be the setting for the AlignmentPoint option of obj, or by default, the center of the bounding box for obj.
  • The following options can be given:
AppearanceAutomaticbasic appearance of the locator
AutoActionFalsewhether to move automatically when the mouse is over the graphic
EnabledAutomaticwhether the locator is enabled, or grayed out
ImageSizeAutomaticthe size of the displayed locator object
LocatorRegionAutomaticwhere the locator object should be allowed to go
  • Locator can be used to specify the control for a variable in Manipulate, to indicate that the value of the variable should be determined by the position of a locator. »
Set up a locator that can move in a graphic:
Set up locator that defines the value of :
Put a locator in a Manipulate:
Set up a locator that can move in a graphic:
In[1]:=
Click for copyable input
Out[1]=
 
Set up locator that defines the value of :
In[1]:=
Click for copyable input
Out[1]=
 
Put a locator in a Manipulate:
Use an expression as a locator object:
Use a graphic as a locator object:
Invisible locator:
Zero-argument form for a locator:
Use Deploy to disable interactive graphics editing, but preserve locator interactivity:
The movement of locators can be constrained by Dynamic:
Use Scaled coordinates for the locator:
Specify the type of appearance:
By default, no locator values change until you drag the locator:
When AutoAction is set, the locator values change as the mouse moves over the locator:
Change the background colors:
Change the background color dynamically:
By default, Locator is enabled:
By setting Enabled->False, the locator is disabled but visible in its current state:
Use predefined locator sizes:
Or use any values:
By default, Locator is constrained within the PlotRange:
Use LocatorRegion->Full to access all of the graphics:
Dynamic tracking functions can be used to constrain locator movement:
A simple, interactive length and slope display:
Use Deploy to restrict graphics interactivity while keeping the locators active:
Use LocatorPane to use locators on complex objects:
Without a fixed PlotRange, the plot range will adapt as the locator moves:
The position of a locator in graphics determines whether it is visible:
Make the points follow the locator:
Transform the circle using a matrix defined by the coordinates of two locators:
Compute a Julia set for a mapping defined by a locator position:
New in 6