Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I control the appearance of a Locator inside a Mathematica's Manipulate statement?

If I have a Manipulate statement, such as:

Manipulate[
 Graphics[Line[{{0, 0}, pt}], PlotRange -> 2], {{pt, {1, 1}}, 
  Locator}]

Mathematica graphics

How do I change the appearance of the Locator object in the easiest way possible? Do I have to resort to Dynamic statements? Specifically, I would have liked to make the Locator invisible.

like image 470
Yuval Elhanati Avatar asked Mar 15 '11 18:03

Yuval Elhanati


2 Answers

In addition to WReach's answer: In a normal Locator call its appearance can be given as one of the arguments. When used in a Manipulate this is not possible. However, Appearance can be used to draw other locator symbols.

a = Graphics[{Red, Table[Circle[{0, 0}, i], {i, 3}]}, ImageSize -> 20];
Manipulate[
 Graphics[Line[{{0, 0}, pt}], PlotRange -> 2], {{pt, {1, 1}}, Locator,
   Appearance -> a}]

Mathematica graphics

I don't think this is documented. Last year I tried finding out how to do this, but couldn't find a way. Got no response on my question on the mathematica newsgroup either.

like image 180
Sjoerd C. de Vries Avatar answered Nov 23 '22 00:11

Sjoerd C. de Vries


Try adding Appearance -> None to the Locator control:

Manipulate[
  Graphics[
    Line[{{0, 0}, pt}]
  , PlotRange -> 2
  ]
, {{pt, {1, 1}}, Locator, Appearance -> None}
]
like image 22
WReach Avatar answered Nov 23 '22 00:11

WReach