Annotations

Annotation

class tecplot.annotation.Annotation(uid, frame, annotation_object_type)[source]

An Annotation is a Text object which is attached to a frame

Text

class tecplot.annotation.Text(uid, frame)[source]

Text annotation

anchor

Get or set the anchor style for a text object.

Type:TextAnchor

Specify the anchor point, or fixed point, for the text object. As the text object grows or shrinks, the anchor location is fixed, while the rest of the box adjusts to accommodate the new size. (default = TextAnchor.Left)

There are nine possible anchor position points, corresponding to the left, right, and center positions on the headline, midline, and baseline of the text box.

Example showing how to set the anchor of a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text('abc')
>>> text.anchor = TextAnchor.Center
>>> text.anchor
TextAnchor.Center
Raises:TecplotLogicError
anchor_position
Get or set the anchor coordinate position (e.g., origin)
of the annotation object in the current coordinate system.
Type:2-tuple of floats

x: X or Theta Position (default = 0.0) y: Y or R Position, (default = 0.0)

Example showing how to set the anchor position of a text object:

>>> import tecplot as tp
>>> text = tp.active_frame().add_3d_text("abc")
>>> text.anchor_position = (1.0, 2.0)
>>> text.anchor_position.x
1.0
>>> text.anchor_position.y
2.0
Raises:TecplotLogicError
angle

Get or set the text angle in degrees for a text object

Type:float in degrees.

The text angle is the orientation of the text relative to the axis. The angle is measured in degrees counter-clockwise from horizontal. Horizontal text is at zero degrees; vertical text is at 90 degrees.

Example showing how to set the angle of a text object:

>>> import tecplot as tp
>>> text = tp.active_frame().add_text('abc')
>>> text.angle = 45
>>> text.angle
45.0
Raises:TecplotLogicError
attached

Indicate if the annotation object should be attached to a zone or map. (default = False)

Type:boolean

Example showing how to set the attached property of of a text object:

>>> import tecplot as tp
>>> text = tp.active_frame().add_text("abc")
>>> text.zone_or_map = 1
>>> text.attached = True
>>> text.zone_or_map
1
>>> text.attached
True
Raises:TecplotLogicError
bold

Get or set bold typeface of the text object

Type:boolean

Example showing how to set the bold property of a text object:

>>> import tecplot as tp
>>> text = tp.active_frame().add_text('abc')
>>> text.font_family = 'Times'
>>> text.bold = True
>>> text.bold
True
Raises:TecplotLogicError
clipping
Get or set the clipping properties of the
annotation object
Type:Clipping

Clipping refers to displaying only that portion of an object that falls within a specified clipping region of the plot. (default = Clipping.ClipToViewport)

If you have specified your text position in the Frame coordinate system, the annotation object will be clipped to the frame.

If you have specified the Grid coordinate system, you can choose to clip your annotation object to the frame or the viewport.

The size of the viewport depends on the plot type as follows:

  • 3D Cartesian - The viewport is the same as the frame, so viewport clipping is the same as frame clipping.
  • 2D Cartesian/XY Line - The viewport is defined by the extents of the X and Y axes.
  • Polar Line/Sketch - By default, the viewport is the same as the frame.

Example showing how to set the clipping of a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text('abc')
>>> text.clipping = Clipping.ClipToFrame
>>> text.clipping
Clipping.ClipToFrame
Raises:TecplotLogicError
color

Get or set the color of the annotation object. (default = Color.Black)

Type:Color

Example showing how to set the color of of a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text("abc")
>>> text.color = Color.Blue
>>> text.Color
Color.Blue
Raises:TecplotLogicError
font_family

Get or set the font_family used by the text object.

Type:string

For consistency across various platforms, Tecplot 360 EX guarantees that the following standard typeface family names are available:

  • “Helvetica”
  • “Times”
  • “Courier”
  • “Greek”
  • “Math”
  • “User Defined”.

Other typeface family names may or may not be available depending on the TrueType fonts available. If the typeface family name or style is not available, a suitable replacement will be selected.

Example showing how to set the font family of a text object to ‘Times’:

>>> import tecplot as tp
>>> text = tp.active_frame().add_text('abc')
>>> text.font_family = 'Times'
>>> text.font_family
'Times'
Raises:TecplotLogicError
italic

Get or set italic typeface of the text object

Type:boolean

Example showing how to set the italic property of a text object:

>>> import tecplot as tp
>>> text = tp.active_frame().add_text('abc')
>>> text.font_family = 'Times'
>>> text.italic = True
>>> text.italic
False
Raises:TecplotLogicError
line_spacing

Get or set the line spacing for the text object

Type:float

Line spacing is dependent on the height of the text and the size unit system in which it is drawn. (default = 1.0)

Example showing how to set the line spacing of a text object:

>>> import tecplot as tp
>>> text = tp.active_frame().add_text('abc')
>>> text.line_spacing = 4
>>> text.line_spacing
4.0
Raises:TecplotLogicError
position_coordinate_system

Get or Set the position coordinate system of the text object.

The text object may be positioned using either the grid coordinate system or the frame coordinate system.

If the position_coordinate_system is CoordSys.Frame, then the size_units property must be Units.Frame or Units.Point.

The text object’s position and text height are adjusted so that it remains identical to its visual appearance in the original coordinate and unit system.

Type:CoordSys, must be either CoordSys.Frame or CoordSys.Grid

If the size units are Units.Grid and the position coordinate system is changed to CoordSys.Frame, then the size units will be changed to Units.Frame. (default = CoordSys.Frame)

Example showing how to set the position coordinate system for a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text("abc")
>>> text.position_coordinate_system = CoordSys.Grid
>>> text.position_coordinate_system
CoordSys.Grid

Example showing side effect if size units are CoordSys.Grid and the coordinate system is changed to CoordSys.Frame:

>>> import tecplot as tp
>>> text = tp.active_frame().add_text("abc")
>>> text.size_units = Units.Grid
>>> text.size_units
Units.Grid
>>> # Setting the coord sys to frame will change the units to frame.
>>> text.position_coordinate_system = CoordSys.Frame
>>> text.position_coordinate_system
CoordSys.Frame
>>> text.size_units
Units.Frame
scope

Get or Set the scope of the annotation object.

Type:Scope

Annotations with local scope are displayed only in the frame in which they are created. If the annotation is defined as having global scope, it will appear in all “like” frames. That is, those frames using the same data set as the one in which the annotation was created. (default = Scope.Local)

Example showing how to set the scope of a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text("abc")
>>> text.scope = Scope.Global
>>> text.scope
Scope.Global
Raises:TecplotLogicError
size

Get or set the text size in the currently defined text size units.

Type:integer

Example showing how to set the text size of a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text('abc')
>>> text.size_units = Units.Point
>>> text.size = 14
>>> text.size
14
Raises:TecplotLogicError
size_units

Specify the units of the text character size.

Type:Units

Units may be one of the following:

  • Units.Point: Specify character height in points.
  • Units.Frame: Specify character height as a percentage of frame height
  • Units.Grid: Specify character height in grid units.

(default = Units.Point)

Notes::

Example showing how to set the units of the character height for a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text("abc")
>>> text.position_coordinate_system = CoordSys.Grid
>>> text.size_units = Units.Point
>>> text.size_units
Units.Point
Raises:TecplotLogicError
text_box

Get the text box for this Text object.

The text box is a box that is drawn around the text. Note that in order to show the text box, you must set TextBox.type to a value other than TextBox.None.
Type:TextBox

Note: This property is read-only.

Example showing how to enable the text box::

for a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text("abc")
>>> text.text_box.type = TextBox.Filled # Show the text box
Raises:
TecplotLogicError
text_string

Get or set the text string of the text object

Type:string

You can embed Greek, Math, and User-defined characters into English-font strings by enclosing them with text formatting tags, together with the keyboard characters.

The text formatting tags and their effects are as follows (format tags are not case sensitive and may be either upper or lower case):

  • <b>...</b> - Boldface
  • <i>...</i> - Italic
  • <verbatim>...</verbatim> - Verbatim
  • <sub>...</sub> - Subscripts
  • <sup>...</sup> - Superscripts
  • <greek>...</greek> - Greek font.
  • <math>...</math> - Math font.
  • <userdef>...</userdef> - User-defined font.
  • <helvetica>...</helvetica> - Helvetica font.
  • <times>...</times> - Times font.
  • <courier>...</courier> - Courier font.

Not all fonts have Bold and/or Italic variants. For fonts that do not have these styles, the <b> and/or <i> tags may have no effect.

Embedding and escaping special characters work only in English-font text; they have no effect in text created in Greek, Math, or User-defined character sets.

You can produce subscripts or superscripts by enclosing any characters with <sub>...</sub> or <sup>...</sup>, respectively. Tecplot 360 EX has only one level of superscripts and subscripts. Expressions requiring additional levels must be created by hand using multiple text objects. If you alternate subscripts and superscripts, Tecplot 360 EX positions the superscript directly above the subscript. To produce consecutive superscripts, enclose all superscript characters in a single pair of tags.

To insert a tag into text literally, precede the first angle bracket with a backslash (“”). To insert a backslash in the text, just type two backslashes (“”).

Example showing how to set the text string of a text object:

>>> import tecplot as tp
>>> text = tp.active_frame().add_text('abc')
>>> text.text_string
'abc'
>>> text.text_string ='def'
>>> text.text_string
'def'
Raises:
zone_or_map

Get or set the zone or map Index to which the annotation object is associated (if it is attached). (Default: no default)

Type:Index

Example showing how to set the zone or map Index of a text object:

>>> import tecplot as tp
>>> text = tp.active_frame().add_text("abc")
>>> text.zone_or_map = 1
>>> text.zone_or_map
1
Raises:TecplotLogicError
class tecplot.annotation.TextBox(uid, frame)[source]

The Box surrounding the text object

color

Get or set the outline color of the text box for a text object.

(default = Color.Black)

Type:Color
Example showing how to set the outline color of the text box

for a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text("abc")
>>> text.text_box.type = TextBox.Filled
>>> text.text_box.color = Color.Blue
>>> text.text_box.color
Color.Blue
Raises:TecplotLogicError
fill_color

Get or set the fill color of the text box for a text object. (default = Color.White)

Type:Color
Example showing how to set the fill color of the text box

for a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text("abc")
>>> text.text_box.type = TextBox.Filled
>>> text.text_box.fill_color = Color.Blue
>>> text.text_box.fill_color
Color.Blue
Raises:TecplotLogicError
line_thickness

Get or set the text box line thickness of a text object.

The line thickness must be greater than 0.0. (default = 0.1)

Type:float

Example showing how to set the line thickness of the text box for a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text("abc")
>>> text.text_box.type = TextBox.Filled
>>> text.text_box.line_thickness = 0.5
>>> text.text_box.line_thickness
0.5
Raises:TecplotLogicError
margin
Get or set the margin between the text and the

text box surrounding the text object.

Specify the margin as a percentage of the text character height. Margin must be greater than or equal to 0.0, and may be greater than 100. (default = 20.0)

type:float

Example showing how to set the margin of the text box for a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text("abc")
>>> text.text_box.type = TextBox.Filled
>>> text.text_box.margin = 0.5
>>> text.text_box.margin
0.5
Raises:TecplotLogicError
position
Get the position of the four corners of the text box

surrounding the text object.

Note: This property is read-only.

type:8-tuple of floats
  • x1: X-Coordinate for bottom left corner of the TextBox.
  • y1: Y-Coordinate for bottom left corner of the TextBox.
  • x2: X-Coordinate for bottom right corner of the TextBox.
  • y2: Y-Coordinate for bottom right corner of the TextBox.
  • x3: X-Coordinate for upper right corner of the TextBox.
  • y3: Y-Coordinate for upper right corner of the TextBox.
  • x4: X-Coordinate for upper left corner of the TextBox.
  • y4: Y-Coordinate for upper left corner of the TextBox.

(no default, position will vary with text box properties)

Example showing how to query position of the text box

for a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text("abc")
>>> text.text_box.type = TextBox.Filled
>>> x1,y1,x2,y2,x3,y3,x4,y4 = text.text_box.position
>>> # x1,...,y4 contain the corners of the text box
Raises:TecplotLogicError
text_box_type

Get or set the type of the box surrounding the text object

Type:tecplot.constant.TextBox

The text box type can be set to the following:

  • None_ - Select this option to specify that no box is drawn around

    the text.

  • Filled - Select this option to specify a filled box around the

    text. A filled box is opaque; if you place it over another Tecplot 360 EX object, the underlying object cannot be seen.

  • Hollow - Select this to specify a plain box around the text.

(default = TextBox.None_

Example showing how to set the type of the text box for a text object:

>>> import tecplot as tp
>>> from tecplot.constant import *
>>> text = tp.active_frame().add_text("abc")
>>> text.text_box.text_box_type = TextBox.Filled
>>> text.text_box.text_box_type
TextBox.Filled
Raises:TecplotLogicError