LocatorPane[{x,y},back]
{x,y}の位置にあるロケータと背景 back を含むペインを示す.
LocatorPane[Dynamic[pt],back]
動的に更新される pt の現行値をロケータの位置とする.ロケータが移動されると pt はリセットされる.
LocatorPane[{pt1,pt2,…},back]
位置 pt1, pt2, …にある複数のロケータを設定する.
LocatorPane[Dynamic[{pt1,pt2,…}],back]
ロケータ位置を動的に更新される pti の現行値とする.
LocatorPane[pts,back,{{xmin,ymin},{xmax,ymax}}]
ロケータ座標の範囲を指定する.
LocatorPane[pts,back,{{xmin,ymin},{xmax,ymax},{dx,dy}}]
ジャンプ dx, dy を使う.
LocatorPane
LocatorPane[{x,y},back]
{x,y}の位置にあるロケータと背景 back を含むペインを示す.
LocatorPane[Dynamic[pt],back]
動的に更新される pt の現行値をロケータの位置とする.ロケータが移動されると pt はリセットされる.
LocatorPane[{pt1,pt2,…},back]
位置 pt1, pt2, …にある複数のロケータを設定する.
LocatorPane[Dynamic[{pt1,pt2,…}],back]
ロケータ位置を動的に更新される pti の現行値とする.
LocatorPane[pts,back,{{xmin,ymin},{xmax,ymax}}]
ロケータ座標の範囲を指定する.
LocatorPane[pts,back,{{xmin,ymin},{xmax,ymax},{dx,dy}}]
ジャンプ dx, dy を使う.
詳細とオプション
- ロケータペインの背景はグラフィックスでも任意の式でもよい.
- Graphicsオブジェクト g について,LocatorPane[pt,g]はデフォルトで,pt の座標範囲を g におけるPlotRangeに対応するグラフィックスの座標範囲であるとする.
- 一般的な式については,LocatorPane[pt,expr]は pt の座標範囲が各方向に0から1であるとする.
- 次のオプションを使うことができる.
-
Appearance Automatic ロケータの外観 AutoAction False マウスが上に来たときに,ロケータを自動的に動かすかどうか BaselinePosition Automatic 周囲のテキストのベースラインとどのように揃えるか BaseStyle {} ロケータペインのベーススタイル指定 ContinuousAction True ロケータが動かされている間,継続的に更新するかどうか Enabled Automatic ロケータペインを有効にするか,そのロケータを無効(灰色表示)にするか Exclusions {} 除外する特定の点 LocatorAutoCreate False クリックによる新たなロケータの作成を許容するかどうか TouchscreenAutoZoom False タッチスクリーン上でアクティベートされた場合にフルスクリーンにズームするかどうか - Appearance->g の設定の場合,ロケータペイン中のすべてのロケータが g として表示される.ただし,g は任意のグラフィックスまたは他の式である. »
- Appearance->{g1,g2,…}の場合は,i
番目のロケータが gi として表示される. » - LocatorPane[{pt1,pt2,…},back,{range1,range2,…}]は,ロケータによって異なる範囲を指定する.
- LocatorPane[pts,back,range]は,デフォルトで,任意のクリックを直近のロケータに向ける.
- BaseStyleの設定値は,一般に現行スタイルシートの"LocatorPane"スタイルで与えられるデフォルトスタイルに加えられる.
例題
すべて開く すべて閉じる例 (2)
LocatorPane[{1, 1} / 2, Graphics[{Gray, Disk[]}]]LocatorPane[{{1, 1} / 2, {-1, 1} / 2, {1, -1} / 2}, Graphics[{Gray, Disk[]}]]Dynamicを使ってロケータ位置を変数と繋ぐ:
DynamicModule[{pt = {1, 1} / 2}, {LocatorPane[Dynamic[pt], Graphics[{Gray, Disk[]}]], Dynamic[pt]}]DynamicModule[{pt = {{1, 1} / 2, {-1, 1} / 2, {1, -1} / 2}}, {LocatorPane[Dynamic[pt], Graphics[{Gray, Disk[]}]], Dynamic[pt]}]スコープ (8)
LocatorPaneのコンテンツ (2)
LocatorPane[{5, 0.5}, Plot[Sin[x], {x, 0, 10}]]LocatorPane[{1, 1} / 2, Framed@Graphics[]]LocatorPane[{0.5, 0.5}, Graphics3D[Sphere[]]]LocatorPane[{.2, .6}, MatrixForm[HilbertMatrix[3]]]LocatorPaneのコントロール (6)
LocatorPane[{1, 1} / 2, Graphics[{Gray, Disk[]}], {{-1, -1} / 2, {1, 1} / 2}]LocatorPane[{1, 1} / 2, Graphics[{Gray, Disk[]}], {{-1, -1} / 2, {1, 1} / 2, {1 / 5, 1 / 5}}]LocatorPane[{1, 1} / 2, Graphics[{Gray, Disk[]}], Appearance -> Framed[x + y]]LocatorPane[{{0, 1 / 2}, {1 / 2, 0}, {0, 0}}, Graphics[{Gray, Disk[]}]]{LocatorPane[Dynamic[pt], Graphics[{Gray, Disk[]}]], Dynamic[pt]}Slider2Dに動的な設定値を接続する:
{LocatorPane[Dynamic[pt], Graphics[{Gray, Disk[]}]], Slider2D[Dynamic[pt], {-1, 1}]}オプション (15)
Appearance (3)
LocatorPane中のロケータの外観として任意の式を使う:
Table[LocatorPane[{0, 0}, Graphics[{Gray, Disk[]}], Appearance -> a], {a, {Style["", Large], "文字列", Framed[x + y], Graphics[Rectangle[], ImageSize -> 20]}}]LocatorPane[{{-1, 0}, {1, 0}, {0, 1}} / 2, Graphics[{Gray, Disk[]}], Appearance -> {Style["", Large], "文字列", Framed[x + y]}]不可視のロケータにAppearance->Noneを使う:
LocatorPane[{0, 0}, Graphics[{Gray, Disk[]}], Appearance -> None]LocatorPane[Dynamic[pt], Graphics[{Gray, Disk[], Red, PointSize[Large], Dynamic[Point[Normalize[pt]]]}, PlotRange -> 1.2], Appearance -> None]AutoAction (2)
デフォルトで,ロケータはロケータペインがクリックされるまで変化しない:
LocatorPane[{0, 0}, Graphics[{Gray, Disk[]}]]AutoActionと設定すると,ロケータはロケータペイン上をマウスが動くと変化する:
LocatorPane[{0, 0}, Graphics[{Gray, Disk[]}], AutoAction -> True]Background (2)
ContinuousAction (2)
{LocatorPane[Dynamic[pt], Graphics[{Gray, Disk[]}]], Dynamic[pt]}ContinuousActionをFalseにすると,変数はロケータが解放されたときだけ更新されるようになる:
{LocatorPane[Dynamic[pt], Graphics[{Gray, Disk[]}], ContinuousAction -> False], Dynamic[pt]}Enabled (2)
デフォルトで,LocatorPaneは有効になっている:
LocatorPane[{0, 0}, Graphics[{Gray, Disk[]}]]Enabled->Falseとすると,ロケータは無効となり現行状態が可視で残る:
LocatorPane[{0, 0}, Graphics[{Gray, Disk[]}], Enabled -> False]LocatorAutoCreate (4)
デフォルトで,ロケータペインをクリックするごとに一番近いロケータが動く:
DynamicModule[{pts = {{-1, 1} / 2, {1, 1} / 2}}, LocatorPane[Dynamic[pts], Framed@Graphics[{}]]]LocatorAutoCreate->Trueと設定すると,Alt+Clickを使ってロケータを作ったり削除したりできる:
DynamicModule[{pts = {{-1, 1} / 2, {1, 1} / 2}}, LocatorPane[Dynamic[pts], Framed@Graphics[{}], LocatorAutoCreate -> True]]LocatorAutoCreate->Allにすると,クリックごとに新たなロケータが作成される(削除にはAlt+Clickを使う):
DynamicModule[{pts = {{-1, 1} / 2, {1, 1} / 2}}, LocatorPane[Dynamic[pts], Framed@Graphics[{}], LocatorAutoCreate -> All]]すべてのロケータを通るインタラクティブなプロットを作成する:
DynamicModule[{pts = {{0, 0}, {3, 2}}}, LocatorPane[Dynamic[pts], Dynamic[Plot[InterpolatingPolynomial[pts, x], {x, 0, 3}, PlotRange -> 3]], LocatorAutoCreate -> True]]アプリケーション (6)
DynamicModule[{pt = RandomReal[{-1, 1}, {100, 2}]}, LocatorPane[Dynamic[pt], Graphics[{}, PlotRange -> 1], Appearance -> "∘"]]LocatorPane[Dynamic[pt], Plot[Sin[x], {x, 0, 10}, Epilog -> {PointSize[Large], Point[Dynamic[{First[pt], Sin[First[pt]]}]]}], Appearance -> None]CurrentValue["CurrentLocatorPaneThumb"]を使って点によって異なるドラッグ制限を矯正する:
DynamicModule[{pts = {{0, 0}, {1 / 2, 0}}}, {LocatorPane[Dynamic[pts, Switch[CurrentValue["CurrentLocatorPaneThumb"], 1, pts[[1, 2]] = #[[1, 2]], 2, pts[[2]] = #[[2]]]&], Graphics[{Gray, Disk[]}]], Dynamic[pts]}]DynamicModule[{pt = {1, 0}, A = (| | |
| ---- | --- |
| -1.1 | 0.9 |
| -1.4 | 0.3 |)}, LocatorPane[Dynamic[pt], Dynamic@ParametricPlot[MatrixExp[A t, pt], {t, 0, 10}, PlotRange -> 5]]]DynamicModule[{pts = {{0, 0}, {1, 1}, {2, 0}, {3, 2}}}, LocatorPane[Dynamic[pts], Dynamic[Plot[InterpolatingPolynomial[pts, x], {x, 0, 3}, PlotRange -> 3]]]]インタラクティブな3つの点の円 [詳細]:
createCircle[{{x1_, y1_}, {x2_, y2_}, {x3_, y3_}}] := With[{a = Det[(| | | |
| -- | -- | - |
| x1 | y1 | 1 |
| x2 | y2 | 1 |
| x3 | y3 | 1 |)], d = -Det[(| | | |
| ----------- | -- | - |
| x1^2 + y1^2 | y1 | 1 |
| x2^2 + y2^2 | y2 | 1 |
| x3^2 + y3^2 | y3 | 1 |)], e = Det[(| | | |
| ----------- | -- | - |
| x1^2 + y1^2 | x1 | 1 |
| x2^2 + y2^2 | x2 | 1 |
| x3^2 + y3^2 | x3 | 1 |)], f = -Det[(| | | |
| ----------- | -- | -- |
| x1^2 + y1^2 | x1 | y1 |
| x2^2 + y2^2 | x2 | y2 |
| x3^2 + y3^2 | x3 | y3 |)]}, Circle[{-(d/2 a), -(e/2 a)}, Sqrt[(d^2 + e^2/4a^2) - (f/a)]]]DynamicModule[{pts = {{-1, 0}, {1, 0}, {1, 1}}}, LocatorPane[Dynamic[pts], Framed@Graphics[{Dynamic[createCircle[pts]], Point[Dynamic[pts]]}, PlotRange -> 5]]]特性と関係 (2)
LocatorPaneはEventHandlerの特殊ケースである:
DynamicModule[{pt = {0, 0}}, LocatorPane[Dynamic[pt], Framed@Graphics[{}, PlotRange -> 10]]]DynamicModule[{pt = {0, 0}}, Deploy@EventHandler[Framed@Graphics[Disk[Dynamic[pt]], PlotRange -> 10], {"MouseDown" :> (pt = MousePosition["Graphics"]), "MouseDragged" :> (pt = MousePosition["Graphics"])}]]Settingを使ってLocatorPaneの設定値を抽出する:
Setting[LocatorPane[{1, 1} / 2, Graphics[{Gray, Disk[]}]]]Setting[LocatorPane[{{0, 1}, {1, 0}}, Graphics[{Gray, Disk[]}]]]おもしろい例題 (3)
AutoActionを使ってマウス点に最も近いロケータを選ぶ:
LocatorPane[RandomReal[{-1, 1}, {50, 2}], Graphics[{Gray, Disk[]}], Appearance -> Table[Style["●", Hue[h / 50]], {h, 50}], AutoAction -> True]DynamicModule[{pt = {0, 1}}, LocatorPane[Dynamic[pt], Graphics[{Circle[], PointSize[Large], Dynamic[Point[pt / Norm[pt]]]}], Appearance -> None]]DynamicModule[{pt = {{2, 0}, {0, 1}, {-3, 0}}, A = (| | |
| ---- | --- |
| -1.1 | 0.9 |
| -1.4 | 0.3 |)}, LocatorPane[Dynamic[pt], Dynamic@ParametricPlot[Evaluate[MatrixExp[A t, #]& /@ pt], {t, 0, 10}, PlotRange -> 5]]]テクニカルノート
関連するガイド
関連するワークフロー
- ロケータのコントロールを使う
テキスト
Wolfram Research (2007), LocatorPane, Wolfram言語関数, https://reference.wolfram.com/language/ref/LocatorPane.html (2012年に更新).
CMS
Wolfram Language. 2007. "LocatorPane." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/LocatorPane.html.
APA
Wolfram Language. (2007). LocatorPane. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LocatorPane.html
BibTeX
@misc{reference.wolfram_2026_locatorpane, author="Wolfram Research", title="{LocatorPane}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/LocatorPane.html}", note=[Accessed: 09-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_locatorpane, organization={Wolfram Research}, title={LocatorPane}, year={2012}, url={https://reference.wolfram.com/language/ref/LocatorPane.html}, note=[Accessed: 09-August-2026]}