AnnotationKeys[obj]
lists all annotation keys available for the object obj.
AnnotationKeys[{obj,itemspec}]
lists all annotation keys available for the items specified by itemspec in obj.
AnnotationKeys
AnnotationKeys[obj]
lists all annotation keys available for the object obj.
AnnotationKeys[{obj,itemspec}]
lists all annotation keys available for the items specified by itemspec in obj.
Details
- Typically used to extract names in annotations associated to an object and items in an object.
- AnnotationKeys gives the list of all names keys in key->value annotations for an object and its items.
- Possible objects with annotations include:
-
Audio audio with time and duration BoundaryMeshRegion boundary mesh with cells CSGRegion geometric regions Graph graph with vertices and edges MeshRegion mesh region with cells - Item specification itemspec for each object obj is given in its reference page.
- Option names associated with an object obj are standard annotations for obj except AnnotationRules.
Examples
open all close allBasic Examples (3)
Get a list of standard annotations in a graph:
g = ExampleData[{"NetworkGraph", "FlorentineFamilies"}]AnnotationKeys[g]AnnotationKeys[{g, "Medici"}]AnnotationKeys[{g, "Medici""Ridolfi"}]Test for the presence of MeshCellMarker annotations in cells of dimension 1:
mr = MengerMesh[2, MeshCellMarker -> {{1, 1} -> 1, {1, 2} -> 2, {1, 3} -> 3}]MemberQ[AnnotationKeys[{mr, 1}], MeshCellMarker]Get the marker of the cell with index {1,1}:
AnnotationValue[{mr, {1, 1}}, MeshCellMarker]Automatically compute annotations for an Audio object:
a = AudioAnnotate[Import["ExampleData/rule30.wav"], "Loud"];AnnotationKeys[a]Retrieve annotations for louder intervals:
AnnotationValue[a, "Loud"]Scope (8)
Graphs & Networks (6)
AnnotationKeys applies to vertices:
Graph[{Annotation[1, {VertexWeight -> 4, "Material" -> "Wood"}], 2, 3}, {12, 23, 31}]AnnotationKeys[{%, 1}]Graph[{1, 2, 3}, {Annotation[12, EdgeLabels -> "hello"], 23, 31}]AnnotationKeys[{%, 12}]AnnotationKeys works with undirected graphs:
CycleGraph[5, VertexShapeFunction -> "Name"];AnnotationKeys[{[image], 12}]CycleGraph[5, DirectedEdges -> True, EdgeStyle -> Arrowheads[Small], VertexShapeFunction -> "Name"];AnnotationKeys[{[image], 12}]Module[{g},
g = Graph[Range[5], {12, 15, 23, 34, 45, 45, 45}, VertexCoordinates -> GraphEmbedding[CycleGraph[5]], VertexShapeFunction -> "Name", PerformanceGoal -> "Quality"];
MapThread[(AnnotationValue[{g, #1}, EdgeStyle] = #2)&, {EdgeList[g], {Gray, Blue, Red, Green, Brown, Brown, Brown}}];
g]AnnotationKeys[{%, 34}]Module[{g},
g = Graph[Range[5], {12, 15, 23, 34, 45}, VertexCoordinates -> GraphEmbedding[CycleGraph[5]], VertexShapeFunction -> "Name", PerformanceGoal -> "Quality"];
MapThread[(AnnotationValue[{g, #1}, EdgeStyle] = #2)&, {EdgeList[g], {Gray, Blue, Red, Green, Brown}}];
g]AnnotationKeys[{%, 15}]With[{g = CycleGraph[5], w = 0.3Range[5],
pl = {Right, Above, Above, Right, Above} /. {Right -> {1 / 2, {-0.4, 1 / 2}}, Above -> {1 / 2, {1 / 2, 0}}}},
Graph[VertexList[g], EdgeList[g], EdgeWeight -> w, VertexShapeFunction -> "Name", EdgeLabels -> Thread[EdgeList[g] -> MapThread[Placed, {w, pl}]], VertexCoordinates -> GraphEmbedding[g]]];AnnotationKeys[{[image], 12}]Regions (2)
AnnotationKeys applies to CSGRegion objects:
CSGRegion["Union", {Ball[], Cuboid[]}]AnnotationKeys[%]CSGRegion["Union", {Ball[], Cuboid[]}]AnnotationKeys[{%, {1}}]AnnotationKeys returns both standard and user-defined annotation keys:
CSGRegion["Union", {Annotation[Ball[], "Material" -> "Wood"], Cuboid[]}]AnnotationKeys[{%, {1}}]Properties & Relations (6)
Use Annotation as a wrapper to specify annotations in functions such as Graph:
Graph[{Annotation[1, {VertexSize -> Medium, VertexStyle -> Red}], 2, 3}, {12, 23, 31}]Use AnnotationValue to extract values:
g = CompleteGraph[4, VertexStyle -> {1 -> Red}, VertexSize -> Small]AnnotationValue[{g, 1}, VertexStyle]For undefined annotations, the value $Failed is returned:
AnnotationValue[{g, 1}, "foo"]MemberQ[AnnotationKeys[{g, 1}], "foo"]Use AnnotationValue to set annotations in a graph:
g = CompleteGraph[4]AnnotationValue[{g, 1}, VertexSize] = Small;The original graph has changed:
gUse AnnotationValue to unset annotations in a graph:
g = CompleteGraph[4, VertexSize -> {1 -> Small}]AnnotationValue[{g, 1}, VertexSize]=.;The original graph has changed:
gUse Annotate to set the annotations in a new graph:
g = CompleteGraph[4]Annotate[{g, 1}, VertexSize -> Small]The original graph is unchanged:
gUse AnnotationDelete to remove an annotation without changing the original:
g = CompleteGraph[4, VertexSize -> {1 -> Small}]AnnotationDelete[{g, 1}, VertexSize]The original graph is unchanged:
gRelated Guides
Text
Wolfram Research (2020), AnnotationKeys, Wolfram Language function, https://reference.wolfram.com/language/ref/AnnotationKeys.html (updated 2025).
CMS
Wolfram Language. 2020. "AnnotationKeys." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/AnnotationKeys.html.
APA
Wolfram Language. (2020). AnnotationKeys. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AnnotationKeys.html
BibTeX
@misc{reference.wolfram_2026_annotationkeys, author="Wolfram Research", title="{AnnotationKeys}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/AnnotationKeys.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_annotationkeys, organization={Wolfram Research}, title={AnnotationKeys}, year={2025}, url={https://reference.wolfram.com/language/ref/AnnotationKeys.html}, note=[Accessed: 12-June-2026]}