Annotations

Text

Text

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

Text annotation.

Attributes

anchor

Anchor location of this Text object.

angle

Angle of the text box in degrees.

attached_map_index

Index of the attached fieldmap or linemap.

box

The frame and area around this Text object.

clipping

Clipping properties of the Text

color

Color of the Text object.

font

Typeface properties for a Text object.

line_spacing

Spacing between lines in the text box.

position

Anchor position of the Text.

position_coordinate_system

Position coordinate system of the Text object.

scope

The Scope (local or global) of the Text.

text_string

The text to be displayed in a text box.

type

Normal or LaTeX text type setting.

Text.anchor

Anchor location of this Text object.

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:

>>> text = frame.add_text('abc')
>>> text.anchor = tecplot.constant.TextAnchor.Center

See also

Text.position

Type:

TextAnchor

Text.angle

Angle of the text box 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:

>>> text = frame.add_text('abc')
>>> text.angle = 45
Type:

float (degrees counter-clockwise)

Text.attached_map_index

Index of the attached fieldmap or linemap.

Example showing how to set the attached object Index of a Text object:

>>> text = frame.add_text("abc")
>>> text.attached_map_index = 1
Type:

Index or None

Text.box

The frame and area around this Text object.

The text box is a rectangular frame drawn around the text. Note that in order to show the text box, you must set TextBox.type to a value other than constant.TextBox.None_.

Example showing how to enable the text box for a Text object:

>>> text = frame.add_text("abc")
>>> text.box.type = tecplot.constant.TextBox.Filled
Type:

annotation.TextBox

Text.clipping

Clipping properties of the Text

Clipping refers to displaying only that portion of an object that falls within a specified clipping region of the plot. If you have specified your text position in the Frame coordinate system, the Text will be clipped to the frame. Default: Clipping.ClipToViewport.

If you have specified the Grid coordinate system, you can choose to clip your Text 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:

>>> text = frame.add_text('abc')
>>> text.clipping = tecplot.constant.Clipping.ClipToFrame
Type:

Clipping

Text.color

Color of the Text object.

Default: Color.Black. Example showing how to set the Color of a Text object:

>>> text = frame.add_text("abc")
>>> text.color = tecplot.constant.Color.Blue
Type:

Color

Text.font

Typeface properties for a Text object.

Example usage:

>>> text = frame.add_text('abc')
>>> text.font.typeface = 'Times'
Type:

TextFont

Text.line_spacing

Spacing between lines in the text box.

Line spacing is dependent on the height of the text and the size unit system in which it is drawn. This example shows how to set the line spacing of a Text object:

>>> text = frame.add_text('abc')
>>> text.line_spacing = 4
Type:

float (default = 1.0)

Text.position

Anchor position of the Text.

This is the position of the Text on the Frame and will be \((x,y)\) or \((\theta,r)\) depending on the plot type (Cartesian or polar). This example shows how to set the anchor position of a Text object:

>>> text = frame.add_text("abc")
>>> text.position = (1.0, 2.0)

See also

Text.anchor

Type:

tuple

Text.position_coordinate_system

Position coordinate system of the Text object.

The text object may be positioned using either the grid coordinate system or the frame coordinate system and must be one of CoordSys.Frame or CoordSys.Grid

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.

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:

>>> from tecplot.constant import CoordSys
>>> text = frame.add_text("abc")
>>> 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:

>>> from tecplot.constant import CoordSys, Units
>>> text = frame.add_text("abc")
>>> text.font.size_units = Units.Grid
>>> text.position_coordinate_system = CoordSys.Frame
>>> text.position_coordinate_system
CoordSys.Frame
>>> text.font.size_units
Units.Frame
Type:

CoordSys

Text.scope

The Scope (local or global) of the Text.

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:

>>> text = frame.add_text("abc")
>>> text.scope = tecplot.constant.Scope.Global
Type:

Scope

Text.text_string

The text to be displayed in a text box.

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 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 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 (”"). This example shows how to set the text string of a Text object:

>>> text = frame.add_text('abc')
>>> text.text_string
'abc'
>>> text.text_string ='def'
>>> text.text_string
'def'
Type:

str

Text.type

Normal or LaTeX text type setting.

Possible values are TextType.Regular or TextType.LaTeX:

>>> text = frame.add_text(r'\alpha')
>>> text.type = TextType.LaTeX
Type:

TextType

TextBox

class tecplot.annotation.TextBox(text)[source]

The box surrounding a Text object.

Attributes

color

Border line color of the text box.

corner_locations

Position of the four corners of the text box.

fill_color

Background fill color of the text box.

line_thickness

Border line thickness.

margin

Margin between the text and the surrounding border.

type

Style of the text box fill area and border.

TextBox.color

Border line color of the text box.

Default: Color.Black. Example showing how to set the outline color of the text box for a Text object:

>>> from tecplot.constant import Color, TextBox
>>> text = frame.add_text("abc")
>>> text.box.type = TextBox.Filled
>>> text.box.color = Color.Blue
Type:

Color

TextBox.corner_locations

Position of the four corners of the text box.

Note: This property is read-only.

The tuple consists of 8 floats:

  • x1: X-Coordinate for bottom left corner

  • y1: Y-Coordinate for bottom left corner

  • x2: X-Coordinate for bottom right corner

  • y2: Y-Coordinate for bottom right corner

  • x3: X-Coordinate for upper right corner

  • y3: Y-Coordinate for upper right corner

  • x4: X-Coordinate for upper left corner

  • y4: Y-Coordinate for upper left corner

There is no default, position will vary with text box properties. Example showing how to query position of the text box for a Text object. The values x1, ..., y4` contain the corners of the text box:

>>> text = frame.add_text("abc")
>>> text.box.type = tecplot.constant.TextBox.Filled
>>> x1,y1,x2,y2,x3,y3,x4,y4 = text.box.corner_locations
Type:

tuple

TextBox.fill_color

Background fill color of the text box.

Example showing how to set the fill color of the text box for a Text object:

>>> text = frame.add_text("abc")
>>> text.box.type = TextBox.Filled
>>> text.box.fill_color = tecplot.constant.Color.Blue
Type:

Color

TextBox.line_thickness

Border line thickness.

Must be greater than 0, default: 0.1. Example showing how to set the line thickness of the text box:

>>> text = frame.add_text("abc")
>>> text.box.line_thickness = 0.5
Type:

float

TextBox.margin

Margin between the text and the surrounding border.

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)

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

>>> text = frame.add_text("abc")
>>> text.box.type = tecplot.constant.TextBox.Filled
>>> text.box.margin = 0.5
Type:

float

TextBox.type

Style of the text box fill area and border.

The text box type can be set to the following:

  • None_ - (default) No box is drawn around the text.

  • Filled - A filled box around the text which is opaque. if you

    place it over another Tecplot 360 object, the underlying object cannot be seen.

  • Hollow - A plain box around the text.

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

>>> text = frame.add_text("abc")
>>> text.box.type = tecplot.constant.TextBox.Filled
Type:

constant.TextBox

TextFont

class tecplot.annotation.TextFont(text)[source]

Typeface and font settings for a Text object.

Attributes

bold

Use bold typeface in the Text object.

italic

Use italic typeface of the Text object.

size

The text size in the currently defined text size units.

size_units

Units of the text character height.

typeface

The font family used by the Text object.

TextFont.bold

Use bold typeface in the Text object.

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

>>> text = frame.add_text('abc')
>>> text.font.bold = True
Type:

bool

TextFont.italic

Use italic typeface of the Text object.

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

>>> text = frame.add_text('abc')
>>> text.font.italic = True
Type:

bool

TextFont.size

The text size in the currently defined text size units.

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

>>> text = frame.add_text('abc')
>>> text.font.size_units = tecplot.constant.Units.Point
>>> text.font.size = 14
Type:

int

TextFont.size_units

Units of the text character height.

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)

Note

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

>>> from tecplot.constant import CoordSys
>>> text = frame.add_text("abc")
>>> text.position_coordinate_system = CoordSys.Grid
>>> text.font.size_units = Units.Point
Type:

Units

TextFont.typeface

The font family used by the Text object.

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

  • “Helvetica”

  • “Times”

  • “Courier”

  • “Greek”

  • “Math”

  • “User Defined”

Other typefaces may or may not be available depending on the TrueType fonts available. If the typeface or style is not available, a suitable replacement will be selected. This example shows how to set the typeface of a Text object to ‘Times’:

>>> text = frame.add_text('abc')
>>> text.font.typeface = 'Times'
Type:

str

Geometric Shapes

Circle

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

A circle annotation attached to a Frame.

import tecplot as tp
from tecplot.constant import *

frame = tp.active_frame()

circle0 = frame.add_circle((40, 50), 12, CoordSys.Frame)
circle1 = frame.add_circle((50, 50), 12, CoordSys.Frame)
circle2 = frame.add_circle((60, 50), 12, CoordSys.Frame)

circle0.fill_color = Color.Magenta
circle1.fill_color = Color.Yellow
circle2.fill_color = Color.Cyan

tp.export.save_png('circle.png', 600)
../_images/circle.png

Attributes

attached_map_index

Index to the associated fieldmap or linemap.

clipping

Clip geometry to the axes or frame for 2D plots.

color

Line Color.

draw_order

Draw before or after the data.

fill_color

Background fill color.

line_pattern

Pattern used for drawing lines or edges.

line_thickness

Thickness of lines or edges.

macro_function

An associated macro function.

num_points

Number of points to use when creating the curved shape.

pattern_length

Length of the line pattern.

position

Location on the Frame.

position_coordinate_system

Position coordinate system.

radius

Length of the radius.

scope

Display annotation in all frames with the same data.

type

The type of this annotation (read-only).

Circle.attached_map_index

Index to the associated fieldmap or linemap.

This property allows an annotation to follow the same active/inactive state as another plot object so their visibility can be changed together. Attach this annotation to a fieldmap or linemap using the object’s index property. Geometries and images that are attached to an inactive or non-existent zone are not displayed. Example usage assuming an annotation variable anno:

>>> anno.attached_map_index = plot.fieldmap(2).index
Type:

Index or None

Circle.clipping

Clip geometry to the axes or frame for 2D plots.

Clipping refers to displaying only that portion of an object that falls within a specified clipping region of the plot. If you have specified the position in the Frame coordinate system, the Annotations will be clipped to the frame. Default: Clipping.ClipToViewport.

If you have specified the Grid coordinate system, you can choose to clip your Annotations 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.

Warning

For 3D and line plots the viewport is the same as the frame and so clipping to the viewport or the frame will have no apparent affect. In cartesian 2D plots, clipping to the axes (Clipping.ClipToViewport) is only available when the position coordinate system is CoordSys.Grid.

Example of clipping a circle to the frame:

>>> from tecplot.constant import Clipping, CoordSys
>>> geom = frame.add_circle((0.5, 0.5), 0.55, CoordSys.Grid)
>>> geom.clipping = Clipping.ClipToFrame
Type:

Clipping

Circle.color

Line Color.

This example shows how to change the edge or line Color to red:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.color = Color.Red
Type:

Color

Circle.draw_order

Draw before or after the data.

Annotations can be drawn either before or after the data. If a geometry or image is drawn before the data, the plot layers, such as mesh, contour lines, etc. will be drawn on top of the geometry. Otherwise, the annotation will be drawn last, potentially obscuring the data.

Note

Tecplot 360 draws all geometries and images first, in the order they were added, then all text.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import DrawOrder
>>> anno.draw_order = DrawOrder.BeforeData
Type:

constant.DrawOrder

Circle.fill_color

Background fill color.

This example shows how to change the area fill Color to red. To turn off filling the geometry, set this attribute to None:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.fill_color = Color.Red
Type:

constant.Color

Circle.line_pattern

Pattern used for drawing lines or edges.

This example shows how to change the line pattern:

>>> from tecplot.constant import CoordSys, LinePattern
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_pattern = LinePattern.DashDot
Type:

LinePattern

Circle.line_thickness

Thickness of lines or edges.

This example shows how to change the line thickness:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_thickness = 4.0
Type:

float

Circle.macro_function

An associated macro function.

All geometry or image annotations may be linked to a macro function. This macro function is called when you hold down the Control key (Command key on Mac OS X) and click the right mouse button on the text, geometry or image in the frame.

In order to be attached to a text or geometry object, the macro function must be a “retained” macro function. A macro function is “retained” via either of the following scenarios:

  • running a macro file that contains the required macro functions

  • including it in your tecplot.mcr file (which is run at start up, making it a special case of the preceding scenario)

In both cases, the macro function is defined using the $!MACROFUNCTION macro command. Refer to “$!MACROFUNCTION…$!ENDMACROFUNCTION” on page 157 in the Tecplot Macro Scripting Guide for additional information.

Example usage assuming an annotation variable anno:

>>> anno.macro_function = 'MYMACROFUNCTION'

To run this function from PyTecplot it is neccessary to pass the function to a call to macro.execute_function():

>>> tecplot.macro.execute_function(anno.macro_function)
Type:

str

Circle.num_points

Number of points to use when creating the curved shape.

This is the number of segments along the edge plus one. Example usage:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.num_points = 300
Type:

int

Circle.pattern_length

Length of the line pattern.

This example shows how to change the pattern length:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.pattern_length = 1.2
Type:

float

Circle.position

Location on the Frame.

This is the origin of the annotation and will be \((x,y)\) or \((\theta,r)\) depending on the plot type. Example usage assuming an annotation variable anno:

>>> anno.position = (3, 4)
Type:

tuple

Circle.position_coordinate_system

Position coordinate system.

The object may be positioned using either the grid coordinate system or the frame coordinate system and must be one of CoordSys.Frame or CoordSys.Grid:

  • CoordSys.Frame: The geometry is always displayed at constant size and position when you zoom in or out of the plot.

  • CoordSys.Grid: The geometry resizes and moves with the data grid. However, the geometry remains fixed when you rotate the plot. Changing the center of rotation may cause the geometry to move.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import CoordSys
>>> anno.position_coordinate_system = CoordSys.Frame
Type:

CoordSys

Circle.radius

Length of the radius.

This will be in the coordinate system specified by Circle.position_coordinate_system. This example creates a circle of radius 5 and then doubles it to 10 later:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((20, 30), 5, CoordSys.Frame)
>>> geom.radius = 10
Type:

float

Circle.scope

Display annotation in all frames with the same data.

Annotations with local scope are displayed only in the Frame in which they are created. If it 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 usage assuming an annotation variable anno:

>>> from tecplot.constant import Scope
>>> anno.scope = Scope.Global
Type:

Scope

Circle.type

The type of this annotation (read-only).

This is the generic type information for geometry and image annotations. This is a read-only parameter and is used, in combination with position_coordinate_system to determine the actual return types of the iterators Frame.geometries() and Frame.images():

>>> frame.add_image('image.png', (1, 1), 5)
>>> frame.add_circle((0,0), 1, CoordSys.Grid)
>>> frame.add_square((0,0), 1, CoordSys.Grid)
>>> for anno in frame.images():
...     print(anno.type)
...
GeomType.Image
>>> for anno in frame.geometries():
...     print(anno.type)
...
GeomType.Circle
GeomType.Square
Type:

GeomType

Ellipse

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

An ellipse annotation attached to a Frame.

import tecplot as tp
from tecplot.constant import *

frame = tp.active_frame()

ellipse0 = frame.add_ellipse((40, 45), (10, 12), CoordSys.Frame)
ellipse1 = frame.add_ellipse((50, 50), (10, 16), CoordSys.Frame)
ellipse2 = frame.add_ellipse((60, 55), (10, 20), CoordSys.Frame)

ellipse0.fill_color = Color.Magenta
ellipse1.fill_color = Color.Yellow
ellipse2.fill_color = Color.Cyan

tp.export.save_png('ellipse.png', 600)
../_images/ellipse.png

Attributes

attached_map_index

Index to the associated fieldmap or linemap.

clipping

Clip geometry to the axes or frame for 2D plots.

color

Line Color.

draw_order

Draw before or after the data.

fill_color

Background fill color.

line_pattern

Pattern used for drawing lines or edges.

line_thickness

Thickness of lines or edges.

macro_function

An associated macro function.

num_points

Number of points to use when creating the curved shape.

pattern_length

Length of the line pattern.

position

Location on the Frame.

position_coordinate_system

Position coordinate system.

scope

Display annotation in all frames with the same data.

size

Size \((h_{axis}, v_{axis})\) of the ellipse.

type

The type of this annotation (read-only).

Ellipse.attached_map_index

Index to the associated fieldmap or linemap.

This property allows an annotation to follow the same active/inactive state as another plot object so their visibility can be changed together. Attach this annotation to a fieldmap or linemap using the object’s index property. Geometries and images that are attached to an inactive or non-existent zone are not displayed. Example usage assuming an annotation variable anno:

>>> anno.attached_map_index = plot.fieldmap(2).index
Type:

Index or None

Ellipse.clipping

Clip geometry to the axes or frame for 2D plots.

Clipping refers to displaying only that portion of an object that falls within a specified clipping region of the plot. If you have specified the position in the Frame coordinate system, the Annotations will be clipped to the frame. Default: Clipping.ClipToViewport.

If you have specified the Grid coordinate system, you can choose to clip your Annotations 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.

Warning

For 3D and line plots the viewport is the same as the frame and so clipping to the viewport or the frame will have no apparent affect. In cartesian 2D plots, clipping to the axes (Clipping.ClipToViewport) is only available when the position coordinate system is CoordSys.Grid.

Example of clipping a circle to the frame:

>>> from tecplot.constant import Clipping, CoordSys
>>> geom = frame.add_circle((0.5, 0.5), 0.55, CoordSys.Grid)
>>> geom.clipping = Clipping.ClipToFrame
Type:

Clipping

Ellipse.color

Line Color.

This example shows how to change the edge or line Color to red:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.color = Color.Red
Type:

Color

Ellipse.draw_order

Draw before or after the data.

Annotations can be drawn either before or after the data. If a geometry or image is drawn before the data, the plot layers, such as mesh, contour lines, etc. will be drawn on top of the geometry. Otherwise, the annotation will be drawn last, potentially obscuring the data.

Note

Tecplot 360 draws all geometries and images first, in the order they were added, then all text.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import DrawOrder
>>> anno.draw_order = DrawOrder.BeforeData
Type:

constant.DrawOrder

Ellipse.fill_color

Background fill color.

This example shows how to change the area fill Color to red. To turn off filling the geometry, set this attribute to None:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.fill_color = Color.Red
Type:

constant.Color

Ellipse.line_pattern

Pattern used for drawing lines or edges.

This example shows how to change the line pattern:

>>> from tecplot.constant import CoordSys, LinePattern
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_pattern = LinePattern.DashDot
Type:

LinePattern

Ellipse.line_thickness

Thickness of lines or edges.

This example shows how to change the line thickness:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_thickness = 4.0
Type:

float

Ellipse.macro_function

An associated macro function.

All geometry or image annotations may be linked to a macro function. This macro function is called when you hold down the Control key (Command key on Mac OS X) and click the right mouse button on the text, geometry or image in the frame.

In order to be attached to a text or geometry object, the macro function must be a “retained” macro function. A macro function is “retained” via either of the following scenarios:

  • running a macro file that contains the required macro functions

  • including it in your tecplot.mcr file (which is run at start up, making it a special case of the preceding scenario)

In both cases, the macro function is defined using the $!MACROFUNCTION macro command. Refer to “$!MACROFUNCTION…$!ENDMACROFUNCTION” on page 157 in the Tecplot Macro Scripting Guide for additional information.

Example usage assuming an annotation variable anno:

>>> anno.macro_function = 'MYMACROFUNCTION'

To run this function from PyTecplot it is neccessary to pass the function to a call to macro.execute_function():

>>> tecplot.macro.execute_function(anno.macro_function)
Type:

str

Ellipse.num_points

Number of points to use when creating the curved shape.

This is the number of segments along the edge plus one. Example usage:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.num_points = 300
Type:

int

Ellipse.pattern_length

Length of the line pattern.

This example shows how to change the pattern length:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.pattern_length = 1.2
Type:

float

Ellipse.position

Location on the Frame.

This is the origin of the annotation and will be \((x,y)\) or \((\theta,r)\) depending on the plot type. Example usage assuming an annotation variable anno:

>>> anno.position = (3, 4)
Type:

tuple

Ellipse.position_coordinate_system

Position coordinate system.

The object may be positioned using either the grid coordinate system or the frame coordinate system and must be one of CoordSys.Frame or CoordSys.Grid:

  • CoordSys.Frame: The geometry is always displayed at constant size and position when you zoom in or out of the plot.

  • CoordSys.Grid: The geometry resizes and moves with the data grid. However, the geometry remains fixed when you rotate the plot. Changing the center of rotation may cause the geometry to move.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import CoordSys
>>> anno.position_coordinate_system = CoordSys.Frame
Type:

CoordSys

Ellipse.scope

Display annotation in all frames with the same data.

Annotations with local scope are displayed only in the Frame in which they are created. If it 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 usage assuming an annotation variable anno:

>>> from tecplot.constant import Scope
>>> anno.scope = Scope.Global
Type:

Scope

Ellipse.size

Size \((h_{axis}, v_{axis})\) of the ellipse.

This is the horizontal and vertical axis lengths of the ellipse and will be in the coordinate system specified by Ellipse.position_coordinate_system. This example creates an ellipse with \((h_{axis}, v_{axis})\) of \((5, 10)\) and changes it to \((10, 20)\) later:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_ellipse((50, 50), (5, 10), CoordSys.Frame)
>>> geom.size = (10, 20)
Type:

tuple

Ellipse.type

The type of this annotation (read-only).

This is the generic type information for geometry and image annotations. This is a read-only parameter and is used, in combination with position_coordinate_system to determine the actual return types of the iterators Frame.geometries() and Frame.images():

>>> frame.add_image('image.png', (1, 1), 5)
>>> frame.add_circle((0,0), 1, CoordSys.Grid)
>>> frame.add_square((0,0), 1, CoordSys.Grid)
>>> for anno in frame.images():
...     print(anno.type)
...
GeomType.Image
>>> for anno in frame.geometries():
...     print(anno.type)
...
GeomType.Circle
GeomType.Square
Type:

GeomType

Rectangle

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

A rectangle annotation attached to a Frame.

import tecplot as tp
from tecplot.constant import *

frame = tp.active_frame()

rectangle0 = frame.add_rectangle((40, 45), (20, 12), CoordSys.Frame)
rectangle1 = frame.add_rectangle((50, 50), (20, 16), CoordSys.Frame)
rectangle2 = frame.add_rectangle((60, 55), (20, 20), CoordSys.Frame)

rectangle0.fill_color = Color.Magenta
rectangle1.fill_color = Color.Yellow
rectangle2.fill_color = Color.Cyan

tp.export.save_png('rectangle.png', 600)
../_images/rectangle.png

Attributes

attached_map_index

Index to the associated fieldmap or linemap.

clipping

Clip geometry to the axes or frame for 2D plots.

color

Line Color.

draw_order

Draw before or after the data.

fill_color

Background fill color.

line_pattern

Pattern used for drawing lines or edges.

line_thickness

Thickness of lines or edges.

macro_function

An associated macro function.

pattern_length

Length of the line pattern.

position

Location on the Frame.

position_coordinate_system

Position coordinate system.

scope

Display annotation in all frames with the same data.

size

Size \((width, height)\) of the rectangle.

type

The type of this annotation (read-only).

Rectangle.attached_map_index

Index to the associated fieldmap or linemap.

This property allows an annotation to follow the same active/inactive state as another plot object so their visibility can be changed together. Attach this annotation to a fieldmap or linemap using the object’s index property. Geometries and images that are attached to an inactive or non-existent zone are not displayed. Example usage assuming an annotation variable anno:

>>> anno.attached_map_index = plot.fieldmap(2).index
Type:

Index or None

Rectangle.clipping

Clip geometry to the axes or frame for 2D plots.

Clipping refers to displaying only that portion of an object that falls within a specified clipping region of the plot. If you have specified the position in the Frame coordinate system, the Annotations will be clipped to the frame. Default: Clipping.ClipToViewport.

If you have specified the Grid coordinate system, you can choose to clip your Annotations 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.

Warning

For 3D and line plots the viewport is the same as the frame and so clipping to the viewport or the frame will have no apparent affect. In cartesian 2D plots, clipping to the axes (Clipping.ClipToViewport) is only available when the position coordinate system is CoordSys.Grid.

Example of clipping a circle to the frame:

>>> from tecplot.constant import Clipping, CoordSys
>>> geom = frame.add_circle((0.5, 0.5), 0.55, CoordSys.Grid)
>>> geom.clipping = Clipping.ClipToFrame
Type:

Clipping

Rectangle.color

Line Color.

This example shows how to change the edge or line Color to red:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.color = Color.Red
Type:

Color

Rectangle.draw_order

Draw before or after the data.

Annotations can be drawn either before or after the data. If a geometry or image is drawn before the data, the plot layers, such as mesh, contour lines, etc. will be drawn on top of the geometry. Otherwise, the annotation will be drawn last, potentially obscuring the data.

Note

Tecplot 360 draws all geometries and images first, in the order they were added, then all text.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import DrawOrder
>>> anno.draw_order = DrawOrder.BeforeData
Type:

constant.DrawOrder

Rectangle.fill_color

Background fill color.

This example shows how to change the area fill Color to red. To turn off filling the geometry, set this attribute to None:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.fill_color = Color.Red
Type:

constant.Color

Rectangle.line_pattern

Pattern used for drawing lines or edges.

This example shows how to change the line pattern:

>>> from tecplot.constant import CoordSys, LinePattern
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_pattern = LinePattern.DashDot
Type:

LinePattern

Rectangle.line_thickness

Thickness of lines or edges.

This example shows how to change the line thickness:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_thickness = 4.0
Type:

float

Rectangle.macro_function

An associated macro function.

All geometry or image annotations may be linked to a macro function. This macro function is called when you hold down the Control key (Command key on Mac OS X) and click the right mouse button on the text, geometry or image in the frame.

In order to be attached to a text or geometry object, the macro function must be a “retained” macro function. A macro function is “retained” via either of the following scenarios:

  • running a macro file that contains the required macro functions

  • including it in your tecplot.mcr file (which is run at start up, making it a special case of the preceding scenario)

In both cases, the macro function is defined using the $!MACROFUNCTION macro command. Refer to “$!MACROFUNCTION…$!ENDMACROFUNCTION” on page 157 in the Tecplot Macro Scripting Guide for additional information.

Example usage assuming an annotation variable anno:

>>> anno.macro_function = 'MYMACROFUNCTION'

To run this function from PyTecplot it is neccessary to pass the function to a call to macro.execute_function():

>>> tecplot.macro.execute_function(anno.macro_function)
Type:

str

Rectangle.pattern_length

Length of the line pattern.

This example shows how to change the pattern length:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.pattern_length = 1.2
Type:

float

Rectangle.position

Location on the Frame.

This is the origin of the annotation and will be \((x,y)\) or \((\theta,r)\) depending on the plot type. Example usage assuming an annotation variable anno:

>>> anno.position = (3, 4)
Type:

tuple

Rectangle.position_coordinate_system

Position coordinate system.

The object may be positioned using either the grid coordinate system or the frame coordinate system and must be one of CoordSys.Frame or CoordSys.Grid:

  • CoordSys.Frame: The geometry is always displayed at constant size and position when you zoom in or out of the plot.

  • CoordSys.Grid: The geometry resizes and moves with the data grid. However, the geometry remains fixed when you rotate the plot. Changing the center of rotation may cause the geometry to move.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import CoordSys
>>> anno.position_coordinate_system = CoordSys.Frame
Type:

CoordSys

Rectangle.scope

Display annotation in all frames with the same data.

Annotations with local scope are displayed only in the Frame in which they are created. If it 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 usage assuming an annotation variable anno:

>>> from tecplot.constant import Scope
>>> anno.scope = Scope.Global
Type:

Scope

Rectangle.size

Size \((width, height)\) of the rectangle.

This is the width and height of the rectangle and will be in the coordinate system specified by Rectangle.position_coordinate_system. This example creates a rectangle with \((width, height)\) of \((5, 10)\) and changes it to \((10, 20)\) later:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_rectangle((50, 50), (5, 10), CoordSys.Frame)
>>> geom.size = (10, 20)
Type:

tuple

Rectangle.type

The type of this annotation (read-only).

This is the generic type information for geometry and image annotations. This is a read-only parameter and is used, in combination with position_coordinate_system to determine the actual return types of the iterators Frame.geometries() and Frame.images():

>>> frame.add_image('image.png', (1, 1), 5)
>>> frame.add_circle((0,0), 1, CoordSys.Grid)
>>> frame.add_square((0,0), 1, CoordSys.Grid)
>>> for anno in frame.images():
...     print(anno.type)
...
GeomType.Image
>>> for anno in frame.geometries():
...     print(anno.type)
...
GeomType.Circle
GeomType.Square
Type:

GeomType

Square

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

A square annotation attached to a Frame.

import tecplot as tp
from tecplot.constant import *

frame = tp.active_frame()

square0 = frame.add_square((40, 40), 15, CoordSys.Frame)
square1 = frame.add_square((50, 50), 15, CoordSys.Frame)
square2 = frame.add_square((60, 60), 15, CoordSys.Frame)

square0.fill_color = Color.Magenta
square1.fill_color = Color.Yellow
square2.fill_color = Color.Cyan

tp.export.save_png('square.png', 600)
../_images/square.png

Attributes

attached_map_index

Index to the associated fieldmap or linemap.

clipping

Clip geometry to the axes or frame for 2D plots.

color

Line Color.

draw_order

Draw before or after the data.

fill_color

Background fill color.

line_pattern

Pattern used for drawing lines or edges.

line_thickness

Thickness of lines or edges.

macro_function

An associated macro function.

pattern_length

Length of the line pattern.

position

Location on the Frame.

position_coordinate_system

Position coordinate system.

scope

Display annotation in all frames with the same data.

size

Length of one side of the square.

type

The type of this annotation (read-only).

Square.attached_map_index

Index to the associated fieldmap or linemap.

This property allows an annotation to follow the same active/inactive state as another plot object so their visibility can be changed together. Attach this annotation to a fieldmap or linemap using the object’s index property. Geometries and images that are attached to an inactive or non-existent zone are not displayed. Example usage assuming an annotation variable anno:

>>> anno.attached_map_index = plot.fieldmap(2).index
Type:

Index or None

Square.clipping

Clip geometry to the axes or frame for 2D plots.

Clipping refers to displaying only that portion of an object that falls within a specified clipping region of the plot. If you have specified the position in the Frame coordinate system, the Annotations will be clipped to the frame. Default: Clipping.ClipToViewport.

If you have specified the Grid coordinate system, you can choose to clip your Annotations 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.

Warning

For 3D and line plots the viewport is the same as the frame and so clipping to the viewport or the frame will have no apparent affect. In cartesian 2D plots, clipping to the axes (Clipping.ClipToViewport) is only available when the position coordinate system is CoordSys.Grid.

Example of clipping a circle to the frame:

>>> from tecplot.constant import Clipping, CoordSys
>>> geom = frame.add_circle((0.5, 0.5), 0.55, CoordSys.Grid)
>>> geom.clipping = Clipping.ClipToFrame
Type:

Clipping

Square.color

Line Color.

This example shows how to change the edge or line Color to red:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.color = Color.Red
Type:

Color

Square.draw_order

Draw before or after the data.

Annotations can be drawn either before or after the data. If a geometry or image is drawn before the data, the plot layers, such as mesh, contour lines, etc. will be drawn on top of the geometry. Otherwise, the annotation will be drawn last, potentially obscuring the data.

Note

Tecplot 360 draws all geometries and images first, in the order they were added, then all text.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import DrawOrder
>>> anno.draw_order = DrawOrder.BeforeData
Type:

constant.DrawOrder

Square.fill_color

Background fill color.

This example shows how to change the area fill Color to red. To turn off filling the geometry, set this attribute to None:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.fill_color = Color.Red
Type:

constant.Color

Square.line_pattern

Pattern used for drawing lines or edges.

This example shows how to change the line pattern:

>>> from tecplot.constant import CoordSys, LinePattern
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_pattern = LinePattern.DashDot
Type:

LinePattern

Square.line_thickness

Thickness of lines or edges.

This example shows how to change the line thickness:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_thickness = 4.0
Type:

float

Square.macro_function

An associated macro function.

All geometry or image annotations may be linked to a macro function. This macro function is called when you hold down the Control key (Command key on Mac OS X) and click the right mouse button on the text, geometry or image in the frame.

In order to be attached to a text or geometry object, the macro function must be a “retained” macro function. A macro function is “retained” via either of the following scenarios:

  • running a macro file that contains the required macro functions

  • including it in your tecplot.mcr file (which is run at start up, making it a special case of the preceding scenario)

In both cases, the macro function is defined using the $!MACROFUNCTION macro command. Refer to “$!MACROFUNCTION…$!ENDMACROFUNCTION” on page 157 in the Tecplot Macro Scripting Guide for additional information.

Example usage assuming an annotation variable anno:

>>> anno.macro_function = 'MYMACROFUNCTION'

To run this function from PyTecplot it is neccessary to pass the function to a call to macro.execute_function():

>>> tecplot.macro.execute_function(anno.macro_function)
Type:

str

Square.pattern_length

Length of the line pattern.

This example shows how to change the pattern length:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.pattern_length = 1.2
Type:

float

Square.position

Location on the Frame.

This is the origin of the annotation and will be \((x,y)\) or \((\theta,r)\) depending on the plot type. Example usage assuming an annotation variable anno:

>>> anno.position = (3, 4)
Type:

tuple

Square.position_coordinate_system

Position coordinate system.

The object may be positioned using either the grid coordinate system or the frame coordinate system and must be one of CoordSys.Frame or CoordSys.Grid:

  • CoordSys.Frame: The geometry is always displayed at constant size and position when you zoom in or out of the plot.

  • CoordSys.Grid: The geometry resizes and moves with the data grid. However, the geometry remains fixed when you rotate the plot. Changing the center of rotation may cause the geometry to move.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import CoordSys
>>> anno.position_coordinate_system = CoordSys.Frame
Type:

CoordSys

Square.scope

Display annotation in all frames with the same data.

Annotations with local scope are displayed only in the Frame in which they are created. If it 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 usage assuming an annotation variable anno:

>>> from tecplot.constant import Scope
>>> anno.scope = Scope.Global
Type:

Scope

Square.size

Length of one side of the square.

This will be in the coordinate system specified by Square.position_coordinate_system. This example creates a square of side-length 5 and then doubles it to 10 later:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_square((50, 50), 5, CoordSys.Frame)
>>> geom.radius = 10
Type:

float

Square.type

The type of this annotation (read-only).

This is the generic type information for geometry and image annotations. This is a read-only parameter and is used, in combination with position_coordinate_system to determine the actual return types of the iterators Frame.geometries() and Frame.images():

>>> frame.add_image('image.png', (1, 1), 5)
>>> frame.add_circle((0,0), 1, CoordSys.Grid)
>>> frame.add_square((0,0), 1, CoordSys.Grid)
>>> for anno in frame.images():
...     print(anno.type)
...
GeomType.Image
>>> for anno in frame.geometries():
...     print(anno.type)
...
GeomType.Circle
GeomType.Square
Type:

GeomType

Polyline2D

class tecplot.annotation.Polyline2D(index, mpolyline)[source]

A series of connected points in 2D.

import math

import tecplot as tp
from tecplot.constant import *

# create sine-wave in frame % coordinates
xx = list(range(10, 90))
yy = [10 * math.sin(x / 5) + 50 for x in xx]
points = [(x, y) for x, y in zip(xx, yy)]

frame = tp.active_frame()

line = frame.add_polyline(points, coord_sys=CoordSys.Frame)
line.line_thickness = 2
line.color = Color.Blue

tp.export.save_png('polyline2d.png', 600)
../_images/polyline2d.png

Attributes

arrowhead

Style control for arrowheads.

attached_map_index

Index to the associated fieldmap or linemap.

clipping

Clip geometry to the axes or frame for 2D plots.

color

Line Color.

draw_order

Draw before or after the data.

fill_color

Background fill color.

line_pattern

Pattern used for drawing lines or edges.

line_thickness

Thickness of lines or edges.

macro_function

An associated macro function.

pattern_length

Length of the line pattern.

position

Location on the Frame.

position_coordinate_system

Position coordinate system.

scope

Display annotation in all frames with the same data.

type

The type of this annotation (read-only).

Polyline2D.arrowhead

Style control for arrowheads.

Example usage:

>>> from tecplot.constant import ArrowheadAttachment, ArrowheadStyle
>>> polyline.arrowhead.attachment = ArrowheadAttachment.AtEnd
>>> polyline.arrowhead.style = ArrowheadStyle.Filled
Type:

Arrowhead

Polyline2D.attached_map_index

Index to the associated fieldmap or linemap.

This property allows an annotation to follow the same active/inactive state as another plot object so their visibility can be changed together. Attach this annotation to a fieldmap or linemap using the object’s index property. Geometries and images that are attached to an inactive or non-existent zone are not displayed. Example usage assuming an annotation variable anno:

>>> anno.attached_map_index = plot.fieldmap(2).index
Type:

Index or None

Polyline2D.clipping

Clip geometry to the axes or frame for 2D plots.

Clipping refers to displaying only that portion of an object that falls within a specified clipping region of the plot. If you have specified the position in the Frame coordinate system, the Annotations will be clipped to the frame. Default: Clipping.ClipToViewport.

If you have specified the Grid coordinate system, you can choose to clip your Annotations 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.

Warning

For 3D and line plots the viewport is the same as the frame and so clipping to the viewport or the frame will have no apparent affect. In cartesian 2D plots, clipping to the axes (Clipping.ClipToViewport) is only available when the position coordinate system is CoordSys.Grid.

Example of clipping a circle to the frame:

>>> from tecplot.constant import Clipping, CoordSys
>>> geom = frame.add_circle((0.5, 0.5), 0.55, CoordSys.Grid)
>>> geom.clipping = Clipping.ClipToFrame
Type:

Clipping

Polyline2D.color

Line Color.

This example shows how to change the edge or line Color to red:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.color = Color.Red
Type:

Color

Polyline2D.draw_order

Draw before or after the data.

Annotations can be drawn either before or after the data. If a geometry or image is drawn before the data, the plot layers, such as mesh, contour lines, etc. will be drawn on top of the geometry. Otherwise, the annotation will be drawn last, potentially obscuring the data.

Note

Tecplot 360 draws all geometries and images first, in the order they were added, then all text.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import DrawOrder
>>> anno.draw_order = DrawOrder.BeforeData
Type:

constant.DrawOrder

Polyline2D.fill_color

Background fill color.

This example shows how to change the area fill Color to red. To turn off filling the geometry, set this attribute to None:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.fill_color = Color.Red
Type:

constant.Color

Polyline2D.line_pattern

Pattern used for drawing lines or edges.

This example shows how to change the line pattern:

>>> from tecplot.constant import CoordSys, LinePattern
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_pattern = LinePattern.DashDot
Type:

LinePattern

Polyline2D.line_thickness

Thickness of lines or edges.

This example shows how to change the line thickness:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_thickness = 4.0
Type:

float

Polyline2D.macro_function

An associated macro function.

All geometry or image annotations may be linked to a macro function. This macro function is called when you hold down the Control key (Command key on Mac OS X) and click the right mouse button on the text, geometry or image in the frame.

In order to be attached to a text or geometry object, the macro function must be a “retained” macro function. A macro function is “retained” via either of the following scenarios:

  • running a macro file that contains the required macro functions

  • including it in your tecplot.mcr file (which is run at start up, making it a special case of the preceding scenario)

In both cases, the macro function is defined using the $!MACROFUNCTION macro command. Refer to “$!MACROFUNCTION…$!ENDMACROFUNCTION” on page 157 in the Tecplot Macro Scripting Guide for additional information.

Example usage assuming an annotation variable anno:

>>> anno.macro_function = 'MYMACROFUNCTION'

To run this function from PyTecplot it is neccessary to pass the function to a call to macro.execute_function():

>>> tecplot.macro.execute_function(anno.macro_function)
Type:

str

Polyline2D.pattern_length

Length of the line pattern.

This example shows how to change the pattern length:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.pattern_length = 1.2
Type:

float

Polyline2D.position

Location on the Frame.

This is the origin of the annotation and will be \((x,y)\) or \((\theta,r)\) depending on the plot type. Example usage assuming an annotation variable anno:

>>> anno.position = (3, 4)
Type:

tuple

Polyline2D.position_coordinate_system

Position coordinate system.

The object may be positioned using either the grid coordinate system or the frame coordinate system and must be one of CoordSys.Frame or CoordSys.Grid:

  • CoordSys.Frame: The geometry is always displayed at constant size and position when you zoom in or out of the plot.

  • CoordSys.Grid: The geometry resizes and moves with the data grid. However, the geometry remains fixed when you rotate the plot. Changing the center of rotation may cause the geometry to move.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import CoordSys
>>> anno.position_coordinate_system = CoordSys.Frame
Type:

CoordSys

Polyline2D.scope

Display annotation in all frames with the same data.

Annotations with local scope are displayed only in the Frame in which they are created. If it 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 usage assuming an annotation variable anno:

>>> from tecplot.constant import Scope
>>> anno.scope = Scope.Global
Type:

Scope

Polyline2D.type

The type of this annotation (read-only).

This is the generic type information for geometry and image annotations. This is a read-only parameter and is used, in combination with position_coordinate_system to determine the actual return types of the iterators Frame.geometries() and Frame.images():

>>> frame.add_image('image.png', (1, 1), 5)
>>> frame.add_circle((0,0), 1, CoordSys.Grid)
>>> frame.add_square((0,0), 1, CoordSys.Grid)
>>> for anno in frame.images():
...     print(anno.type)
...
GeomType.Image
>>> for anno in frame.geometries():
...     print(anno.type)
...
GeomType.Circle
GeomType.Square
Type:

GeomType

Polyline3D

class tecplot.annotation.Polyline3D(index, mpolyline)[source]

A series of connected points in 3D.

import math

import tecplot as tp
from tecplot.constant import *

# create helix polyline in data coordinates
zz = [z / 2000 for z in range(1000)]
xx = [0.5 * math.cos(z * 50) for z in zz]
yy = [0.5 * math.sin(z * 50) for z in zz]
points = [(x, y, z) for x, y, z in zip(xx, yy, zz)]

frame = tp.active_frame()
dataset = frame.create_dataset('Dataset Name', ['x', 'y', 'z'])
dataset.add_ordered_zone('Zone Name', (10, 10, 10))
plot = frame.plot(PlotType.Cartesian3D)
plot.activate()

line = frame.add_polyline(points)
line.line_thickness = 2
line.color = Color.Chartreuse

tp.export.save_png('polyline3d.png', 600)
../_images/polyline3d.png

Attributes

attached_map_index

Index to the associated fieldmap or linemap.

color

Line Color.

fill_color

Background fill color.

line_pattern

Pattern used for drawing lines or edges.

line_thickness

Thickness of lines or edges.

macro_function

An associated macro function.

pattern_length

Length of the line pattern.

scope

Display annotation in all frames with the same data.

type

The type of this annotation (read-only).

Polyline3D.attached_map_index

Index to the associated fieldmap or linemap.

This property allows an annotation to follow the same active/inactive state as another plot object so their visibility can be changed together. Attach this annotation to a fieldmap or linemap using the object’s index property. Geometries and images that are attached to an inactive or non-existent zone are not displayed. Example usage assuming an annotation variable anno:

>>> anno.attached_map_index = plot.fieldmap(2).index
Type:

Index or None

Polyline3D.color

Line Color.

This example shows how to change the edge or line Color to red:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.color = Color.Red
Type:

Color

Polyline3D.fill_color

Background fill color.

This example shows how to change the area fill Color to red. To turn off filling the geometry, set this attribute to None:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.fill_color = Color.Red
Type:

constant.Color

Polyline3D.line_pattern

Pattern used for drawing lines or edges.

This example shows how to change the line pattern:

>>> from tecplot.constant import CoordSys, LinePattern
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_pattern = LinePattern.DashDot
Type:

LinePattern

Polyline3D.line_thickness

Thickness of lines or edges.

This example shows how to change the line thickness:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_thickness = 4.0
Type:

float

Polyline3D.macro_function

An associated macro function.

All geometry or image annotations may be linked to a macro function. This macro function is called when you hold down the Control key (Command key on Mac OS X) and click the right mouse button on the text, geometry or image in the frame.

In order to be attached to a text or geometry object, the macro function must be a “retained” macro function. A macro function is “retained” via either of the following scenarios:

  • running a macro file that contains the required macro functions

  • including it in your tecplot.mcr file (which is run at start up, making it a special case of the preceding scenario)

In both cases, the macro function is defined using the $!MACROFUNCTION macro command. Refer to “$!MACROFUNCTION…$!ENDMACROFUNCTION” on page 157 in the Tecplot Macro Scripting Guide for additional information.

Example usage assuming an annotation variable anno:

>>> anno.macro_function = 'MYMACROFUNCTION'

To run this function from PyTecplot it is neccessary to pass the function to a call to macro.execute_function():

>>> tecplot.macro.execute_function(anno.macro_function)
Type:

str

Polyline3D.pattern_length

Length of the line pattern.

This example shows how to change the pattern length:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.pattern_length = 1.2
Type:

float

Polyline3D.scope

Display annotation in all frames with the same data.

Annotations with local scope are displayed only in the Frame in which they are created. If it 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 usage assuming an annotation variable anno:

>>> from tecplot.constant import Scope
>>> anno.scope = Scope.Global
Type:

Scope

Polyline3D.type

The type of this annotation (read-only).

This is the generic type information for geometry and image annotations. This is a read-only parameter and is used, in combination with position_coordinate_system to determine the actual return types of the iterators Frame.geometries() and Frame.images():

>>> frame.add_image('image.png', (1, 1), 5)
>>> frame.add_circle((0,0), 1, CoordSys.Grid)
>>> frame.add_square((0,0), 1, CoordSys.Grid)
>>> for anno in frame.images():
...     print(anno.type)
...
GeomType.Image
>>> for anno in frame.geometries():
...     print(anno.type)
...
GeomType.Circle
GeomType.Square
Type:

GeomType

MultiPolyline2D

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

A collection of Polyline2D objects.

import math

import tecplot as tp
from tecplot.constant import *

# create sine-wave in frame % coordinates
xx = list(range(10, 90))
yy = [10 * math.sin(x / 5) + 50 for x in xx]
points = [(x, y) for x, y in zip(xx, yy)]

# create new line with points shifted up and to the left
shifted_points = [(x + 5, y + 5) for x, y in points]

frame = tp.active_frame()

multi_line = frame.add_polyline(points, shifted_points, coord_sys=CoordSys.Frame)
multi_line.line_thickness = 2
multi_line.color = Color.Blue

tp.export.save_png('multipolyline2d.png', 600)
../_images/multipolyline2d.png

Attributes

arrowhead

Style control for arrowheads.

attached_map_index

Index to the associated fieldmap or linemap.

clipping

Clip geometry to the axes or frame for 2D plots.

color

Line Color.

draw_order

Draw before or after the data.

fill_color

Background fill color.

line_pattern

Pattern used for drawing lines or edges.

line_thickness

Thickness of lines or edges.

macro_function

An associated macro function.

pattern_length

Length of the line pattern.

position

Location on the Frame.

position_coordinate_system

Position coordinate system.

scope

Display annotation in all frames with the same data.

type

The type of this annotation (read-only).

MultiPolyline2D.arrowhead

Style control for arrowheads.

Example usage:

>>> from tecplot.constant import ArrowheadAttachment, ArrowheadStyle
>>> multi_polyline.arrowhead.attachment = ArrowheadAttachment.AtEnd
>>> multi_polyline.arrowhead.style = ArrowheadStyle.Filled
Type:

Arrowhead

MultiPolyline2D.attached_map_index

Index to the associated fieldmap or linemap.

This property allows an annotation to follow the same active/inactive state as another plot object so their visibility can be changed together. Attach this annotation to a fieldmap or linemap using the object’s index property. Geometries and images that are attached to an inactive or non-existent zone are not displayed. Example usage assuming an annotation variable anno:

>>> anno.attached_map_index = plot.fieldmap(2).index
Type:

Index or None

MultiPolyline2D.clipping

Clip geometry to the axes or frame for 2D plots.

Clipping refers to displaying only that portion of an object that falls within a specified clipping region of the plot. If you have specified the position in the Frame coordinate system, the Annotations will be clipped to the frame. Default: Clipping.ClipToViewport.

If you have specified the Grid coordinate system, you can choose to clip your Annotations 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.

Warning

For 3D and line plots the viewport is the same as the frame and so clipping to the viewport or the frame will have no apparent affect. In cartesian 2D plots, clipping to the axes (Clipping.ClipToViewport) is only available when the position coordinate system is CoordSys.Grid.

Example of clipping a circle to the frame:

>>> from tecplot.constant import Clipping, CoordSys
>>> geom = frame.add_circle((0.5, 0.5), 0.55, CoordSys.Grid)
>>> geom.clipping = Clipping.ClipToFrame
Type:

Clipping

MultiPolyline2D.color

Line Color.

This example shows how to change the edge or line Color to red:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.color = Color.Red
Type:

Color

MultiPolyline2D.draw_order

Draw before or after the data.

Annotations can be drawn either before or after the data. If a geometry or image is drawn before the data, the plot layers, such as mesh, contour lines, etc. will be drawn on top of the geometry. Otherwise, the annotation will be drawn last, potentially obscuring the data.

Note

Tecplot 360 draws all geometries and images first, in the order they were added, then all text.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import DrawOrder
>>> anno.draw_order = DrawOrder.BeforeData
Type:

constant.DrawOrder

MultiPolyline2D.fill_color

Background fill color.

This example shows how to change the area fill Color to red. To turn off filling the geometry, set this attribute to None:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.fill_color = Color.Red
Type:

constant.Color

MultiPolyline2D.line_pattern

Pattern used for drawing lines or edges.

This example shows how to change the line pattern:

>>> from tecplot.constant import CoordSys, LinePattern
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_pattern = LinePattern.DashDot
Type:

LinePattern

MultiPolyline2D.line_thickness

Thickness of lines or edges.

This example shows how to change the line thickness:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_thickness = 4.0
Type:

float

MultiPolyline2D.macro_function

An associated macro function.

All geometry or image annotations may be linked to a macro function. This macro function is called when you hold down the Control key (Command key on Mac OS X) and click the right mouse button on the text, geometry or image in the frame.

In order to be attached to a text or geometry object, the macro function must be a “retained” macro function. A macro function is “retained” via either of the following scenarios:

  • running a macro file that contains the required macro functions

  • including it in your tecplot.mcr file (which is run at start up, making it a special case of the preceding scenario)

In both cases, the macro function is defined using the $!MACROFUNCTION macro command. Refer to “$!MACROFUNCTION…$!ENDMACROFUNCTION” on page 157 in the Tecplot Macro Scripting Guide for additional information.

Example usage assuming an annotation variable anno:

>>> anno.macro_function = 'MYMACROFUNCTION'

To run this function from PyTecplot it is neccessary to pass the function to a call to macro.execute_function():

>>> tecplot.macro.execute_function(anno.macro_function)
Type:

str

MultiPolyline2D.pattern_length

Length of the line pattern.

This example shows how to change the pattern length:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.pattern_length = 1.2
Type:

float

MultiPolyline2D.position

Location on the Frame.

This is the origin of the annotation and will be \((x,y)\) or \((\theta,r)\) depending on the plot type. Example usage assuming an annotation variable anno:

>>> anno.position = (3, 4)
Type:

tuple

MultiPolyline2D.position_coordinate_system

Position coordinate system.

The object may be positioned using either the grid coordinate system or the frame coordinate system and must be one of CoordSys.Frame or CoordSys.Grid:

  • CoordSys.Frame: The geometry is always displayed at constant size and position when you zoom in or out of the plot.

  • CoordSys.Grid: The geometry resizes and moves with the data grid. However, the geometry remains fixed when you rotate the plot. Changing the center of rotation may cause the geometry to move.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import CoordSys
>>> anno.position_coordinate_system = CoordSys.Frame
Type:

CoordSys

MultiPolyline2D.scope

Display annotation in all frames with the same data.

Annotations with local scope are displayed only in the Frame in which they are created. If it 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 usage assuming an annotation variable anno:

>>> from tecplot.constant import Scope
>>> anno.scope = Scope.Global
Type:

Scope

MultiPolyline2D.type

The type of this annotation (read-only).

This is the generic type information for geometry and image annotations. This is a read-only parameter and is used, in combination with position_coordinate_system to determine the actual return types of the iterators Frame.geometries() and Frame.images():

>>> frame.add_image('image.png', (1, 1), 5)
>>> frame.add_circle((0,0), 1, CoordSys.Grid)
>>> frame.add_square((0,0), 1, CoordSys.Grid)
>>> for anno in frame.images():
...     print(anno.type)
...
GeomType.Image
>>> for anno in frame.geometries():
...     print(anno.type)
...
GeomType.Circle
GeomType.Square
Type:

GeomType

MultiPolyline3D

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

A collection of Polyline3D objects.

import math

import tecplot as tp
from tecplot.constant import *

# create double-helix multi-polyline in data coordinates
zz = [z / 2000 for z in range(1000)]
xx = [0.5 * math.cos(z * 50) for z in zz]
yy = [0.5 * math.sin(z * 50) for z in zz]
points = [(x, y, z) for x, y, z in zip(xx, yy, zz)]
points_shifted = [(x, y, z + 0.02) for x, y, z in zip(xx, yy, zz)]

frame = tp.active_frame()
dataset = frame.create_dataset('Dataset Name', ['x', 'y', 'z'])
dataset.add_ordered_zone('Zone Name', (10, 10, 10))
plot = frame.plot(PlotType.Cartesian3D)
plot.activate()

line = frame.add_polyline(points, points_shifted)
line.line_thickness = 2
line.color = Color.Turquoise

tp.export.save_png('multipolyline3d.png', 600)
../_images/multipolyline3d.png

Attributes

attached_map_index

Index to the associated fieldmap or linemap.

color

Line Color.

fill_color

Background fill color.

line_pattern

Pattern used for drawing lines or edges.

line_thickness

Thickness of lines or edges.

macro_function

An associated macro function.

pattern_length

Length of the line pattern.

scope

Display annotation in all frames with the same data.

type

The type of this annotation (read-only).

MultiPolyline3D.attached_map_index

Index to the associated fieldmap or linemap.

This property allows an annotation to follow the same active/inactive state as another plot object so their visibility can be changed together. Attach this annotation to a fieldmap or linemap using the object’s index property. Geometries and images that are attached to an inactive or non-existent zone are not displayed. Example usage assuming an annotation variable anno:

>>> anno.attached_map_index = plot.fieldmap(2).index
Type:

Index or None

MultiPolyline3D.color

Line Color.

This example shows how to change the edge or line Color to red:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.color = Color.Red
Type:

Color

MultiPolyline3D.fill_color

Background fill color.

This example shows how to change the area fill Color to red. To turn off filling the geometry, set this attribute to None:

>>> from tecplot.constant import Color, CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.fill_color = Color.Red
Type:

constant.Color

MultiPolyline3D.line_pattern

Pattern used for drawing lines or edges.

This example shows how to change the line pattern:

>>> from tecplot.constant import CoordSys, LinePattern
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_pattern = LinePattern.DashDot
Type:

LinePattern

MultiPolyline3D.line_thickness

Thickness of lines or edges.

This example shows how to change the line thickness:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.line_thickness = 4.0
Type:

float

MultiPolyline3D.macro_function

An associated macro function.

All geometry or image annotations may be linked to a macro function. This macro function is called when you hold down the Control key (Command key on Mac OS X) and click the right mouse button on the text, geometry or image in the frame.

In order to be attached to a text or geometry object, the macro function must be a “retained” macro function. A macro function is “retained” via either of the following scenarios:

  • running a macro file that contains the required macro functions

  • including it in your tecplot.mcr file (which is run at start up, making it a special case of the preceding scenario)

In both cases, the macro function is defined using the $!MACROFUNCTION macro command. Refer to “$!MACROFUNCTION…$!ENDMACROFUNCTION” on page 157 in the Tecplot Macro Scripting Guide for additional information.

Example usage assuming an annotation variable anno:

>>> anno.macro_function = 'MYMACROFUNCTION'

To run this function from PyTecplot it is neccessary to pass the function to a call to macro.execute_function():

>>> tecplot.macro.execute_function(anno.macro_function)
Type:

str

MultiPolyline3D.pattern_length

Length of the line pattern.

This example shows how to change the pattern length:

>>> from tecplot.constant import CoordSys
>>> geom = frame.add_circle((50, 50), 10, CoordSys.Frame)
>>> geom.pattern_length = 1.2
Type:

float

MultiPolyline3D.scope

Display annotation in all frames with the same data.

Annotations with local scope are displayed only in the Frame in which they are created. If it 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 usage assuming an annotation variable anno:

>>> from tecplot.constant import Scope
>>> anno.scope = Scope.Global
Type:

Scope

MultiPolyline3D.type

The type of this annotation (read-only).

This is the generic type information for geometry and image annotations. This is a read-only parameter and is used, in combination with position_coordinate_system to determine the actual return types of the iterators Frame.geometries() and Frame.images():

>>> frame.add_image('image.png', (1, 1), 5)
>>> frame.add_circle((0,0), 1, CoordSys.Grid)
>>> frame.add_square((0,0), 1, CoordSys.Grid)
>>> for anno in frame.images():
...     print(anno.type)
...
GeomType.Image
>>> for anno in frame.geometries():
...     print(anno.type)
...
GeomType.Circle
GeomType.Square
Type:

GeomType

Arrowhead

class tecplot.annotation.Arrowhead(polyline)[source]

Polyline arrowhead properties.

import tecplot as tp
from tecplot.constant import *

frame = tp.active_frame()

line0 = frame.add_polyline([[30,30], [50,60]], coord_sys=CoordSys.Frame)
line1 = frame.add_polyline([[35,30], [55,60]], coord_sys=CoordSys.Frame)
line2 = frame.add_polyline([[40,30], [60,60]], coord_sys=CoordSys.Frame)

line0.arrowhead.attachment = ArrowheadAttachment.AtEnd
line1.arrowhead.attachment = ArrowheadAttachment.AtEnd
line2.arrowhead.attachment = ArrowheadAttachment.AtEnd

line0.line_thickness = 2
line1.line_thickness = 2
line2.line_thickness = 2

tp.export.save_png('arrowhead.png', 600)
../_images/arrowhead.png

Attributes

angle

The angle of the arrow lines in degrees.

attachment

Location of arrowhead on the polyline.

size

Size of the arrowhead on the polyline.

style

The style of the arrowhead on the polyline.

Arrowhead.angle

The angle of the arrow lines in degrees.

This is the angle that one side of the arrowhead makes with the vector, i.e. the apex angle is twice the arrowhead angle:

>>> from tecplot.constant import ArrowheadAttachment
>>> polyline.arrowhead.attachment = ArrowheadAttachment.AtEnd
>>> polyline.arrowhead.angle = 45
Type:

float

Arrowhead.attachment

Location of arrowhead on the polyline.

Possible values are ArrowheadAttachment.None_, ArrowheadAttachment.AtBeginning, ArrowheadAttachment.AtEnd and ArrowheadAttachment.AtBothEnds:

>>> from tecplot.constant import ArrowheadAttachment
>>> polyline.arrowhead.attachment = ArrowheadAttachment.AtEnd
Type:

ArrowheadAttachment

Arrowhead.size

Size of the arrowhead on the polyline.

This is in the coordinate system specified by the position_coordinate_system attribute of the polyline:

>>> from tecplot.constant import ArrowheadAttachment
>>> polyline.arrowhead.attachment = ArrowheadAttachment.AtEnd
>>> polyline.arrowhead.size = 10
Type:

float

Arrowhead.style

The style of the arrowhead on the polyline.

Possible values are ArrowheadStyle.Plain, ArrowheadStyle.Hollow and ArrowheadStyle.Filled:

>>> from tecplot.constant import ArrowheadAttachment, ArrowheadStyle
>>> polyline.arrowhead.attachment = ArrowheadAttachment.AtEnd
>>> polyline.arrowhead.style = ArrowheadStyle.Filled
Type:

ArrowheadStyle

Images

Image

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

Image annotation.

This example shows creating an image from a 2D plot and overlaying it on the 3D plot of the same data.

import os

import tecplot as tp
from tecplot.constant import PlotType

examples_dir = tp.session.tecplot_examples_directory()
datafile = os.path.join(examples_dir, 'SimpleData', 'F18.plt')
dataset = tp.data.load_tecplot(datafile)

frame = tp.active_frame()

plot2d = frame.plot(PlotType.Cartesian2D)
plot2d.activate()
plot2d.show_contour = True
plot2d.contour(0).colormap_name = 'Sequential - Blue'
plot2d.contour(0).variable = dataset.variable('S')
tp.export.save_png('embedded_image.png')

plot3d = frame.plot(PlotType.Cartesian3D)
plot3d.activate()
plot3d.show_contour = True
frame.add_image('embedded_image.png', (5, 55), 40)

tp.export.save_png('image.png')
../_images/image.png

Attributes

attached_map_index

Index to the associated fieldmap or linemap.

draw_order

Draw before or after the data.

filename

Source file (read-only).

height

Displayed image height in the coordinate system specified.

macro_function

An associated macro function.

maintain_aspect_ratio

Keep aspect ratio on width or height change.

position

Location on the Frame.

position_coordinate_system

Position coordinate system.

raw_size

Original image size in pixels (read-only).

resize_filter

Smoothing filter.

scope

Display annotation in all frames with the same data.

size

Displayed image size.

type

The type of this annotation (read-only).

width

Displayed image width in the coordinate system specified.

Methods

reset_aspect_ratio()

Restore the aspect ratio to that of the original image.

Image.attached_map_index

Index to the associated fieldmap or linemap.

This property allows an annotation to follow the same active/inactive state as another plot object so their visibility can be changed together. Attach this annotation to a fieldmap or linemap using the object’s index property. Geometries and images that are attached to an inactive or non-existent zone are not displayed. Example usage assuming an annotation variable anno:

>>> anno.attached_map_index = plot.fieldmap(2).index
Type:

Index or None

Image.draw_order

Draw before or after the data.

Annotations can be drawn either before or after the data. If a geometry or image is drawn before the data, the plot layers, such as mesh, contour lines, etc. will be drawn on top of the geometry. Otherwise, the annotation will be drawn last, potentially obscuring the data.

Note

Tecplot 360 draws all geometries and images first, in the order they were added, then all text.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import DrawOrder
>>> anno.draw_order = DrawOrder.BeforeData
Type:

constant.DrawOrder

Image.filename

Source file (read-only).

Example usage:

>>> image = frame.add_imge('my_image.png', (20, 20), 40)
>>> print(image.filename)
my_image.png
Type:

pathlib.Path

Image.height

Displayed image height in the coordinate system specified.

The units for height are determined by the position_coordinate_system of the image. This example sets the height to 40% of the Frame:

>>> from tecplot.constant import CoordSys
>>> image.position_coordinate_system = CoordSys.Frame
>>> image.height = 40
Type:

float

Image.macro_function

An associated macro function.

All geometry or image annotations may be linked to a macro function. This macro function is called when you hold down the Control key (Command key on Mac OS X) and click the right mouse button on the text, geometry or image in the frame.

In order to be attached to a text or geometry object, the macro function must be a “retained” macro function. A macro function is “retained” via either of the following scenarios:

  • running a macro file that contains the required macro functions

  • including it in your tecplot.mcr file (which is run at start up, making it a special case of the preceding scenario)

In both cases, the macro function is defined using the $!MACROFUNCTION macro command. Refer to “$!MACROFUNCTION…$!ENDMACROFUNCTION” on page 157 in the Tecplot Macro Scripting Guide for additional information.

Example usage assuming an annotation variable anno:

>>> anno.macro_function = 'MYMACROFUNCTION'

To run this function from PyTecplot it is neccessary to pass the function to a call to macro.execute_function():

>>> tecplot.macro.execute_function(anno.macro_function)
Type:

str

Image.maintain_aspect_ratio

Keep aspect ratio on width or height change.

Example usage:

>>> image.maintain_aspect_ratio = True
Type:

bool

Image.position

Location on the Frame.

This is the origin of the annotation and will be \((x,y)\) or \((\theta,r)\) depending on the plot type. Example usage assuming an annotation variable anno:

>>> anno.position = (3, 4)
Type:

tuple

Image.position_coordinate_system

Position coordinate system.

The object may be positioned using either the grid coordinate system or the frame coordinate system and must be one of CoordSys.Frame or CoordSys.Grid:

  • CoordSys.Frame: The geometry is always displayed at constant size and position when you zoom in or out of the plot.

  • CoordSys.Grid: The geometry resizes and moves with the data grid. However, the geometry remains fixed when you rotate the plot. Changing the center of rotation may cause the geometry to move.

Example usage assuming an annotation variable anno:

>>> from tecplot.constant import CoordSys
>>> anno.position_coordinate_system = CoordSys.Frame
Type:

CoordSys

Image.raw_size

Original image size in pixels (read-only).

Example usage:

>>> print(image.raw_size)
(600, 400)
Type:

\((width, height)\)

Image.reset_aspect_ratio()[source]

Restore the aspect ratio to that of the original image.

Example usage:

>>> image.reset_aspect_ratio()
Image.resize_filter

Smoothing filter.

Possible values are ImageResizeFilter.Texture, ImageResizeFilter.Box, ImageResizeFilter.Lanczos2, ImageResizeFilter.Lanczos3, ImageResizeFilter.Triangle, ImageResizeFilter.Bell, ImageResizeFilter.BSpline, ImageResizeFilter.Cubic, ImageResizeFilter.Mitchell, ImageResizeFilter.Gaussian. Example usage:

>>> from tecplot.constant import ImageResizeFilter
>>> image.resize_filter = ImageResizeFilter.BSpline
Type:

ImageResizeFilter

Image.scope

Display annotation in all frames with the same data.

Annotations with local scope are displayed only in the Frame in which they are created. If it 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 usage assuming an annotation variable anno:

>>> from tecplot.constant import Scope
>>> anno.scope = Scope.Global
Type:

Scope

Image.size

Displayed image size.

This will be in the coordinates specified by Image.position_coordinate_system. Example usage:

>>> image.size = (40, 20)
Type:

\((width, height)\)

Image.type

The type of this annotation (read-only).

This is the generic type information for geometry and image annotations. This is a read-only parameter and is used, in combination with position_coordinate_system to determine the actual return types of the iterators Frame.geometries() and Frame.images():

>>> frame.add_image('image.png', (1, 1), 5)
>>> frame.add_circle((0,0), 1, CoordSys.Grid)
>>> frame.add_square((0,0), 1, CoordSys.Grid)
>>> for anno in frame.images():
...     print(anno.type)
...
GeomType.Image
>>> for anno in frame.geometries():
...     print(anno.type)
...
GeomType.Circle
GeomType.Square
Type:

GeomType

Image.width

Displayed image width in the coordinate system specified.

The units for width are determined by the position_coordinate_system of the image. This example sets the width to 40% of the Frame:

>>> from tecplot.constant import CoordSys
>>> image.position_coordinate_system = CoordSys.Frame
>>> image.width = 0.4
Type:

float

GeoreferencedImage

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

A Geographic reference image.

A georeferenced can be added to a plot with a call to Frame.add_georeferenced_image(). Placement of the image is controlled by the \((x, y)\) variables of the Frame and the GeoreferencedImage object’s \(z\) parameter.

Attributes

attached_map_index

Index to the associated fieldmap or linemap.

macro_function

An associated macro function.

scope

Display annotation in all frames with the same data.

type

The type of this annotation (read-only).

z

\(z\)-position of the georeferenced image.

GeoreferencedImage.attached_map_index

Index to the associated fieldmap or linemap.

This property allows an annotation to follow the same active/inactive state as another plot object so their visibility can be changed together. Attach this annotation to a fieldmap or linemap using the object’s index property. Geometries and images that are attached to an inactive or non-existent zone are not displayed. Example usage assuming an annotation variable anno:

>>> anno.attached_map_index = plot.fieldmap(2).index
Type:

Index or None

GeoreferencedImage.macro_function

An associated macro function.

All geometry or image annotations may be linked to a macro function. This macro function is called when you hold down the Control key (Command key on Mac OS X) and click the right mouse button on the text, geometry or image in the frame.

In order to be attached to a text or geometry object, the macro function must be a “retained” macro function. A macro function is “retained” via either of the following scenarios:

  • running a macro file that contains the required macro functions

  • including it in your tecplot.mcr file (which is run at start up, making it a special case of the preceding scenario)

In both cases, the macro function is defined using the $!MACROFUNCTION macro command. Refer to “$!MACROFUNCTION…$!ENDMACROFUNCTION” on page 157 in the Tecplot Macro Scripting Guide for additional information.

Example usage assuming an annotation variable anno:

>>> anno.macro_function = 'MYMACROFUNCTION'

To run this function from PyTecplot it is neccessary to pass the function to a call to macro.execute_function():

>>> tecplot.macro.execute_function(anno.macro_function)
Type:

str

GeoreferencedImage.scope

Display annotation in all frames with the same data.

Annotations with local scope are displayed only in the Frame in which they are created. If it 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 usage assuming an annotation variable anno:

>>> from tecplot.constant import Scope
>>> anno.scope = Scope.Global
Type:

Scope

GeoreferencedImage.type

The type of this annotation (read-only).

This is the generic type information for geometry and image annotations. This is a read-only parameter and is used, in combination with position_coordinate_system to determine the actual return types of the iterators Frame.geometries() and Frame.images():

>>> frame.add_image('image.png', (1, 1), 5)
>>> frame.add_circle((0,0), 1, CoordSys.Grid)
>>> frame.add_square((0,0), 1, CoordSys.Grid)
>>> for anno in frame.images():
...     print(anno.type)
...
GeomType.Image
>>> for anno in frame.geometries():
...     print(anno.type)
...
GeomType.Circle
GeomType.Square
Type:

GeomType

GeoreferencedImage.z

\(z\)-position of the georeferenced image.

This is the \(z\) position (typically elevation) of the georeferenced image with respect to the \((x, y, z)\) variables set in the Frame. Example usage:

>>> georefimg.z = 100
Type:

float