VertexLabels
is an option and annotation for Graph and related functions that specifies what labels and label positions should be used for vertices.
Details
- The following option settings can be used:
-
None use no vertex labels All always use vertex labels Automatic automatically label vertices "Index" use the vertex index as a label "Name" use the vertex name as a label "VertexWeight" use the vertex weight as a label {v1lbl1,v2lbl2,…} label vertex vi with lbli etc. {patt1lbl1,patt2lbl2,…} label vertices matching the pattern patti with lbli - The wrapper Labeled[v,lbl] is equivalent to Annotation[v,VertexLabels->lbl] and can be used when creating graphs in functions such as Graph etc.
- Any expression can be used as a label.
- Labeled[v,lbl,pos] and Placed[lbl,pos] can be used to place labels in relative position to the vertex box.
- The following positions pos can be used for Labeled and Placed in positioning vertex labels:
-
Tooltip, StatusArea show as tooltip or in status area on mouseover Center place label at center of vertex Before,After,Below,Above place label outside before, after, etc. Left,Right,Bottom,Top place label inside to the left, right, etc. {Before,Below},{After,Below},… place label outside at corner before/below, etc. {Left,Bottom},{Right,Bottom},… place label inside at corner left/bottom, etc. {{vx,vy},{lx,ly}} scaled position {lx,ly} in the label at scaled position {vx,vy} in the vertex
Examples
open allclose allBasic Examples (4)
Scope (18)
Label Specification (9)
VertexLabels can be used for general graphs:
Use VertexLabels in an Annotation wrapper:
Alternatively, use a Labeled wrapper:
VertexLabels works with patterns:
Label Placement (9)
Use Placed with symbolic locations to control label placement, including outside positions:
Symbolic outside corner positions:
Symbolic inside corner positions:
Use explicit coordinates to place the center of labels:
Place all labels at the upper-right corner of the vertex and vary the coordinates within the label:
Place multiple labels using Placed in a wrapper:
Any number of labels can be used:
Place multiple labels using VertexLabels:
Use the second argument to Placed to control formatting including Tooltip:
Or StatusArea:
Text
Wolfram Research (2010), VertexLabels, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexLabels.html (updated 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