Graphおよび関連関数のオプションかつ注釈で,頂点に使うラベルおよびラベル位置を指定する.
VertexLabels
Graphおよび関連関数のオプションかつ注釈で,頂点に使うラベルおよびラベル位置を指定する.
詳細
- 使用可能なオプション設定
-
None 頂点ラベルは使わない All 常に頂点ラベルを使う Automatic 頂点に自動的にラベルを付ける "Index" 頂点の指標をラベルとして使う "Name" 頂点名をラベルとして使う "VertexWeight" 頂点の重みをラベルとして使う {v1lbl1,v2lbl2,…} 頂点 viに lbliというラベルを付ける {patt1lbl1,patt2lbl2,…} パターン pattiと一致する頂点にラベル lbliを付ける - ラッパーLabeled[v,lbl]はAnnotation[v,VertexLabels->lbl]に等しく,Graph等の関数でグラフを作成する際に使うことができる.
- 任意の式がラベルとして使える.
- Labeled[v,lbl,pos]とPlaced[lbl,pos]を使って頂点ボックスの相対的な位置にラベルを置くことができる.
- 次の位置 pos は頂点ラベルの位置を決める際のLabeledとPlacedに使うことができる.
-
Tooltip, StatusArea マウスオーバーでツールチップとしてあるいは状態エリアとして示す Center 頂点の中心にラベルを置く Before,After,Below,Above 前,後等の外側にラベルを置く Left,Right,Bottom,Top ラベルを左,右等の内側に置く {Before,Below},{After,Below},… ラベルを前/下等のコーナーの外側に置く {Left,Bottom},{Right,Bottom},… ラベルを左/下等のコーナーの内側に置く {{vx,vy},{lx,ly}} 頂点の中のスケールされた位置{vx,vy}にあるラベルの中のスケールされた位置{lx,ly}
例題
すべて開く すべて閉じる例 (4)
Graph[{12, 23, 31}, VertexLabels -> {1 -> "one"}]CompleteGraph[5, VertexLabels -> Table[i -> Subscript[v, i], {i, 5}]]Graph[{12, 23, 31}, VertexLabels -> {1 -> [image], 2 -> [image], 3 -> Sin[x]}]RandomGraph[{10, 20}, VertexLabels -> Placed[Automatic, Center], VertexSize -> .75]スコープ (18)
ラベル指定 (9)
CompleteGraph[5, VertexLabels -> "Name"]CompleteGraph[3, VertexLabels -> Placed["Name", Before]]Graph[{ab, bc, ca}, VertexLabels -> "Index"]Graph[{ab, bc, ca}, VertexWeight -> {3, 2, 1}, VertexLabels -> "VertexWeight"]VertexLabelsは一般的なグラフに使うことができる:
{Graph[{12, 23, 31}, VertexLabels -> {1 -> "Hello"}], PathGraph[Range[20], VertexLabels -> {1 -> "Hello"}]}AdjacencyGraph[{{0, 1, 1}, {1, 0, 1}, {1, 1, 0}}, VertexLabels -> {1 -> "Hello"}]{PetersenGraph[5, 2, VertexLabels -> {7 -> "Hello"}], GridGraph[{3, 4}, VertexLabels -> {5 -> "Hello"}]}RandomGraph[UniformGraphDistribution[5, 7], VertexLabels -> {1 -> "Hello"}]VertexLabelsをAnnotationラッパーの中で使う:
Graph[{Annotation[1, VertexLabels -> "Hello"], 2, 3}, {12, 23, 31}]HighlightGraph[GridGraph[{3, 3}], Annotation[5, VertexLabels -> "Hello"]]あるいはLabeledラッパーを使う:
Graph[{Labeled[1, "Hello"], 2, 3}, {12, 23, 31}]VertexLabelsはパターンを使うことができる:
CompleteGraph[5, VertexLabels -> {_ ? OddQ -> "Name"}]ラベルの置き方 (9)
Placedを記号位置とともに使ってラベルの置き方(外側の位置も含む)を制御する:
Table[Graph[{12, 23, 31}, VertexSize -> 0.2, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], p], {i, 3}], PlotLabel -> p, BaselinePosition -> Axis], {p, {Before, After, Below, Above}}]pl = {{Before, Below}, {After, Below}, {Before, Above}, {After, Above}};Table[Graph[{12, 23, 31}, VertexSize -> 0.2, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], p], {i, 3}], PlotLabel -> p, BaselinePosition -> Axis], {p, pl}]Table[Graph[{12, 23, 31}, VertexSize -> 0.2, VertexLabels -> Table[i -> Placed[[image], p], {i, 3}], VertexShapeFunction -> "Square", PlotLabel -> p, BaselinePosition -> Axis], {p, {Left, Top, Right, Bottom}}]pl = {{Left, Bottom}, {Right, Bottom}, {Left, Top}, {Right, Top}};Table[Graph[{12, 23, 31}, VertexSize -> 0.2, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], p], {i, 3}], PlotLabel -> p, BaselinePosition -> Axis], {p, pl}]Table[Graph[{12, 23, 31}, VertexSize -> 0.2, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], p], {i, 3}], PlotLabel -> p, BaselinePosition -> Axis], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]すべてのラベルを頂点の右上コーナーに置き,ラベル内の座標を変化させる:
Table[Graph[{12, 23, 31}, VertexSize -> 0.2, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], {{1, 1}, p}], {i, 3}], PlotLabel -> p, BaselinePosition -> Axis], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]Placedをラッパー内で使って複数のラベルを置く:
Graph[{1, 2, Labeled[3, Placed[{"lbl1", "lbl2"}, {Above, Below}]]}, {12, 23, 31}]Graph[{1, 2, Labeled[3, Placed[{"lbl1", "lbl2", "lbl3", "lbl4"}, {Above, After, Below, Before}]]}, {12, 23, 31}]VertexLabelsを使って複数のラベルを置く:
Graph[{12, 23, 31}, VertexLabels -> {3 -> Placed[{"lbl1", "lbl2"}, {Above, Below}]}]Placedの第2引数を使ってTooltipを含むフォーマットを制御する:
Graph[{12, 23, 31}, VertexLabels -> Placed["Name", Tooltip]]あるいはStatusAreaを含むフォーマットを制御する:
Graph[{12, 23, 31}, VertexLabels -> Placed["Name", StatusArea]]rotateLabel[lbl_] := Rotate[lbl, 45Degree]Graph[{12, 23, 31}, VertexLabels -> Table[i -> Placed["xxx", Below, rotateLabel], {i, 3}]]panelLabel[lbl_] := Panel[lbl, FrameMargins -> 0, Background -> Lighter[Gray, 0.6]]Graph[{12, 23, 31}, VertexLabels -> Table[i -> Placed["xxx", Center, panelLabel], {i, 3}]]hyperlinkLabel[lbl_] := Hyperlink[lbl, "http://www.wolfram.com", Background -> White]Graph[{12, 23, 31}, VertexLabels -> Table[i -> Placed["xxx", Center, hyperlinkLabel], {i, 3}]]関連するガイド
-
▪
- グラフのスタイル付け,ラベル付け,配置 ▪
- グラフの可視化 ▪
- グラフの特性 ▪
- グラフのアノテーション ▪
- 特性 ▪
- アノテーション ▪
- ラベル
テキスト
Wolfram Research (2010), VertexLabels, Wolfram言語関数, https://reference.wolfram.com/language/ref/VertexLabels.html (2015年に更新).
CMS
Wolfram Language. 2010. "VertexLabels." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/VertexLabels.html.
APA
Wolfram Language. (2010). VertexLabels. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexLabels.html
BibTeX
@misc{reference.wolfram_2026_vertexlabels, author="Wolfram Research", title="{VertexLabels}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/VertexLabels.html}", note=[Accessed: 11-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_vertexlabels, organization={Wolfram Research}, title={VertexLabels}, year={2015}, url={https://reference.wolfram.com/language/ref/VertexLabels.html}, note=[Accessed: 11-November-2026]}