Annotation[expr,data]
represents an expression expr, with annotation data.
Annotation[expr,data,"type"]
specifies the type of annotation being given.
Annotation[items,keyvalue]
associates keyvalue pairs with items in objects such as Graph, MeshRegion etc.
Annotation
Annotation[expr,data]
represents an expression expr, with annotation data.
Annotation[expr,data,"type"]
specifies the type of annotation being given.
Annotation[items,keyvalue]
associates keyvalue pairs with items in objects such as Graph, MeshRegion etc.
Details
- Annotation[expr,…] displays in a notebook as expr.
- Annotation acts as an inert wrapper for storing annotations in expressions.
- Annotation can be used with graphics or any other expression.
- With particular "type" specifications, annotations are picked up by various built-in functions:
-
"Hyperlink" hyperlink for exported image maps etc. "Mouse" annotation for MouseAnnotation "Region" regions for Rasterize, Export, etc. "Tooltip" tooltip specification for Export etc. - With keyvalue specifications, annotations are associated to items in various objects:
-
Audio time points and time intervals BoundaryMeshRegion mesh cells CSGRegion geometric regions Graph vertices and edges MeshRegion mesh cells
Examples
open all close allBasic Examples (3)
Dynamically get the annotation when the mouse enters the disk:
{Annotation[Graphics[Disk[]], "An annotation", "Mouse"], Dynamic[MouseAnnotation[]]}Graph[{Annotation[12, EdgeLabels -> "hello"], 23, 31}]AnnotationValue[%, EdgeLabels]Annotate curves in a plot and display a label when the mouse pointer is over a curve:
Plot[{Annotation[Sin[x], "Sine", "Mouse"], Annotation[Cos[x], "Cosine", "Mouse"]}, {x, 0, 2π}, PlotLabel -> Dynamic[MouseAnnotation[""]]]Scope (8)
Basic Uses (5)
Store annotations in an expression:
a = Table[Annotation[i, PrimeQ[i]], {i, 20}]Retrieve expressions with specific annotations:
Cases[a, Annotation[_, True]]Graph[{Annotation[12, EdgeLabels -> "hello"], 23, 31}]Plot[{Annotation[Sin[x], "Sine", "Mouse"], Annotation[Cos[x], "Cosine", "Mouse"]}, {x, 0, 2π}, PlotStyle -> Thick]Dynamic[MouseAnnotation[]]Add a hyperlink to any part of the expression when converting to an HTML file:
g = Graphics[{Annotation[Disk[], "http://www.wolfram.com", "Hyperlink"], Disk[{2, 2}]}];Export["test.html", g]Use Rasterize to find the position of the annotated object within the image:
g = Graphics[{Annotation[Disk[{0, 0}], "Disk1", "Region"], Disk[{2, 2}]}, ImageSize -> 50];Rasterize[g, "Regions"]Specifications (3)
Annotation[1, "one"]Specify the type of annotation:
Annotation[Graphics[Disk[]], "An annotation", "Mouse"]Dynamic[MouseAnnotation[]]Associate key and value pairs to objects:
Graph[{Annotation[12, EdgeLabels -> "hello"], 23, 31}]Applications (6)
Graphs (2)
Build a graph with VertexSize and VertexStyle annotations on vertices:
Graph[Table[Annotation[v, {VertexSize -> 0.2 + 0.2Mod[v, 5], VertexStyle -> Hue[(v/15), 1, 1]}], {v, 0, 14}], Table[vMod[v + 1, 15], {v, 0, 14}]]Use Annotation to specify the weight for individual edges:
Graph[{12, Annotation[23, EdgeWeight -> 2], 31}, EdgeLabels -> "EdgeWeight"]The list of edge weights in the order given in the graph:
AnnotationValue[%, EdgeWeight]Export (2)
Add a hyperlink to any part of the expression when converting to an HTML file:
g = Graphics[{Annotation[Disk[], "http://www.wolfram.com", "Hyperlink"], Disk[{2, 2}]}];Export["test.html", g]Add a tooltip to any part of the expression when converting to an HTML file:
g = Graphics[{Annotation[Disk[], "A Disk", "Tooltip"], Disk[{2, 2}]}];Export["test.html", g]Rasterize (2)
g = Graphics[{Annotation[Disk[{0, 0}], "Disk1", "Region"], Disk[{2, 2}]}, ImageSize -> 50];Rasterize returns a graphical depiction of the object and is used within Export:
Rasterize[g]Use Rasterize to find the position of the annotated object within the image:
Rasterize[g, "Regions"]ras = Column[{Annotation["Disk1:", "Label", "Region"], Graphics[Disk[], ImageSize -> 100], Annotation["Text", "Explanation", "Region"]}, Alignment -> Center];Rasterize will take any expression as input:
Rasterize[ras]Automatically find the location of multiple expressions:
Rasterize[ras, "Regions"]Properties & Relations (1)
Tooltip and Hyperlink annotations can be replaced by their respective functions:
g1 = Graphics[{Annotation[Disk[], "http://www.wolfram.com", "Hyperlink"], Annotation[Disk[{2, 2}], "A Disk", "Tooltip"]}];Export[FileNameJoin[{$TemporaryDirectory, "test1.html"}], g1]g2 = Graphics[{Hyperlink[Disk[], "http://www.wolfram.com"], Tooltip[Disk[{2, 2}], "A Disk"]}];Export[FileNameJoin[{$TemporaryDirectory, "test2.html"}], g2]Tech Notes
History
Introduced in 2007 (6.0) | Updated in 2019 (12.0) ▪ 2020 (12.1) ▪ 2025 (14.2)
Text
Wolfram Research (2007), Annotation, Wolfram Language function, https://reference.wolfram.com/language/ref/Annotation.html (updated 2025).
CMS
Wolfram Language. 2007. "Annotation." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/Annotation.html.
APA
Wolfram Language. (2007). Annotation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Annotation.html
BibTeX
@misc{reference.wolfram_2026_annotation, author="Wolfram Research", title="{Annotation}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/Annotation.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_annotation, organization={Wolfram Research}, title={Annotation}, year={2025}, url={https://reference.wolfram.com/language/ref/Annotation.html}, note=[Accessed: 12-June-2026]}