如何在Mathematica的Manipulate语句中控制Locator的外观?

Yuv*_*ati 6 wolfram-mathematica

如果我有一个Manipulate语句,例如:

Manipulate[
 Graphics[Line[{{0, 0}, pt}], PlotRange -> 2], {{pt, {1, 1}}, 
  Locator}]
Run Code Online (Sandbox Code Playgroud)

Mathematica图形

如何以最简单的方式更改Locator对象的外观?我是否必须采用动态声明?具体来说,我本来希望使定位器不可见.

Sjo*_*ies 7

除了WReach的回答:在正常Locator调用中,它的外观可以作为参数之一给出.当用于Manipulate此时是不可能的.但是,Appearance可以用于绘制其他定位符号.

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}]
Run Code Online (Sandbox Code Playgroud)

Mathematica图形

我不认为这是记录在案的.去年我试图找出如何做到这一点,但找不到办法.我对mathematica新闻组的问题也没有回应.


WRe*_*ach 5

尝试添加Appearance -> None到定位器控件:

Manipulate[
  Graphics[
    Line[{{0, 0}, pt}]
  , PlotRange -> 2
  ]
, {{pt, {1, 1}}, Locator, Appearance -> None}
]
Run Code Online (Sandbox Code Playgroud)