AnnotationData
Create an annotation data plot.
Syntax
model.result(<pgtag>).create(<ftag>,"AnnotationData");
model.result(<pgtag>).feature(<ftag>).set(property, <value>);
model.result(<pgtag>).feature(<ftag>).run();
Description
model.result(<pgtag>).create(<ftag>,"AnnotationData") creates an annotation data plot feature named <ftag> belonging to the 2D or 3D plot group <pgtag>.
Annotation data plots are used to visualize raw annotation data given as points, text, and colors (see the example below). Annotation data plots can be added to 2D and 3D plot groups.
Set the latexmarkup property to on if you want to include mathematical symbols and Greek letters, for example, in the annotation. To include such symbols, surround the LaTeX syntax with $ to indicate that the text inside of the $ signs is LaTeX. For example, $\alpha = \beta/\pi$ appears as α = β/π. If the latexmarkup property is on, you can also add line breaks as \\. See Mathematical Symbols and Special Characters in the COMSOL Multiphysics Reference Manual for more information about available LaTeX symbols and characters (of which most but not all are applicable in this context).
The following properties are available:
custom | black | blue | cyan | gray | green |magenta | red | white | yellow | none
custom | black | blue | cyan | gray | green |magenta | red | white | yellow
true | false
true | false
true | false
The title to use when titletype is manual.
auto | label | manual | none
auto, if the title should be computed automatically. label, if the title should be the plot group’s label. manual, if the manual title should be used (the title property). none, if no title should be displayed.
Attributes
None.
Example
A method for creating letter in a circle in 2D.
Code for Use with Java
String pgTag = model.result().uniquetag("pg");
ResultFeature pg = model.result().create(pgTag, 2);
 
for (int i = 0; i < 26; i++) {
double angle = 2*Math.PI*i/26;
ResultFeature plot = pg.create("ann"+i, "AnnotationData");
plot.set("pos", new double[]{Math.cos(angle), Math.sin(angle)})
.set("text", "ABCDEFGHIJKLMNOPQRSTUVWXYZ".substring(i, i+1))
.set("showpoint", false);
}
A method for adding Greek letters to the corners of a cube.
Code for Use with Java
String pgTag = model.result().uniquetag("pg");
ResultFeature pg = model.result().create(pgTag, 3);
 
String[] texts = {"\\alpha", "\\beta", "\\gamma", "\\delta", "\\epsilon", "\\zeta", "\\eta", "\\theta"};
String[] colors = {"black", "blue", "cyan", "gray", "green", "magenta", "red", "yellow"};
for (int x = 0; x < 2; x++) {
for (int y = 0; y < 2; y++) {
for (int z = 0; z < 2; z++) {
int index = x+2*y+4*z;
ResultFeature plot = pg.create("ann"+index, "AnnotationData");
plot.set("pos", new double[]{x, y, z})
.set("text", "$"+texts[index]+"$")
.set("latexmarkup", true)
.set("color", colors[index]);
}
}
}
See Also
ArrowData, LineData, PointData, SurfaceData, TubeData