Annotate

Annotate[obj,keyvalue]

sets the annotation keyvalue for the object obj.

Annotate[{obj,itemspec},keyvalue]

sets the annotation for the items in obj specified by itemspec.

Details

  • Typically used to store key->value pairs for an object or items in an object.
  • Annotate returns the specified object with a new or modified annotation.
  • Possible objects with items that can be annotated:
  • Audiotime points and time intervals
    BoundaryMeshRegionmesh cells
    Graphvertices and edges
    MeshRegionmesh cells
  • Item specification itemspec for each type of object is given in its reference page.

Examples

open allclose all

Basic Examples  (2)

Specify a vertex or edge annotation:

To label a vertex:

To style an edge:

Highlight boundary cells in a mesh:

Scope  (11)

Graph & Networks  (11)

Graph annotations  (7)

Set annotations for vertices:

And edges:

Set several annotations for a vertex:

And for an edge:

Annotate works with undirected graphs:

Directed graphs:

Multigraphs graphs:

Mixed graphs:

Weighted graphs:

Vertex annotations  (2)

Standard vertex annotations include VertexStyle:

VertexLabels:

VertexSize:

VertexShape:

VertexShapeFunction:

Non-visual annotations include VertexWeight:

Set a custom annotation:

Edge annotations  (2)

Standard edge annotations include EdgeStyle:

EdgeLabels:

EdgeShapeFunction:

Non-visual annotations include EdgeWeight:

Set a custom annotation:

Applications  (3)

Use Fold to apply Annotate repeatedly:

See all the partial results:

Create a graph:

Temporarily highlight one vertex:

Then another:

Highlight the edges visited during a breadth-first scan:

Properties & Relations  (6)

Use Annotation as a wrapper to specify annotations in functions such as Graph:

Use AnnotationValue to extract values:

For undefined annotations, the value $Failed is returned:

Use AnnotationValue to set annotations in a graph:

The original graph has changed:

Use AnnotationValue to unset annotations in a graph:

The original graph has changed:

Use AnnotationKeys to test for the presence of an annotation:

Generate a list of vertex label rules:

Use AnnotationDelete to remove an annotation without changing the original:

The original graph is unchanged:

Possible Issues  (1)

AnnotationValue is typically faster than Annotate:

Wolfram Research (2020), Annotate, Wolfram Language function, https://reference.wolfram.com/language/ref/Annotate.html.

Text

Wolfram Research (2020), Annotate, Wolfram Language function, https://reference.wolfram.com/language/ref/Annotate.html.

CMS

Wolfram Language. 2020. "Annotate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Annotate.html.

APA

Wolfram Language. (2020). Annotate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Annotate.html

BibTeX

@misc{reference.wolfram_2023_annotate, author="Wolfram Research", title="{Annotate}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/Annotate.html}", note=[Accessed: 20-April-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_annotate, organization={Wolfram Research}, title={Annotate}, year={2020}, url={https://reference.wolfram.com/language/ref/Annotate.html}, note=[Accessed: 20-April-2024 ]}