Plot Style

Scatter Plots

Scatter

class tecplot.plot.Scatter(plot)[source]

Plot-local scatter style settings.

This class controls the style of drawn scatter points on a specific plot.

from os import path
import tecplot as tp
from tecplot.constant import *

examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, 'SimpleData', 'HeatExchanger.plt')
dataset = tp.data.load_tecplot(infile)

frame = tp.active_frame()
frame.plot_type = PlotType.Cartesian2D
plot = frame.plot()
plot.contour(0).variable = dataset.variable('T(K)')
plot.show_scatter = True

plot.scatter.variable = dataset.variable('P(N)')

for z in dataset.zones():
    scatter = plot.fieldmap(z).scatter
    scatter.symbol_type = SymbolType.Geometry
    scatter.symbol().shape = GeomShape.Circle
    scatter.fill_mode = FillMode.UseSpecificColor
    scatter.fill_color = plot.contour(0)
    scatter.color = plot.contour(0)
    scatter.size_by_variable = True

frame.add_text('Size of dots indicate relative pressure', (20, 80))

# ensure consistent output between interactive (connected) and batch
plot.contour(0).levels.reset_to_nice()

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

Attributes

base_font

Default typeface to use for text scatter symbols.

legend

Scatter symbol legend.

reference_symbol

Reference symbol for scatter plots.

relative_size

Relative size of the reference symbol.

relative_size_units

Use grid or page units for relative size.

sphere_render_quality

render quality of spheres

variable

The Variable to be used when sizing scatter symbols.

variable_index

Zero-based index of the Variable used for size of scatter symbols.

Scatter.base_font

Default typeface to use for text scatter symbols.

Example usage:

>>> plot.scatter.base_font.typeface = 'Times'
Type:

BaseFont

Scatter.legend

Scatter symbol legend.

Example usage:

>>> plot.scatter.legend.show = True
Type:

ScatterLegend

Scatter.reference_symbol

Reference symbol for scatter plots.

The reference scatter symbol is only shown when the scatter symbols are sized by a Variable in the Dataset. Example:

>>> plot.fieldmap(0).scatter.size_by_variable = True
>>> plot.scatter.variable = dataset.variable('s')
>>> plot.scatter.reference_symbol.show = True
Type:

ScatterReferenceSymbol

Scatter.relative_size

Relative size of the reference symbol.

Relative size will be in cm when units are set to RelativeSizeUnits.Page. Example usage:

>>> plot.scatter.relative_size = 20
Type:

float

Scatter.relative_size_units

Use grid or page units for relative size.

Relative size will be in cm when units are set to RelativeSizeUnits.Page. Example usage:

>>> from tecplot.constant import RelativeSizeUnits
>>> plot.scatter.relative_size_units = RelativeSizeUnits.Grid
>>> plot.scatter.relative_size = 2.0
Type:

RelativeSizeUnits

Scatter.sphere_render_quality

render quality of spheres

Example usage:

>>> from tecplot.constant import *
>>> plot.fieldmap(0).scatter.symbol().shape = GeomShape.Sphere
>>> scatter = plot.scatter
>>> scatter.sphere_render_quality = SphereScatterRenderQuality.Low
Type:

SphereScatterRenderQuality

Scatter.variable

The Variable to be used when sizing scatter symbols.

The variable must belong to the Dataset attached to the Frame that holds this ContourGroup. Example usage:

>>> plot.scatter.variable = dataset.variable('P')
>>> plot.fieldmap(0).scatter.size_by_variable = True
Scatter.variable_index

Zero-based index of the Variable used for size of scatter symbols.

>>> plot.scatter.variable_index = dataset.variable('P').index
>>> plot.fieldmap(0).scatter.size_by_variable = True

The Dataset attached to this contour group’s Frame is used, and the variable itself can be obtained through it:

>>> scatter = plot.scatter
>>> scatter_var = dataset.variable(scatter.variable_index)
>>> scatter_var.index == scatter.variable_index
True

ScatterReferenceSymbol

class tecplot.plot.ScatterReferenceSymbol(scatter)[source]

Reference symbol for scatter plots.

Note

The reference scatter symbol is only shown when the scatter symbols are sized by a Variable in the Dataset.

from os import path
import tecplot as tp
from tecplot.constant import *

examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, 'SimpleData', 'HeatExchanger.plt')
dataset = tp.data.load_tecplot(infile)

frame = tp.active_frame()
frame.plot_type = PlotType.Cartesian2D
plot = frame.plot()
plot.contour(0).variable = dataset.variable('T(K)')
plot.show_scatter = True

plot.scatter.variable = dataset.variable('P(N)')

plot.scatter.reference_symbol.show = True
plot.scatter.reference_symbol.symbol().shape = GeomShape.Circle
plot.scatter.reference_symbol.magnitude = plot.scatter.variable.max()
plot.scatter.reference_symbol.color = Color.Green
plot.scatter.reference_symbol.fill_color = Color.Green
plot.scatter.reference_symbol.position = (20, 81)

frame.add_text('Size of dots indicate relative pressure', (23, 80))

for z in dataset.zones():
    scatter = plot.fieldmap(z).scatter
    scatter.symbol_type = SymbolType.Geometry
    scatter.symbol().shape = GeomShape.Circle
    scatter.fill_mode = FillMode.UseSpecificColor
    scatter.fill_color = plot.contour(0)
    scatter.color = plot.contour(0)
    scatter.size_by_variable = True

# ensure consistent output between interactive (connected) and batch
plot.contour(0).levels.reset_to_nice()

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

Attributes

color

The Color of the reference symbol.

fill_color

The fill Color of the reference symbol.

filled

Fill the background area behind the reference symbol.

line_thickness

Edge line thickness for geometry reference symbols.

magnitude

Symbol size relative to data variable ranges.

position

The \((x, y)\) position of the reference symbol.

show

Display a reference scatter symbol on the plot.

symbol_type

The type of symbol to display.

Methods

symbol([symbol_type])

TextSymbol or GeometrySymbol: Style control the displayed symbol.

ScatterReferenceSymbol.color

The Color of the reference symbol.

Example usage:

>>> from tecplot.constant import Color
>>> plot.scatter.reference_symbol.color = Color.Blue
Type:

Color

ScatterReferenceSymbol.fill_color

The fill Color of the reference symbol.

Example usage:

>>> from tecplot.constant import Color
>>> plot.scatter.reference_symbol.fill_color = Color.Blue
Type:

Color

ScatterReferenceSymbol.filled

Fill the background area behind the reference symbol.

The background can be filled with a color or disabled (made transparent) by setting this property to False:

>>> plot.scatter.reference_symbol.filled = True
Type:

bool

ScatterReferenceSymbol.line_thickness

Edge line thickness for geometry reference symbols.

Example usage:

>>> plot.scatter.reference_symbol.line_thickness = 2.5
Type:

float

ScatterReferenceSymbol.magnitude

Symbol size relative to data variable ranges.

Example usage:

>>> plot.scatter.reference_symbol.magnitude = 10.0
Type:

float

ScatterReferenceSymbol.position

The \((x, y)\) position of the reference symbol.

This position is in Frame percentage units:

>>> plot.scatter.reference_symbol.position = (50, 50)
Type:

tuple

ScatterReferenceSymbol.show

Display a reference scatter symbol on the plot.

Example usage:

>>> plot.fieldmap(0).scatter.size_by_variable = True
>>> plot.scatter.variable = dataset.variable('s')
>>> plot.scatter.reference_symbol.show = True
Type:

bool

ScatterReferenceSymbol.symbol(symbol_type=None)[source]

TextSymbol or GeometrySymbol: Style control the displayed symbol.

Example usage:

>>> from tecplot.constant import GeomShape
>>> reference_symbol = plot.scatter.reference_symbol
>>> reference_symbol.symbol = GeomShape.Sphere
ScatterReferenceSymbol.symbol_type

The type of symbol to display.

Example usage:

>>> from tecplot.constant import SymbolType
>>> reference_symbol = plot.scatter.reference_symbol
>>> reference_symbol.symbol_type = SymbolType.Text
Type:

SymbolType

Vector Plots

Vector2D

class tecplot.plot.Vector2D(plot)[source]

Vector field style control for Cartesian 2D plots.

This object controls the style of the vectors that are plotted according to the vector properties under fieldmaps. The \((u,v)\) components are set using this class as well as attributes such as length, arrow-head size and the reference vector. This example shows how to show the vector field, adjusting the arrows color and thickness:

from os import path
import tecplot as tp
from tecplot.constant import *

examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, 'SimpleData', '3ElementWing.lpk')
tp.load_layout(infile)

frame = tp.active_frame()
dataset = frame.dataset
plot = frame.plot(PlotType.Cartesian2D)

frame.background_color = Color.Black
for axis in plot.axes:
    axis.show = False

plot.axes.x_axis.min = -0.2
plot.axes.x_axis.max = 0.3
plot.axes.y_axis.min = -0.2
plot.axes.y_axis.max = 0.15

vect = plot.vector
vect.u_variable = dataset.variable('U(M/S)')
vect.v_variable = dataset.variable('V(M/S)')
vect.relative_length = 0.00025
vect.size_arrowhead_by_fraction = False
vect.arrowhead_size = 4
vect.arrowhead_angle = 10

plot.show_contour = False
plot.show_streamtraces = False
plot.show_edge = True
plot.show_vector = True

cont = plot.contour(0)
cont.variable = dataset.variable('P(N/M2)')
cont.colormap_name = 'Diverging - Blue/Yellow/Red'
cont.levels.reset_levels(80000, 90000, 100000, 110000, 120000)

plot.fieldmaps().show = False

fmap = plot.fieldmap(3)
fmap.show = True
fmap.edge.color = Color.White
fmap.edge.line_thickness = 1
fmap.points.step = 5
fmap.vector.color = cont
fmap.vector.line_thickness = 0.5

tp.export.save_png('vector2d.png', 600, supersample=3)
../_images/vector2d.png

Attributes

arrowhead_angle

Angle between the vector body and the head line.

arrowhead_fraction

Size of the arrowhead when sizing by fraction.

arrowhead_size

Size of arrowhead when sizing by frame height.

even_spacing

Spacing for even vectors.

length

Length of all vectors when not using relative sizing.

reference_vector

Vector field reference vector.

relative_length

Magnitude-varying length of the vector line.

size_arrowhead_by_fraction

Base arrowhead size on length of vector line.

u_variable

\(U\)-component Variable of the plotted vectors.

u_variable_index

\(U\)-component Variable index of the plotted vectors.

use_even_spacing

Use even spacing for vectors.

use_grid_units

Use grid-units when determining the relative length.

use_relative

Use relative sizing for vector lines.

v_variable

\(V\)-component Variable of the plotted vectors.

v_variable_index

\(V\)-component Variable index of the plotted vectors.

Methods

reset_even_spacing()

Reset the even vector spacing.

reset_length()

Reset the vector length.

Vector2D.arrowhead_angle

Angle between the vector body and the head line.

Example usage:

>>> plot.vector.arrowhead_angle = 10
Type:

float (degrees)

Vector2D.arrowhead_fraction

Size of the arrowhead when sizing by fraction.

The size_arrowhead_by_fraction property must be set to True for this to take effect:

>>> plot.vector.size_arrowhead_by_fraction = True
>>> plot.vector.arrowhead_fraction = 0.4
Type:

float (ratio)

Vector2D.arrowhead_size

Size of arrowhead when sizing by frame height.

The size_arrowhead_by_fraction property must be set to False for this to take effect:

>>> plot.vector.size_arrowhead_by_fraction = False
>>> plot.vector.arrowhead_size = 4
Type:

float (percent of frame height)

Vector2D.even_spacing

Spacing for even vectors.

Set the spacing values in axial directions for even spaced vectors. When use_even_spacing is turned on this will selectively remove vectors so that only one vector occupies each grid region defined by the spacing. Spacing is aligned with the X and Y axes.

Example of setting spacing in X to 0.1 and Y to 0.2:

>>> plot.vector.use_even_spacing = True
>>> plot.vector.even_spacing = (0.1, 0.2)
Type:

tuple

Vector2D.length

Length of all vectors when not using relative sizing.

Example usage:

>>> plot.vector.use_relative = False
>>> plot.vector.length = 5
Type:

float (percent of plot height)

Vector2D.reference_vector

Vector field reference vector.

Example usage:

>>> plot.vector.reference_vector.show = True
Type:

ReferenceVector

Vector2D.relative_length

Magnitude-varying length of the vector line.

When use_relative is True, the length of the vectors will be relative to the magnitude of the velocity vector values in the data field, scaled by this parameter which is either grid-units or centimeters per unit magnitude depending on the value of use_grid_units:

>>> plot.vector.use_relative = True
>>> plot.vector.use_grid_units = True
>>> plot.vector.relative_length = 0.003
Type:

float (grid units or cm per magnitude)

Vector2D.reset_even_spacing()

Reset the even vector spacing.

Example usage:

>>> plot.vector.reset_even_spacing()
Vector2D.reset_length()

Reset the vector length.

Example usage:

>>> plot.vector.reset_length()
Vector2D.size_arrowhead_by_fraction

Base arrowhead size on length of vector line.

Example usage:

>>> plot.vector.size_arrowhead_by_fraction = True
>>> plot.vector.relative_length = 0.1
Type:

bool

Vector2D.u_variable

\(U\)-component Variable of the plotted vectors.

Vectors are plotted as \((u,v,w)\). Example usage:

>>> plot.vector.u_variable = dataset.variable('Pressure X')
Type:

Variable

Vector2D.u_variable_index

\(U\)-component Variable index of the plotted vectors.

Vectors are plotted as \((u,v,w)\). Example usage:

>>> plot.vector.u_variable_index = 3
Type:

int (Zero-based index)

Vector2D.use_even_spacing

Use even spacing for vectors.

When True this will selectively remove vectors from the plot to approximately enforce the display intervals specified by even_spacing.

Turn on even spacing:

>>> plot.vector.use_even_spacing = True
Type:

bool

Vector2D.use_grid_units

Use grid-units when determining the relative length.

This takes effect only if use_relative is True. If False, relative_length will be in cm per magnitude:

>>> plot.vector.use_relative = True
>>> plot.vector.use_grid_units = False
>>> plot.vector.relative_length = 0.010
Type:

bool

Vector2D.use_relative

Use relative sizing for vector lines.

This determines whether length or relative_length are used to size the arrow lines. Example usage:

>>> plot.vector.use_relative = False
>>> plot.vector.relative_length = 0.5
Type:

bool

Vector2D.v_variable

\(V\)-component Variable of the plotted vectors.

Vectors are plotted as \((u,v,w)\). Example usage:

>>> plot.vector.v_variable = dataset.variable('Pressure Y')
Type:

Variable

Vector2D.v_variable_index

\(V\)-component Variable index of the plotted vectors.

Vectors are plotted as \((u,v,w)\). Example usage:

>>> plot.vector.v_variable_index = 4
Type:

int (Zero-based index)

Vector3D

class tecplot.plot.Vector3D(plot)[source]

Vector field style control for Cartesian 3D plots.

This object controls the style of the vectors that are plotted according to the vector properties under fieldmaps. The \((u,v,w)\) components are set using this class as well as attributes such as length, arrow-head size and the reference vector. See the example for 2D vector plots.

Attributes

arrowhead_angle

Angle between the vector body and the head line.

arrowhead_fraction

Size of the arrowhead when sizing by fraction.

arrowhead_size

Size of arrowhead when sizing by frame height.

even_spacing

Spacing for even vectors.

length

Length of all vectors when not using relative sizing.

reference_vector

Vector field reference vector.

relative_length

Magnitude-varying length of the vector line.

size_arrowhead_by_fraction

Base arrowhead size on length of vector line.

u_variable

\(U\)-component Variable of the plotted vectors.

u_variable_index

\(U\)-component Variable index of the plotted vectors.

use_even_spacing

Use even spacing for vectors.

use_grid_units

Use grid-units when determining the relative length.

use_relative

Use relative sizing for vector lines.

v_variable

\(V\)-component Variable of the plotted vectors.

v_variable_index

\(V\)-component Variable index of the plotted vectors.

w_variable

\(W\)-component Variable of the plotted vectors.

w_variable_index

\(W\)-component Variable index of the plotted vectors.

Methods

reset_even_spacing()

Reset the even vector spacing.

reset_length()

Reset the vector length.

Vector3D.arrowhead_angle

Angle between the vector body and the head line.

Example usage:

>>> plot.vector.arrowhead_angle = 10
Type:

float (degrees)

Vector3D.arrowhead_fraction

Size of the arrowhead when sizing by fraction.

The size_arrowhead_by_fraction property must be set to True for this to take effect:

>>> plot.vector.size_arrowhead_by_fraction = True
>>> plot.vector.arrowhead_fraction = 0.4
Type:

float (ratio)

Vector3D.arrowhead_size

Size of arrowhead when sizing by frame height.

The size_arrowhead_by_fraction property must be set to False for this to take effect:

>>> plot.vector.size_arrowhead_by_fraction = False
>>> plot.vector.arrowhead_size = 4
Type:

float (percent of frame height)

Vector3D.even_spacing

Spacing for even vectors.

Set the spacing values in axial directions for even spaced vectors. When use_even_spacing is turned on this will selectively remove vectors so that only one vector occupies each grid region defined by the spacing. Spacing is aligned with the X, Y, and Z axes.

Example of setting spacing in X to 0.1, Y to 0.2 and Z to 0.3:

>>> plot.vector.use_even_spacing = True
>>> plot.vector.even_spacing = (0.1, 0.2, 0.3)
Type:

tuple

Vector3D.length

Length of all vectors when not using relative sizing.

Example usage:

>>> plot.vector.use_relative = False
>>> plot.vector.length = 5
Type:

float (percent of plot height)

Vector3D.reference_vector

Vector field reference vector.

Example usage:

>>> plot.vector.reference_vector.show = True
Type:

ReferenceVector

Vector3D.relative_length

Magnitude-varying length of the vector line.

When use_relative is True, the length of the vectors will be relative to the magnitude of the velocity vector values in the data field, scaled by this parameter which is either grid-units or centimeters per unit magnitude depending on the value of use_grid_units:

>>> plot.vector.use_relative = True
>>> plot.vector.use_grid_units = True
>>> plot.vector.relative_length = 0.003
Type:

float (grid units or cm per magnitude)

Vector3D.reset_even_spacing()

Reset the even vector spacing.

Example usage:

>>> plot.vector.reset_even_spacing()
Vector3D.reset_length()

Reset the vector length.

Example usage:

>>> plot.vector.reset_length()
Vector3D.size_arrowhead_by_fraction

Base arrowhead size on length of vector line.

Example usage:

>>> plot.vector.size_arrowhead_by_fraction = True
>>> plot.vector.relative_length = 0.1
Type:

bool

Vector3D.u_variable

\(U\)-component Variable of the plotted vectors.

Vectors are plotted as \((u,v,w)\). Example usage:

>>> plot.vector.u_variable = dataset.variable('Pressure X')
Type:

Variable

Vector3D.u_variable_index

\(U\)-component Variable index of the plotted vectors.

Vectors are plotted as \((u,v,w)\). Example usage:

>>> plot.vector.u_variable_index = 3
Type:

int (Zero-based index)

Vector3D.use_even_spacing

Use even spacing for vectors.

When True this will selectively remove vectors from the plot to approximately enforce the display intervals specified by even_spacing.

Turn on even spacing:

>>> plot.vector.use_even_spacing = True
Type:

bool

Vector3D.use_grid_units

Use grid-units when determining the relative length.

This takes effect only if use_relative is True. If False, relative_length will be in cm per magnitude:

>>> plot.vector.use_relative = True
>>> plot.vector.use_grid_units = False
>>> plot.vector.relative_length = 0.010
Type:

bool

Vector3D.use_relative

Use relative sizing for vector lines.

This determines whether length or relative_length are used to size the arrow lines. Example usage:

>>> plot.vector.use_relative = False
>>> plot.vector.relative_length = 0.5
Type:

bool

Vector3D.v_variable

\(V\)-component Variable of the plotted vectors.

Vectors are plotted as \((u,v,w)\). Example usage:

>>> plot.vector.v_variable = dataset.variable('Pressure Y')
Type:

Variable

Vector3D.v_variable_index

\(V\)-component Variable index of the plotted vectors.

Vectors are plotted as \((u,v,w)\). Example usage:

>>> plot.vector.v_variable_index = 4
Type:

int (Zero-based index)

Vector3D.w_variable

\(W\)-component Variable of the plotted vectors.

Vectors are plotted as \((u,v,w)\). Example usage:

>>> plot.vector.w_variable = dataset.variable('Pressure Z')
Type:

Variable

Vector3D.w_variable_index

\(W\)-component Variable index of the plotted vectors.

Vectors are plotted as \((u,v,w)\). Example usage:

>>> plot.vector.w_variable_index = 5
Type:

int (Zero-based index)

ReferenceVector

class tecplot.plot.ReferenceVector(vector)[source]

Vector field reference vector.

The reference vector is a single arrow with an optional label indicating the value of the shown reference length:

from os import path
import tecplot as tp
from tecplot.constant import *

examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, 'SimpleData', 'VortexShedding.plt')
tp.data.load_tecplot(infile)

frame = tp.active_frame()
dataset = frame.dataset
plot = frame.plot(PlotType.Cartesian2D)

for txt in frame.texts():
    frame.delete_text(txt)

vector_contour = plot.contour(0)
vector_contour.variable = dataset.variable('T(K)')
vector_contour.colormap_name = 'Magma'
vector_contour.colormap_filter.reversed = True
vector_contour.legend.show = False
base_contour = plot.contour(1)
base_contour.variable = dataset.variable('P(N/M2)')
base_contour.colormap_name = 'GrayScale'
base_contour.colormap_filter.reversed = True
base_contour.legend.show = False

vector = plot.vector
vector.u_variable = dataset.variable('U(M/S)')
vector.v_variable = dataset.variable('V(M/S)')
vector.relative_length = 1E-5
vector.arrowhead_size = 0.2
vector.arrowhead_angle = 16

ref_vector = vector.reference_vector
ref_vector.show = True
ref_vector.position = 50, 95
ref_vector.line_thickness = 0.4
ref_vector.label.show = True
ref_vector.label.format.format_type = NumberFormat.FixedFloat
ref_vector.label.format.precision = 1
ref_vector.magnitude = 100

fmap = plot.fieldmap(0)
fmap.contour.flood_contour_group = base_contour
fmap.vector.color = vector_contour
fmap.vector.line_thickness = 0.4

plot.show_contour = True
plot.show_streamtraces = False
plot.show_vector = True

plot.axes.y_axis.min = -0.005
plot.axes.y_axis.max = 0.005
plot.axes.x_axis.min = -0.002
plot.axes.x_axis.max = 0.008

tp.export.save_png('vector2d_reference.png', 600, supersample=3)
../_images/vector2d_reference.png

Attributes

angle

Degrees counter-clockwise to rotate the reference vector.

color

Color of the reference vector.

label

reference vector label style control.

line_thickness

reference vector line thickness.

magnitude

Length of the reference vector.

position

\((x,y)\) of the reference vector in percent of frame height.

show

Draw the reference vector.

ReferenceVector.angle

Degrees counter-clockwise to rotate the reference vector.

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.angle = 90  # vertical, up
Type:

float (degrees)

ReferenceVector.color

Color of the reference vector.

Example usage:

>>> from tecplot.constant import Color
>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.color = Color.Red
Type:

Color

ReferenceVector.label

reference vector label style control.

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.label.show = True
Type:

ReferenceVectorLabel

ReferenceVector.line_thickness

reference vector line thickness.

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.line_thickness = 0.3
Type:

float (percentage of frame height)

ReferenceVector.magnitude

Length of the reference vector.

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.magnitude = 2
Type:

float (data units)

ReferenceVector.position

\((x,y)\) of the reference vector in percent of frame height.

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.position = (50, 5)  # bottom, center
Type:

tuple

ReferenceVector.show

Draw the reference vector.

Example usage:

>>> plot.vector.reference_vector.show = True
Type:

bool

ReferenceVectorLabel

class tecplot.plot.ReferenceVectorLabel(ref_vector)[source]

Label for the reference vector.

See the example under ReferenceVector.

Attributes

color

Color of the reference vector label.

font

Typeface of the reference vector label.

format

Number formatting control for the reference vector label.

offset

Distance from the reference vector to the associated label.

show

Print a label next to the reference vector.

ReferenceVectorLabel.color

Color of the reference vector label.

Example usage:

>>> from tecplot.constant import Color
>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.label.show = True
>>> ref_vector.label.color = Color.Red
Type:

Color

ReferenceVectorLabel.font

Typeface of the reference vector label.

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.label.show = True
>>> ref_vector.label.font.size = 6
Type:

text.Font

ReferenceVectorLabel.format

Number formatting control for the reference vector label.

Example usage:

>>> from tecplot.constant import NumberFormat
>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.label.show = True
>>> ref_vector.label.format.format_type = NumberFormat.Exponential
Type:

LabelFormat

ReferenceVectorLabel.offset

Distance from the reference vector to the associated label.

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.label.show = True
>>> ref_vector.label.offset = 10
Type:

float (percent of frame height)

ReferenceVectorLabel.show

Print a label next to the reference vector.

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.label.show = True
Type:

bool

Legends

ContourLegend

class tecplot.legend.ContourLegend(contour, *svargs)[source]

Contour legend attributes.

This class allows you to customize the appearance of the contour legend. The contour legend can be positioned anywhere inside the frame using the position attribute of this class. Example usage:

import os
import numpy as np

import tecplot
from tecplot.constant import *

# By loading a layout many style and view properties are set up already
examples_dir = tecplot.session.tecplot_examples_directory()
datafile = os.path.join(examples_dir, 'SimpleData', 'RainierElevation.lay')
tecplot.load_layout(datafile)

frame = tecplot.active_frame()
plot = frame.plot()

# Rename the elevation variable
frame.dataset.variable('E').name = "Elevation (m)"

# Set the levels to nice values
plot.contour(0).levels.reset_levels(np.linspace(200,4400,22))

legend = plot.contour(0).legend
legend.show = True
legend.vertical = False  # Horizontal
legend.auto_resize = False
legend.label_step = 5

legend.overlay_bar_grid = False
legend.position = (55, 94)  # Frame percentages

legend.box.box_type = TextBox.None_ # Remove Text box

legend.header.font.typeface = 'Courier'
legend.header.font.bold = True

legend.number_font.typeface = 'Courier'
legend.number_font.bold = True

tecplot.export.save_png('legend_contour.png', 600, supersample=3)
../_images/legend_contour.png

Attributes

anchor_alignment

Anchor location of the legend.

auto_resize

Skip levels to create a reasonably sized legend.

box

Legend box attributes.

header

LegendHeader associated with a ContourLegend.

label_format

Number formatting for labels along the legend.

label_increment

Spacing between labels along the contour legend.

label_location

Placement of labels on the legend.

label_step

Step size between labels along the legend.

number_font

Font used to display numbers in the legend.

overlay_bar_grid

Draw a line around each band in the legend color bar.

position

Position as a percentage of frame width/height.

row_spacing

Spacing between rows in the legend.

show

Show or hide the legend.

show_cutoff_levels

Show color bands for levels affected by color cutoff.

text_color

Color of legend text.

vertical

Orientation of the legend.

ContourLegend.anchor_alignment

Anchor location of the legend.

Example usage:

>>> from tecplot.constant import PlotType, AnchorAlignment
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.anchor_alignment = AnchorAlignment.BottomCenter
Type:

AnchorAlignment

ContourLegend.auto_resize

Skip levels to create a reasonably sized legend.

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.auto_resize = True
Type:

bool

ContourLegend.box

Legend box attributes.

Example usage:

>>> from tecplot.constant import PlotType, Color
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.box.color = Color.Blue
Type:

text.TextBox

ContourLegend.header

LegendHeader associated with a ContourLegend.

This object controls the attributes of the contour legend header.

New in version 1.4.2: The contour legend header style control has been moved into a new namespace header:

Old API

New API

contour.legend.show_header

contour.legend.header.show

contour.legend.header_font

contour.legend.header.font

Example usage:

>>> plot.contour(0).legend.header.show = True
Type:

LegendHeader

ContourLegend.label_format

Number formatting for labels along the legend.

This is an alias for ContourLegend.contour.labels.format:

>>> contour = frame.plot().contour(0)
>>> contour.legend.label_format.precision = 3
>>> print(contour.labels.format.precision)
3
Type:

LabelFormat

ContourLegend.label_increment

Spacing between labels along the contour legend.

Labels will be placed on the contour variable range from min to max. The smaller the increment value the more legend labels will be created. If the label_location is ContLegendLabelLocation.Increment, labels are incremented by this value. For example, a label_increment value of .5 will show labels at .5, 1.0, 1.5, etc.

Note

This value is only used if label_location is set to ContLegendLabelLocation.Increment. Otherwise it is ignored.

Example usage:

>>> from tecplot.constant import PlotType, ContLegendLabelLocation
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.label_location = ContLegendLabelLocation.Increment
>>> legend.label_increment = .5

See also

label_location

Type:

float

ContourLegend.label_location

Placement of labels on the legend.

If you have selected ColorMapDistribution.Continuous for the contour colormap filter distribution, you have three options for placement of labels on the legend:

Example usage:

>>> from tecplot.constant import PlotType, ContLegendLabelLocation
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.label_location = ContourLevelLabelLocation.Increment
>>> legend.label_increment = .5

See also

label_increment

Type:

ContLegendLabelLocation

ContourLegend.label_step

Step size between labels along the legend.

This is an alias for ContourLegend.contour.labels.step:

>>> contour = frame.plot().contour(0)
>>> contour.legend.label_step = 3
>>> print(contour.labels.step)
3
Type:

int

ContourLegend.number_font

Font used to display numbers in the legend.

Note

The font size_units property may only be set to Units.Frame or Units.Point.

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.number_font.italic = True
Type:

text.Font

ContourLegend.overlay_bar_grid

Draw a line around each band in the legend color bar.

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.overlay_bar_grid = False
Type:

bool

ContourLegend.position

Position as a percentage of frame width/height.

The legend is automatically placed for you. You may specify the \((x,y)\) position of the legend by setting this value, where \(x\) is the percentage of frame width, and \(y\) is a percentage of frame height.

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.position = (.1, .3)
>>> pos = legend.position
>>> pos.x  # == position[0]
.1
>>> pos.y  # == position[1]
.3
Type:

tuple

ContourLegend.row_spacing

Spacing between rows in the legend.

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.row_spacing = 1.5
Type:

float

ContourLegend.show

Show or hide the legend.

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.show = True
Type:

bool

ContourLegend.show_cutoff_levels

Show color bands for levels affected by color cutoff.

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.show_cutoff_levels = True
Type:

bool

ContourLegend.text_color

Color of legend text.

Example usage:

>>> from tecplot.constant import PlotType, Color
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.text_color = Color.Blue
Type:

Color

ContourLegend.vertical

Orientation of the legend.

When set to True, the legend is vertical. When set to False, the legend is horizontal.

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.vertical = False  # Show horizontal legend
Type:

bool

LegendHeader

class tecplot.legend.LegendHeader(legend, *svargs)[source]

Attributes

custom_text

A string to be used in the contour legend header.

font

Font used to display the legend header.

show

Show or hide the contour legend header.

text_type

Typesetter for the contour legend header.

use_custom_text

Use custom text on the contour legend header.

LegendHeader.custom_text

A string to be used in the contour legend header.

If the use_custom_text property is set to True, the legend header will contain this text instead of the name of the variable assigned to the contour group. The text may contain Dynamic Text and formatting tags (see User Manual).

Example usage:

>>> from tecplot.constant import PlotType
>>> plot = frame.plot(PlotType.Cartesian3D)
>>> header = plot.contour(0).legend.header
>>> header.use_custom_text = True
>>> header.custom_text = 'time: &(SOLUTIONTIME) <greek>ms</greek>'

See also: LegendHeader.use_custom_text

New in version 2021.2: The ability to specify custom contour legend header text requires Tecplot 360 2021 R2 or later.

New in version 1.4.2.

Type:

str

LegendHeader.font

Font used to display the legend header.

Note

The font size_units property may only be set to Units.Frame or Units.Point.

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.header.font.italic = True
Type:

text.Font

LegendHeader.show

Show or hide the contour legend header.

Note

The header text will display the name of the variable assigned to the contour group or a custom text if the use_custom_text is set to True.

Example usage:

>>> from tecplot.constant import PlotType
>>> plot = frame.plot(PlotType.Cartesian3D)
>>> legend_header = plot.contour(0).legend.header
>>> legend_header.show = True
Type:

bool

LegendHeader.text_type

Typesetter for the contour legend header.

This determines how the header text for the contour legend is rendered. Options are TextType.Regular or TextType.LaTeX. When using LaTeX, make sure to use Python raw strings so that literal back-slashes are preserved.

Example usage:

>>> from tecplot.constant import PlotType, TextType
>>> plot = frame.plot(PlotType.Cartesian3D)
>>> header = plot.contour(0).legend.header
>>> header.text_type = TextType.LaTeX
>>> header.use_custom_text = True
>>> header.custom_text = r'\LaTeX'

New in version 2022.1: The ability to use LaTeX for contour legend header text requires Tecplot 360 2022 R1 or later.

New in version 1.5.0.

Type:

TextType

LegendHeader.use_custom_text

Use custom text on the contour legend header.

If set to True, the legend header will be set by the custom_text property instead of the variable name assigned to the contour group.

Example usage:

>>> from tecplot.constant import PlotType
>>> plot = frame.plot(PlotType.Cartesian3D)
>>> header = plot.contour(0).legend.header
>>> header.use_custom_text = True
>>> header.custom_text = 'Solution time: &(SOLUTIONTIME) ms'

See also: LegendHeader.custom_text

New in version 2021.2: The ability to specify custom contour legend header text requires Tecplot 360 2021 R2 or later.

New in version 1.4.2.

Type:

bool

LineLegend

class tecplot.legend.LineLegend(plot)[source]

Line plot legend attributes.

The XY line legend shows the line and symbol attributes of XY mappings. In XY line plots, this legend includes the bar chart information. The legend can be positioned anywhere within the line plot frame by setting the position attribute. By default, all mappings are shown, but Tecplot 360 removes redundant entries. Example usage:

import os

import tecplot
from tecplot.constant import *

examples_dir = tecplot.session.tecplot_examples_directory()
datafile = os.path.join(examples_dir, 'SimpleData', 'Rainfall.dat')
dataset = tecplot.data.load_tecplot(datafile)

frame = tecplot.active_frame()
plot = frame.plot()
frame.plot_type = tecplot.constant.PlotType.XYLine

for i in range(3):
    plot.linemap(i).show = True
    plot.linemap(i).line.line_thickness = .4

y_axis = plot.axes.y_axis(0)
y_axis.title.title_mode = AxisTitleMode.UseText
y_axis.title.text = 'Rainfall (in)'
y_axis.fit_range_to_nice()

legend = plot.legend
legend.show = True
legend.box.box_type = TextBox.Filled
legend.box.color = Color.Purple
legend.box.fill_color = Color.LightGrey
legend.box.line_thickness = .4
legend.box.margin = 5

legend.anchor_alignment = AnchorAlignment.MiddleRight
legend.row_spacing = 1.5
legend.show_text = True
legend.font.typeface = 'Arial'
legend.font.italic = True

legend.text_color = Color.Black
legend.position = (90, 88)

tecplot.export.save_png('legend_line.png', 600, supersample=3)
../_images/legend_line.png

Attributes

anchor_alignment

Anchor location of the legend.

box

Legend box attributes.

font

Legend font attributes.

position

Position as a percentage of frame width/height.

row_spacing

Spacing between rows in the legend.

show

Show or hide the legend.

show_text

Show/hide mapping names in the legend.

text_color

Color of legend text.

LineLegend.anchor_alignment

Anchor location of the legend.

Example usage:

>>> from tecplot.constant import AnchorAlignment, PlotType
>>> legend = frame.plot(PlotType.XYLine).legend
>>> legend.anchor_alignment = AnchorAlignment.BottomCenter
Type:

AnchorAlignment

LineLegend.box

Legend box attributes.

Example usage:

>>> from tecplot.constant import PlotType, Color
>>> plot = frame.plot(PlotType.XYLine)
>>> plot.legend.box.color = Color.Blue
Type:

text.TextBox

LineLegend.font

Legend font attributes.

Note

The font size_units property may only be set to Units.Frame or Units.Point.

Example usage:

>>> from tecplot.constant import PlotType
>>> plot = frame.plot(PlotType.XYLine)
>>> plot.legend.font.italic = True
Type:

text.Font

LineLegend.position

Position as a percentage of frame width/height.

The legend is automatically placed for you. You may specify the \((x,y)\) position of the legend by setting this value, where \(x\) is the percentage of frame width, and \(y\) is a percentage of frame height.

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.XYLine).legend
>>> legend.position = (10, 30)
Type:

tuple

LineLegend.row_spacing

Spacing between rows in the legend.

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.XYLine).legend
>>> legend.row_spacing = 1.5
Type:

float

LineLegend.show

Show or hide the legend.

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.XYLine).legend
>>> legend.show = True
Type:

bool

LineLegend.show_text

Show/hide mapping names in the legend.

Example usage:

>>> from tecplot.constant import PlotType
>>> plot = frame.plot(PlotType.XYLine)
>>> plot.legend.show_text = True
Type:

bool

LineLegend.text_color

Color of legend text.

Example usage:

>>> from tecplot.constant import PlotType, Color
>>> legend = frame.plot(PlotType.XYLine).legend
>>> legend.text_color = Color.Blue
Type:

Color

RGBColoringLegend

class tecplot.legend.RGBColoringLegend(rgb_coloring)[source]

Legend for RGB coloring (multivariate contour) plots.

Note

The RGB coloring legend will only show when an active fieldmap’s contour is being flooded by RGB.

import os
import numpy as np

import tecplot as tp
from tecplot.constant import *

def normalize_variable(dataset, varname, nsigma=2):
    '''
    Normalize a variable such that the specified number of standard deviations
    are within the range [0.5, 1] and the mean is transformed to 0.5. The
    new variable will append " normalized" to the original variable's name.
    '''
    with tp.session.suspend():
        newvarname = varname + ' normalized'
        dataset.add_variable(newvarname)
        data = np.concatenate([z.values(varname).as_numpy_array()
                               for z in dataset.zones()])
        vmin = data.mean() - nsigma * data.std()
        vmax = data.mean() + nsigma * data.std()
        for z in dataset.zones():
            arr = z.values(varname).as_numpy_array()
            z.values(newvarname)[:] = (arr - vmin) / (vmax - vmin)


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

frame = tp.active_frame()
plot = frame.plot(PlotType.Cartesian2D)
plot.show_contour = True

# Variables must be normalized relative to each other
# to make effective use of RGB coloring.
normalize_variable(dataset, 'T(K)')
normalize_variable(dataset, 'P(N)')

plot.rgb_coloring.mode = RGBMode.SpecifyGB

# all three channel variables must be set even if
# we are only contouring on two of them.
plot.rgb_coloring.red_variable = dataset.variable(0)
plot.rgb_coloring.green_variable = dataset.variable('P(N) normalized')
plot.rgb_coloring.blue_variable = dataset.variable('T(K) normalized')

plot.rgb_coloring.legend.show = True
plot.rgb_coloring.legend.green_label = 'Pressure'
plot.rgb_coloring.legend.blue_label = 'Temperature'

plot.fieldmaps().contour.flood_contour_group = plot.rgb_coloring

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

Attributes

anchor_alignment

Anchor location of the legend.

blue_label

Label to use for the blue channel.

box

Legend box attributes.

font

Legend font attributes.

green_label

Label to use for the green channel.

height

Size of RGB coloring legend

orientation

Placement of the RGB channels on the legend.

position

Position as a percentage of frame width/height.

red_label

Label to use for the red channel.

show

Display the RGB coloring legend.

show_labels

Show the RGB channel labels.

text_color

Color of legend text.

use_variable_for_blue_label

Use the Variable name for the blue channel.

use_variable_for_green_label

Use the Variable name for the green channel.

use_variable_for_red_label

Use the Variable name for the red channel.

RGBColoringLegend.anchor_alignment

Anchor location of the legend.

Example usage:

>>> from tecplot.constant import AnchorAlignment
>>> legend = plot.rgb_coloring.legend
>>> legend.anchor_alignment = AnchorAlignment.BottomCenter
Type:

AnchorAlignment

RGBColoringLegend.blue_label

Label to use for the blue channel.

This can be set to a string (which may be empty) but the use_variable_for_blue_label property must be set to False for this label to be shown:

>>> plot.rgb_coloring.legend.use_variable_for_blue_label = False
>>> plot.rgb_coloring.legend.blue_label = 'water'
Type:

str

RGBColoringLegend.box

Legend box attributes.

Example usage:

>>> from tecplot.constant import Color
>>> plot.rgb_coloring.legend.box.fill_color = Color.Yellow
Type:

text.TextBox

RGBColoringLegend.font

Legend font attributes.

Note

The font size_units property may only be set to Units.Frame or Units.Point.

Example usage:

>>> plot.rgb_coloring.legend.font.italic = True
Type:

text.Font

RGBColoringLegend.green_label

Label to use for the green channel.

This can be set to a string (which may be empty) but the use_variable_for_green_label property must be set to False for this label to be shown:

>>> plot.rgb_coloring.legend.use_variable_for_green_label = False
>>> plot.rgb_coloring.legend.green_label = 'oil'
Type:

str

RGBColoringLegend.height

Size of RGB coloring legend

Example usage:

>>> plot.rgb_coloring.legend.height = 20
Type:

float

RGBColoringLegend.orientation

Placement of the RGB channels on the legend.

The first color is on the bottom left, the second is on the bottom right, and the third is on top. Example usage:

>>> from tecplot.constant import RGBLegendOrientation
>>> legend = plot.rgb_coloring.legend
>>> legend.orientation = RGBLegendOrientation.RBG
Type:

RGBLegendOrientation

RGBColoringLegend.position

Position as a percentage of frame width/height.

The legend is automatically placed for you. You may specify the \((x,y)\) position of the legend by setting this value, where \(x\) is the percentage of frame width, and \(y\) is a percentage of frame height.

Example usage:

>>> plot.rgb_coloring.legend.position = (20, 80)
Type:

tuple

RGBColoringLegend.red_label

Label to use for the red channel.

This can be set to a string (which may be empty) but the use_variable_for_red_label property must be set to False for this label to be shown:

>>> plot.rgb_coloring.legend.use_variable_for_red_label = False
>>> plot.rgb_coloring.legend.red_label = 'gas'
Type:

str

RGBColoringLegend.show

Display the RGB coloring legend.

Example usage:

>>> plot.rgb_coloring.legend.show = True
Type:

bool

RGBColoringLegend.show_labels

Show the RGB channel labels.

Example usage:

>>> legend = plot.rgb_coloring.legend
>>> legend.show_labels = True
>>> legend.red_label = 'Variable A'
>>> legend.green_label = 'Variable B'
>>> legend.blue_label = 'Variable C'
Type:

bool

RGBColoringLegend.text_color

Color of legend text.

Example usage:

>>> from tecplot.constant import Color
>>> legend = plot.rgb_coloring.legend
>>> legend.text_color = Color.Blue
Type:

Color

RGBColoringLegend.use_variable_for_blue_label

Use the Variable name for the blue channel.

Example usage:

>>> plot.rgb_coloring.legend.use_variable_for_blue_label = False
>>> plot.rgb_coloring.legend.blue_label = 'gas'
Type:

bool

RGBColoringLegend.use_variable_for_green_label

Use the Variable name for the green channel.

Example usage:

>>> plot.rgb_coloring.legend.use_variable_for_green_label = False
>>> plot.rgb_coloring.legend.green_label = 'gas'
Type:

bool

RGBColoringLegend.use_variable_for_red_label

Use the Variable name for the red channel.

Example usage:

>>> plot.rgb_coloring.legend.use_variable_for_red_label = False
>>> plot.rgb_coloring.legend.red_label = 'gas'
Type:

bool

ScatterLegend

class tecplot.legend.ScatterLegend(scatter)[source]

Legend style for scatter plots.

from os import path
import tecplot as tp
from tecplot.constant import *

examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, 'SimpleData', 'HeatExchanger.plt')
dataset = tp.data.load_tecplot(infile)

frame = tp.active_frame()
frame.plot_type = PlotType.Cartesian2D
plot = frame.plot()
plot.show_scatter = True

# make space for the legend
plot.axes.viewport.right = 70
plot.axes.x_axis.min = 4
plot.axes.x_axis.max = 7

# assign some shape and color to each fieldmap
for i, fmap in enumerate(plot.fieldmaps()):
    for zone in fmap.zones:
        zone.name = 'Zone {}'.format(i)
    fmap.scatter.symbol().shape = GeomShape(i % 7)
    fmap.scatter.fill_mode = FillMode.UseSpecificColor
    fmap.scatter.fill_color = Color(i % 7)

plot.scatter.legend.show = True
plot.scatter.legend.row_spacing = 0.95

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

Attributes

anchor_alignment

Anchor location of the legend.

box

Legend box attributes.

font

Legend font attributes.

position

Position as a percentage of frame width/height.

row_spacing

Spacing between rows in the legend.

show

Show or hide the legend.

show_text

Show/hide mapping names in the legend.

text_color

Color of legend text.

ScatterLegend.anchor_alignment

Anchor location of the legend.

Example usage:

>>> from tecplot.constant import AnchorAlignment
>>> legend = plot.scatter.legend
>>> legend.anchor_alignment = AnchorAlignment.BottomCenter
Type:

AnchorAlignment

ScatterLegend.box

Legend box attributes.

Example usage:

>>> from tecplot.constant import PlotType, Color
>>> plot.scatter.legend.box.color = Color.Blue
Type:

text.TextBox

ScatterLegend.font

Legend font attributes.

Note

The font size_units property may only be set to Units.Frame or Units.Point.

Example usage:

>>> plot.scatter.legend.font.italic = True
Type:

text.Font

ScatterLegend.position

Position as a percentage of frame width/height.

The legend is automatically placed for you. You may specify the \((x,y)\) position of the legend by setting this value, where \(x\) is the percentage of frame width, and \(y\) is a percentage of frame height.

Example usage:

>>> plot.scatter.legend.position = (10, 30)
Type:

tuple

ScatterLegend.row_spacing

Spacing between rows in the legend.

Example usage:

>>> plot.scatter.legend.row_spacing = 1.5
Type:

float

ScatterLegend.show

Show or hide the legend.

Example usage:

>>> plot.scatter.legend.show = True
Type:

bool

ScatterLegend.show_text

Show/hide mapping names in the legend.

Example usage:

>>> plot.scatter.legend.show_text = True
Type:

bool

ScatterLegend.text_color

Color of legend text.

Example usage:

>>> from tecplot.constant import Color
>>> plot.scatter.legend.text_color = Color.Blue
Type:

Color

Contours

ContourGroup

class tecplot.plot.ContourGroup(index, plot)[source]

Contouring of a variable using a colormap.

This object controls the style for a specific contour group within a Frame. Contour levels, colormap and contour lines are accessed through this class:

from os import path
import tecplot as tp
from tecplot.constant import *

# load data
examples_dir = tp.session.tecplot_examples_directory()
datafile = path.join(examples_dir,'SimpleData','CircularContour.plt')
dataset = tp.data.load_tecplot(datafile)
plot = dataset.frame.plot()
plot.show_contour = True

contour = plot.contour(0)
contour.variable = dataset.variable('Mix')
contour.colormap_name = 'Magma'

# ensure consistent output between interactive (connected) and batch
contour.levels.reset_to_nice()

# save image to file
tp.export.save_png('contour_magma.png', 600, supersample=3)
../_images/contour_magma.png

There are a fixed number of contour groups available for each plot. Others can be enabled and modified by specifying an index other than zero:

>>> contour3 = plot.contour(3)
>>> contour3.variable = dataset.variable('U')

Attributes

color_cutoff

ContourColorCutoff object controlling color cutoff min/max.

colormap_filter

ContourColormapFilter object controlling colormap style properties.

colormap_name

The name of the colormap (str) to be used.

default_num_levels

Default target number (int) of levels used when resetting.

labels

ContourLabels object controlling contour line labels.

legend

ContourLegend associated with this ContourGroup.

levels

ContourLevels holding the list of contour levels.

lines

ContourLines object controlling contour line style.

variable

The Variable being contoured.

variable_index

Zero-based index of the Variable being contoured.

ContourGroup.color_cutoff

ContourColorCutoff object controlling color cutoff min/max.

>>> cutoff = plot.contour(0).color_cutoff
>>> cutoff.min = 3.14
Type:

ContourColorCutoff

ContourGroup.colormap_filter

ContourColormapFilter object controlling colormap style properties.

>>> plot.contour(0).colormap_filter.reverse = True
Type:

ContourColormapFilter

ContourGroup.colormap_name

The name of the colormap (str) to be used.

Example:

>>> plot.contour(0).colormap_name = 'Sequential - Yellow/Green/Blue'
Type:

str

ContourGroup.default_num_levels

Default target number (int) of levels used when resetting.

Example:

>>> plot.contour(0).default_num_levels = 20
Type:

int

ContourGroup.labels

ContourLabels object controlling contour line labels.

Lines must be turned on through the associated fieldmap object for style changes to be meaningful:

>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).labels.show = True
Type:

ContourLabels

ContourGroup.legend

ContourLegend associated with this ContourGroup.

This object controls the attributes of the contour legend associated with this ContourGroup.

Example usage:

>>> plot.contour(0).legend.show = True
Type:

ContourLegend

ContourGroup.levels

ContourLevels holding the list of contour levels.

This object controls the values of the contour levels. Values can be added, deleted or overridden completely:

>>> plot.contour(0).levels.reset_to_nice(15)
Type:

ContourLevels

ContourGroup.lines

ContourLines object controlling contour line style.

Lines must be turned on through the associated fieldmap object for style changes to be meaningful:

>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).lines.mode = ContourLineMode.DashNegative
Type:

ContourLines

ContourGroup.variable

The Variable being contoured.

The variable must belong to the Dataset attached to the Frame that holds this ContourGroup. Example usage:

>>> plot.contour(0).variable = dataset.variable('P')
ContourGroup.variable_index

Zero-based index of the Variable being contoured.

>>> plot.contour(0).variable_index = dataset.variable('P').index

The Dataset attached to this contour group’s Frame is used:

>>> contour = plot.contour(0)
>>> contour_var = frame.dataset.variable(contour.variable_index)
>>> contour_var.index == contour.variable_index
True

ContourColorCutoff

class tecplot.plot.ContourColorCutoff(contour)[source]

Color-mapped value limits to display.

This lets you specify a range within which contour flooding and multi-colored objects, such as scatter symbols, are displayed:

import os
import tecplot as tp
from tecplot.constant import PlotType, SurfacesToPlot

# load the data
examples_dir = tp.session.tecplot_examples_directory()
datafile = os.path.join(examples_dir,'SimpleData','Pyramid.plt')
dataset = tp.data.load_tecplot(datafile)

# show boundary faces and contours
plot = tp.active_frame().plot()
surfaces = plot.fieldmap(0).surfaces
surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
plot.show_contour = True

# cutoff contour flooding outside min/max range
cutoff = plot.contour(0).color_cutoff
cutoff.include_min = True
cutoff.min = 0.5
cutoff.include_max = True
cutoff.max = 1.0
cutoff.inverted = True

# ensure consistent output between interactive (connected) and batch
plot.contour(0).levels.reset_to_nice()

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

Attributes

include_max

Use the maximum cutoff value.

include_min

Use the minimum cutoff value.

inverted

Cuts values outside the range instead of inside.

max

The maximum cutoff value.

min

The minimum cutoff value.

ContourColorCutoff.include_max

Use the maximum cutoff value.

Thie example turns off the maximum cutoff:

>>> plot.contour(0).color_cutoff.include_max = False
Type:

bool

ContourColorCutoff.include_min

Use the minimum cutoff value.

Example usage:

>>> plot.contour(0).color_cutoff.include_min = True
>>> plot.contour(0).color_cutoff.min = 3.14
Type:

bool

ContourColorCutoff.inverted

Cuts values outside the range instead of inside.

>>> plot.contour(0).color_cutoff.inverted = True
Type:

bool

ContourColorCutoff.max

The maximum cutoff value.

The include_max must be set to True:

>>> plot.contour(0).color_cutoff.include_max = True
>>> plot.contour(0).color_cutoff.max = None
Type:

float or None

ContourColorCutoff.min

The minimum cutoff value.

The include_min must be set to True:

>>> plot.contour(0).color_cutoff.include_min = True
>>> plot.contour(0).color_cutoff.min = 3.14
Type:

float or None

ContourColormapFilter

class tecplot.plot.ContourColormapFilter(contour)[source]

Controls how the colormap is rendered for a given contour.

from os import path
import tecplot as tp
from tecplot.constant import *

# load the data
examples_dir = tp.session.tecplot_examples_directory()
datafile = path.join(examples_dir,'SimpleData','HeatExchanger.plt')
ds = tp.data.load_tecplot(datafile)

# set plot type to 2D field plot
frame = tp.active_frame()
frame.plot_type = PlotType.Cartesian2D
plot = frame.plot()

# show boundary faces and contours
surfaces = plot.fieldmap(0).surfaces
surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
plot.show_contour = True

# by default, contour 0 is the one that's shown,
# set the contour's variable, colormap and number of levels
contour = plot.contour(0)
contour.variable = ds.variable('P(N)')

# cycle through the colormap three times and reversed
# show a faithful (non-approximate) continuous distribution
contour_filter = contour.colormap_filter
contour_filter.num_cycles = 3
contour_filter.reversed = True
contour_filter.fast_continuous_flood = False
contour_filter.distribution = ColorMapDistribution.Continuous

# ensure consistent output between interactive (connected) and batch
contour.levels.reset_to_nice()

# save image to file
tp.export.save_png('contour_filtered.png', 600, supersample=3)
../_images/contour_filtered.png

Attributes

continuous_max

Upper limit for continuous colormap flooding.

continuous_min

Lower limit for continuous colormap flooding.

distribution

Rendering style of the colormap.

fast_continuous_flood

Use a fast approximation to continuously flood the colormap.

num_cycles

Number of cycles to repeat the colormap.

reversed

Reverse the colormap.

show_overrides

Enable the colormap overrides in this contour group.

zebra_shade

Returns a ContourColormapZebraShade filtering object.

Methods

override(index)

Returns a ContourColormapOverride object by index.

ContourColormapFilter.continuous_max

Upper limit for continuous colormap flooding.

Example set the limits to the (min, max) of a variable in a specific zone:

>>> from tecplot.constant import ColorMapDistribution
>>> cmap_filter = plot.contour(0).colormap_filter
>>> cmap_filter.distribution = ColorMapDistribution.Continuous
>>> pressure = dataset.variable('Pressure').values('My Zone')
>>> cmap_filter.continuous_min = pressure.min()
>>> cmap_filter.continuous_max = pressure.max()
Type:

float

ContourColormapFilter.continuous_min

Lower limit for continuous colormap flooding.

Example usage:

>>> from tecplot.constant import ColorMapDistribution
>>> cmap_filter = plot.contour(0).colormap_filter
>>> cmap_filter.distribution = ColorMapDistribution.Continuous
>>> cmap_filter.continuous_min = 3.1415
Type:

float

ContourColormapFilter.distribution

Rendering style of the colormap.

Possible values:

Banded

A solid color is assigned for all values within the band between two levels.

Continuous

The color distribution assigns linearly varying colors to all multi-colored objects or contour flooded regions.

Example:

>>> from tecplot.constant import ColorMapDistribution
>>> cmap_filter = plot.contour(0).colormap_filter
>>> cmap_filter.distribution = ColorMapDistribution.Banded
Type:

ColorMapDistribution

ContourColormapFilter.fast_continuous_flood

Use a fast approximation to continuously flood the colormap.

Causes each cell to be flooded using interpolation between the color values at each node. When the transition from a color at one node to another node crosses over the boundary between control points in the color spectrum, fast flooding may produce colors not in the spectrum. Setting this to False is slower, but more accurate:

>>> cmap_filter = plot.contour(0).colormap_filter
>>> cmap_filter.fast_continuous_flood = True
Type:

bool

ContourColormapFilter.num_cycles

Number of cycles to repeat the colormap.

>>> plot.contour(0).colormap_filter.num_cycles = 3
Type:

int

ContourColormapFilter.override(index)[source]

Returns a ContourColormapOverride object by index.

Parameters:

index (int) – The index of the colormap override object.

Returns:

ContourColormapOverride – The class controlling the specific contour colormap override requested by index.

Example:

>>> cmap_override = plot.contour(0).colormap_filter.override(0)
>>> cmap_override.show = True
ContourColormapFilter.reversed

Reverse the colormap.

>>> plot.contour(0).colormap_filter.reversed = True
Type:

bool

ContourColormapFilter.show_overrides

Enable the colormap overrides in this contour group.

The overrides themselves must be turned on as well for this to have an effect on the resulting plot:

>>> contour = plot.contour(0)
>>> cmap_filter = contour.colormap_filter
>>> cmap_filter.show_overrides = True
>>> cmap_filter.override(0).show = True
Type:

bool

ContourColormapFilter.zebra_shade

Returns a ContourColormapZebraShade filtering object.

Example usage:

>>> zebra = plot.contour(0).colormap_filter.zebra_shade
>>> zebra.show = True
Type:

ContourColormapZebraShade

ContourColormapOverride

class tecplot.plot.ContourColormapOverride(index, colormap_filter)[source]

Assigns contour bands to specific color.

Specific contour bands can be assigned a unique basic color. This is useful for forcing a particular region to use blue, for example, to designate an area of water. You can define up to 16 color overrides:

from os import path
import tecplot as tp
from tecplot.constant import *

# load the data
examples_dir = tp.session.tecplot_examples_directory()
datafile = path.join(examples_dir, 'SimpleData', 'HeatExchanger.plt')
dataset = tp.data.load_tecplot(datafile)

# set plot type to 2D field plot
frame = tp.active_frame()
frame.plot_type = PlotType.Cartesian2D
plot = frame.plot()

# show boundary faces and contours
surfaces = plot.fieldmap(0).surfaces
surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
plot.show_contour = True

# by default, contour 0 is the one that's shown,
# set the contour's variable, colormap and number of levels
contour = plot.contour(0)
contour.variable = dataset.variable('T(K)')
contour.colormap_name = 'Sequential - Yellow/Green/Blue'
contour.levels.reset(9)

# turn on colormap overrides for this contour
contour_filter = contour.colormap_filter
contour_filter.show_overrides = True

# turn on override 0, coloring the first 4 levels red
contour_override = contour_filter.override(0)
contour_override.show = True
contour_override.color = Color.Red
contour_override.start_level = 7
contour_override.end_level = 8

# save image to file
tp.export.save_png('contour_override.png', 600, supersample=3)
../_images/contour_override.png

Attributes

color

Color which will override the colormap.

end_level

Last level to override.

show

Include this colormap override when filter is shown.

start_level

First level to override.

ContourColormapOverride.color

Color which will override the colormap.

Example usage:

>>> from tecplot.constant import Color
>>> colormap_filter = plot.contour(0).colormap_filter
>>> cmap_override = colormap_filter.override(0)
>>> cmap_override.color = Color.Blue
Type:

Color

ContourColormapOverride.end_level

Last level to override.

Example usage:

>>> colormap_filter = plot.contour(0).colormap_filter
>>> cmap_override = colormap_filter.override(0)
>>> cmap_override.end_level = 2
Type:

int

ContourColormapOverride.show

Include this colormap override when filter is shown.

Example usage:

>>> colormap_filter = plot.contour(0).colormap_filter
>>> cmap_override = colormap_filter.override(0)
>>> cmap_override.show = True
Type:

bool

ContourColormapOverride.start_level

First level to override.

Example usage:

>>> colormap_filter = plot.contour(0).colormap_filter
>>> cmap_override = colormap_filter.override(0)
>>> cmap_override.start_level = 2
Type:

int

ContourColormapZebraShade

class tecplot.plot.ContourColormapZebraShade(colormap_filter)[source]

This filter sets a uniform color for every other band.

Setting the color to None turns the bands off and makes them transparent:

from os import path
import numpy as np
import tecplot as tp
from tecplot.constant import Color, SurfacesToPlot

# load the data
examples_dir = tp.session.tecplot_examples_directory()
datafile = path.join(examples_dir,'SimpleData','Pyramid.plt')
dataset = tp.data.load_tecplot(datafile)

# show boundary faces and contours
plot = tp.active_frame().plot()
surfaces = plot.fieldmap(0).surfaces
surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
plot.show_contour = True
plot.show_shade = False

# set zebra filter on and make the zebra contours transparent
cont0 = plot.contour(0)
zebra = cont0.colormap_filter.zebra_shade
zebra.show = True
zebra.transparent = True

# ensure consistent output between interactive (connected) and batch
cont0.levels.reset_to_nice()

tp.export.save_png('contour_zebra.png', 600, supersample=3)
../_images/contour_zebra.png

Attributes

color

Color of the zebra shading.

show

Show zebra shading in this ContourGroup.

transparent

Set the the zebra bands to be transparent.

ContourColormapZebraShade.color

Color of the zebra shading.

Example usage:

>>> from tecplot.constant import Color
>>> filter = plot.contour(0).colormap_filter
>>> zebra = filter.zebra_shade
>>> zebra.show = True
>>> zebra.color = Color.Blue
Type:

Color

ContourColormapZebraShade.show

Show zebra shading in this ContourGroup.

Example usage:

>>> cmap_filter = plot.contour(0).colormap_filter
>>> cmap_filter.zebra_shade.show = True
Type:

bool

ContourColormapZebraShade.transparent

Set the the zebra bands to be transparent.

Example usage:

>>> filter = plot.contour(0).colormap_filter
>>> zebra = filter.zebra_shade
>>> zebra.show = True
>>> zebra.transparent = True
Type:

bool

ContourLabels

class tecplot.plot.ContourLabels(contour)[source]

Contour line label style, position and alignment control.

These are labels that identify particular contour levels either by value or optionally, by number starting from one. The plot type must be lines or lines and flood in order to see them:

from os import path
import tecplot as tp
from tecplot.constant import Color, ContourType, SurfacesToPlot

# load the data
examples_dir = tp.session.tecplot_examples_directory()
datafile = path.join(examples_dir,'SimpleData','Pyramid.plt')
dataset = tp.data.load_tecplot(datafile)

# show boundary faces and contours
plot = tp.active_frame().plot()
plot.fieldmap(0).contour.contour_type = ContourType.Lines
surfaces = plot.fieldmap(0).surfaces
surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
plot.show_contour = True

# set contour label style
contour_labels = plot.contour(0).labels
contour_labels.show = True
contour_labels.auto_align = False
contour_labels.color = Color.Blue
contour_labels.background_color = Color.White
contour_labels.margin = 20

# ensure consistent output between interactive (connected) and batch
plot.contour(0).levels.reset_to_nice()

tp.export.save_png('contour_labels.png', 600, supersample=3)
../_images/contour_labels.png

Attributes

auto_align

Automatically align the labels with the contour lines.

auto_generate

Automatically generate labels along contour lines.

background_color

Background fill color behind the text labels.

color

Text color of the labels.

filled

Fill the background area behind the text labels.

font

text.Font used to show the labels.

format

Number formatting for contour labels.

label_by_level

Use the contour numbers as the label instead of the data value.

margin

Spacing around the text and the filled background area.

show

Show the contour line labels.

spacing

Spacing between labels along the contour lines.

step

Number of contour lines from one label to the next.

ContourLabels.auto_align

Automatically align the labels with the contour lines.

This causes the flow of the text to be aligned with the contour lines. Otherwise, the labels are aligned with the frame:

>>> from tecplot.constant import ContourType
>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).labels.show = True
>>> plot.contour(0).labels.auto_align = False
Type:

bool

ContourLabels.auto_generate

Automatically generate labels along contour lines.

This causes a new set of contour labels to be created at each redraw:

>>> from tecplot.constant import Color, ContourType
>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).labels.show = True
>>> plot.contour(0).labels.auto_generate = True
Type:

bool

ContourLabels.background_color

Background fill color behind the text labels.

The filled attribute must be set to True:

>>> from tecplot.constant import Color, ContourType
>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).labels.show = True
>>> plot.contour(0).labels.background_color = Color.Blue
Type:

Color

ContourLabels.color

Text color of the labels.

Example:

>>> from tecplot.constant import Color, ContourType
>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).labels.show = True
>>> plot.contour(0).labels.color Color.Blue
Type:

Color

ContourLabels.filled

Fill the background area behind the text labels.

The background can be filled with a color or disabled (made transparent) by setting this property to False:

>>> from tecplot.constant import Color, ContourType
>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).labels.show = True
>>> plot.contour(0).labels.filled = True
>>> plot.contour(0).labels.background_color = Color.Blue
>>> plot.contour(1).labels.show = True
>>> plot.contour(1).labels.filled = False
Type:

bool

ContourLabels.font

text.Font used to show the labels.

Example:

>>> from tecplot.constant import Color, ContourType
>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).labels.show = True
>>> plot.contour(0).labels.font.size = 3.5
Type:

text.Font

ContourLabels.format

Number formatting for contour labels.

Example usage:

>>> from tecplot.constant import NumberFormat
>>> contour = plot.contour(0)
>>> contour.labels.format.format_type = NumberFormat.Integer
Type:

LabelFormat

ContourLabels.label_by_level

Use the contour numbers as the label instead of the data value.

Contour level numbers start from one when drawn. Example usage:

>>> from tecplot.constant import Color, ContourType
>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).labels.show = True
>>> plot.contour(0).labels.label_by_level = True
Type:

bool

ContourLabels.margin

Spacing around the text and the filled background area.

Contour numbers start from one when drawn. Example usage:

>>> from tecplot.constant import Color, ContourType
>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).labels.show = True
>>> plot.contour(0).labels.background_color = Color.Yellow
>>> plot.contour(0).labels.margin = 20
Type:

float in percentage of the text height.

ContourLabels.show

Show the contour line labels.

Contour lines must be on for this to have any effect:

>>> from tecplot.constant import ContourType
>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).labels.show = True
Type:

bool

ContourLabels.spacing

Spacing between labels along the contour lines.

This is the distance between each label along each contour line in percentage of the frame height:

>>> from tecplot.constant import ContourType
>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).labels.show = True
>>> plot.contour(0).labels.spacing = 20
Type:

float

ContourLabels.step

Number of contour lines from one label to the next.

This is the number of contour bands between lines that are to be labeled:

>>> from tecplot.constant import ContourType
>>> plot.fieldmap(0).contour.contour_type = ContourType.Lines
>>> plot.contour(0).labels.show = True
>>> plot.contour(0).labels.step = 4
Type:

int

ContourLevels

class tecplot.plot.ContourLevels(contour)[source]

List of contour level values.

A contour level is a value at which contour lines are drawn, or for banded contour flooding, the border between different colors of flooding. Initially, each contour group consists of approximately 10 levels evenly spaced over the z coordinate in the Frame’s Dataset. These values can be manipulated with the ContourLevels object obtained via the ContourGroup.levels attribute:

from os import path
import numpy as np
import tecplot as tp

# load layout
examples_dir = tp.session.tecplot_examples_directory()
example_layout = path.join(examples_dir,'SimpleData','3ElementWing.lpk')
tp.load_layout(example_layout)
frame = tp.active_frame()

levels = frame.plot().contour(0).levels
levels.reset_levels(np.linspace(55000,115000,61))

# save image to file
tp.export.save_png('contour_adjusted_levels.png', 600, supersample=3)
../_images/contour_adjusted_levels.png

Note

The streamtraces in the plot above is a side-effect of settings in layout file used. For more information about streamtraces, see the plot.Streamtraces class reference.

Methods

add(*values)

Adds new levels to the existing list.

delete_nearest(value)

Removes the level closest to the specified value.

delete_range(min_value, max_value)

Inclusively, deletes all levels within a specified range.

reset([num_levels])

Resets the levels to the number specified.

reset_levels(*values)

Resets the levels to the values specified.

reset_to_nice([num_levels])

Approximately resets the levels to the number specified.

ContourLevels.add(*values)[source]

Adds new levels to the existing list.

Parameters:

*values (floats) – The level values to be added to the ContourGroup.

The values added are inserted into the list of levels in ascending order:

>>> levels = plot.contour(0).levels
>>> list(levels)
[0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
>>> levels.add(3.14159)
>>> list(levels)
[0.0, 1.0, 2.0, 3.0, 3.14159, 4.0, 5.0]
ContourLevels.delete_nearest(value)[source]

Removes the level closest to the specified value.

Parameters:

value (float) – Value of the level to remove.

This method deletes the contour level with the value nearest the supplied value:

>>> plot.contour(0).levels.delete_nearest(3.14)
ContourLevels.delete_range(min_value, max_value)[source]

Inclusively, deletes all levels within a specified range.

Parameters:
  • min_value (float) – Minimum value to remove.

  • max_value (float) – Maximum value to remove.

This method deletes all contour levels between the specified minimum and maximum values of the contour variable (inclusive):

>>> plot.contour(0).levels.delete_range(0.5, 1.5)
ContourLevels.reset(num_levels=15)[source]

Resets the levels to the number specified.

Parameters:

num_levels (int) – Number of levels. (default: 10)

This will reset the contour levels to a set of evenly distributed values spanning the entire range of the currently selected contouring variable:

>>> plot.contour(0).levels.reset(30)
ContourLevels.reset_levels(*values)[source]

Resets the levels to the values specified.

Parameters:

*values (floats) – The level values to be added to the ContourGroup.

This method replaces the current set of contour levels with a new set. Here, we set the levels to go from 0 to 100 in steps of 5:

>>> plot.contour(0).levels.reset_levels(*range(0,101,5))
ContourLevels.reset_to_nice(num_levels=15)[source]

Approximately resets the levels to the number specified.

Parameters:

num_levels (int) – Approximate number of levels to create. (default: 15)

This will reset the contour levels to a set of evenly distributed values that approximately spans the range of the currently selected contouring variable. Exact range and number of levels will be adjusted to make the contour levels have “nice” values:

>>> plot.contour(0).levels.reset_to_nice(50)

ContourLines

class tecplot.plot.ContourLines(contour)[source]

Contour line style.

This object sets the style of the contour lines once turned on:

from os import path
import tecplot as tp
from tecplot.constant import (ContourLineMode, ContourType,
                              SurfacesToPlot)

# load the data
examples_dir = tp.session.tecplot_examples_directory()
datafile = path.join(examples_dir,'SimpleData','Pyramid.plt')
dataset = tp.data.load_tecplot(datafile)

# show boundary faces and contours
plot = tp.active_frame().plot()
plot.fieldmap(0).contour.contour_type = ContourType.Lines
surfaces = plot.fieldmap(0).surfaces
surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
plot.show_contour = True

# set contour line style
contour_lines = plot.contour(0).lines
contour_lines.mode = ContourLineMode.SkipToSolid
contour_lines.step = 4
contour_lines.pattern_length = 2

# ensure consistent output between interactive (connected) and batch
plot.contour(0).levels.reset_to_nice()

tp.export.save_png('contour_lines.png', 600, supersample=3)
../_images/contour_lines.png

Attributes

mode

Type of lines to draw on the plot (ContourLineMode).

pattern_length

Length of dashed lines and space between dashes (float).

step

Number of lines to step for SkipToSolid line mode (int).

ContourLines.mode

Type of lines to draw on the plot (ContourLineMode).

Possible values:

UseZoneLineType

For each zone, draw the contour lines using the line pattern and pattern length specified in the FieldmapContour for the parent Fieldmaps. If you are adding contour lines to polyhedral zones, the patterns will not be continuous from one cell to the next and the pattern will restart at every cell boundary.

SkipToSolid

Draw dashed lines between each pair of solid lines which are spaced out by the ContourLines.step property. This will override any line pattern or thickness setting in the parent Fieldmaps’s FieldmapContour object.

DashNegative

Draw lines of positive contour variable value as solid lines and lines of negative contour variable value as dashed lines. This will override any line pattern or thickness setting in the parent Fieldmaps’s FieldmapContour object.

Example:

>>> from tecplot.constant import ContourLineMode
>>> lines = plot.contour(0).lines
>>> lines.mode = ContourLineMode.DashNegative
Type:

ContourLineMode

ContourLines.pattern_length

Length of dashed lines and space between dashes (float).

The length is in percentage of the frame height:

>>> from tecplot.constant import ContourLineMode
>>> lines = plot.contour(0).lines
>>> lines.mode = ContourLineMode.SkipToSolid
>>> lines.step = 5
>>> lines.pattern_length = 5
Type:

float

ContourLines.step

Number of lines to step for SkipToSolid line mode (int).

Example:

>>> from tecplot.constant import ContourLineMode
>>> lines = plot.contour(0).lines
>>> lines.mode = ContourLineMode.SkipToSolid
>>> lines.step = 5
Type:

int

RGBColoring

class tecplot.plot.RGBColoring(plot)[source]

RGB coloring (multivariate contour) style control.

import os
import numpy as np

import tecplot as tp
from tecplot.constant import *


def normalize_variable(dataset, varname, nsigma=2):
    '''
    Normalize a variable such that the specified number of standard deviations
    are within the range [0.5, 1] and the mean is transformed to 0.5. The
    new variable will append " normalized" to the original variable's name.
    '''
    with tp.session.suspend():
        newvarname = varname + ' normalized'
        dataset.add_variable(newvarname)
        data = np.concatenate([z.values(varname).as_numpy_array()
                               for z in dataset.zones()])
        vmin = data.mean() - nsigma * data.std()
        vmax = data.mean() + nsigma * data.std()
        for z in dataset.zones():
            arr = z.values(varname).as_numpy_array()
            z.values(newvarname)[:] = (arr - vmin) / (vmax - vmin)


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

frame = tp.active_frame()
plot = frame.plot(PlotType.Cartesian2D)
plot.show_contour = True

# Variables must be normalized relative to each other
# to make effective use of RGB coloring.
normalize_variable(dataset, 'T(K)')
normalize_variable(dataset, 'P(N)')

plot.rgb_coloring.mode = RGBMode.SpecifyGB

# all three channel variables must be set even if
# we are only contouring on two of them.
plot.rgb_coloring.red_variable = dataset.variable(0)
plot.rgb_coloring.green_variable = dataset.variable('P(N) normalized')
plot.rgb_coloring.blue_variable = dataset.variable('T(K) normalized')

plot.rgb_coloring.legend.show = True
plot.rgb_coloring.legend.use_variable_for_green_label = False
plot.rgb_coloring.legend.green_label = 'Pressure'
plot.rgb_coloring.legend.use_variable_for_blue_label = False
plot.rgb_coloring.legend.blue_label = 'Temperature'

plot.fieldmaps().contour.flood_contour_group = plot.rgb_coloring

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

Attributes

blue_variable

Variable to use for the blue channel.

blue_variable_index

Variable Index to use for the blue channel.

green_variable

Variable to use for the green channel.

green_variable_index

Variable Index to use for the green channel.

legend

Legend placement and style control.

max_intensity

Variable value at maximum intensity for each channel.

min_intensity

Variable value at minimum intensity for each channel.

mode

Which channels to use for RGB coloring.

red_variable

Variable to use for the red channel.

red_variable_index

Variable Index to use for the red channel.

RGBColoring.blue_variable

Variable to use for the blue channel.

Example usage:

>>> plot.rgb_coloring.blue_variable = dataset.variable('Water')

Note

In connected mode, setting this property requires Tecplot 360 version 2018 R2 or later.

Type:

Variable

RGBColoring.blue_variable_index

Variable Index to use for the blue channel.

Example usage:

>>> plot.rgb_coloring.blue_variable_index = 4

Note

In connected mode, setting this property requires Tecplot 360 version 2018 R2 or later.

Type:

Index

RGBColoring.green_variable

Variable to use for the green channel.

Example usage:

>>> plot.rgb_coloring.green_variable = dataset.variable('Oil')

Note

In connected mode, setting this property requires Tecplot 360 version 2018 R2 or later.

Type:

Variable

RGBColoring.green_variable_index

Variable Index to use for the green channel.

Example usage:

>>> plot.rgb_coloring.green_variable_index = 3

Note

In connected mode, setting this property requires Tecplot 360 version 2018 R2 or later.

Type:

Index

RGBColoring.legend

Legend placement and style control.

Example usage:

>>> plot.rgb_coloring.legend.show = True
Type:

RGBColoringLegend

RGBColoring.max_intensity

Variable value at maximum intensity for each channel.

This should typically be set to the maximum value of the data being plotted:

>>> plot.rgb_coloring.max_intensity = dataset.variable('P').max()
Type:

float

RGBColoring.min_intensity

Variable value at minimum intensity for each channel.

This should typically be set to the minimum value of the data being plotted:

>>> plot.rgb_coloring.min_intensity = dataset.variable('P').min()
Type:

float

RGBColoring.mode

Which channels to use for RGB coloring.

Example usage:

>>> from tecplot.constant import RGBMode
>>> plot.rgb_coloring.mode = RGBMode.SpecifyRB
Type:

RGBMode

RGBColoring.red_variable

Variable to use for the red channel.

Example usage:

>>> plot.rgb_coloring.red_variable = dataset.variable('Gas')

Note

In connected mode, setting this property requires Tecplot 360 version 2018 R2 or later.

Type:

Variable

RGBColoring.red_variable_index

Variable Index to use for the red channel.

Example usage:

>>> plot.rgb_coloring.red_variable_index = 5

Note

In connected mode, setting this property requires Tecplot 360 version 2018 R2 or later.

Type:

Index

Isosurface

IsosurfaceGroup

class tecplot.plot.IsosurfaceGroup(index, plot)[source]

Isosurfaces style control.

import os
import tecplot as tp
from tecplot.constant import *

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

plot = tp.active_frame().plot()
plot.show_isosurfaces = True
plot.contour(0).colormap_name = 'Magma'
plot.contour(0).variable = dataset.variable('Mach')
plot.contour(0).levels.reset_levels( [.95,1.0,1.1,1.4])
plot.contour(0).legend.show = False

iso = plot.isosurface(0)
iso.show = True
iso.definition_contour_group = plot.contour(0)
iso.isosurface_selection = IsoSurfaceSelection.ThreeSpecificValues
iso.isosurface_values = [.95,1,1.1]

iso.contour.show = True
iso.contour.flood_contour_group = plot.contour(0)

iso.effects.use_translucency = True
iso.effects.surface_translucency = 80

view = plot.view
view.psi = 65.777
view.theta = 166.415
view.alpha = -1.05394
view.position = (-23.92541680486183, 101.8931504712126, 47.04269529295333)
view.width = 1.3844

tp.export.save_png('isosurface_group.png', 600, supersample=3)
../_images/isosurface_group.png

Attributes

contour

Contour attributes for this isosurface group.

definition_contour_group

Contour group from which isosurfaces are based.

definition_contour_group_index

Contour group index from which isosurfaces are based.

effects

Settings for isosurface effects.

isosurface_selection

Select where to draw isosurfaces.

isosurface_values

Values at which to draw isosurfaces.

mesh

Mesh attributes for this isosurface group.

obey_source_zone_blanking

Obey source zone blanking.

shade

Shade attributes for this isosurface group.

show

Show isosurfaces for this isosurface group.

surface_generation_method

Determines how the surface is generated.

use_slice_clipping

Clip isosurface by any intersecting slices.

vector

Vector attributes for this isosurface group.

Methods

extract([mode, assign_strand_ids])

Create new zones from this isosurface.

IsosurfaceGroup.contour

Contour attributes for this isosurface group.

Example usage:

>>> plot.isosurface(0).show = True
>>> plot.isosurface(0).contour.show = True
Type:

IsosurfaceContour

IsosurfaceGroup.definition_contour_group

Contour group from which isosurfaces are based.

Example usage:

>>> group = plot.contour(1)
>>> plot.isosurface(0).definition_contour_group = group
Type:

ContourGroup

IsosurfaceGroup.definition_contour_group_index

Contour group index from which isosurfaces are based.

Contour group settings can be changed from plot.ContourGroup.

Example usage:

>>> plot.isosurface(0).show = True
>>> plot.isosurface(0).definition_contour_group_index = 1
Type:

Index

IsosurfaceGroup.effects

Settings for isosurface effects.

Example usage:

>>> plot.isosurface(0).show = True
>>> plot.isosurface(0).effects.use_translucency = True
Type:

IsosurfaceEffects

IsosurfaceGroup.extract(mode=ExtractMode.SingleZone, assign_strand_ids=True)[source]

Create new zones from this isosurface.

Extracts the current isosurfaces represented by this group to the Dataset as one or more zones.

Parameters:
Returns:

The extracted zone if mode is ExtractMode.SingleZone, otherwise a generator of the extracted zones.

Example usage:

>>> isosurface_zone = plot.isosurface(0).extract()

New in version 2017.3: Isosurface extraction requires Tecplot 360 2017 R3 or later.

IsosurfaceGroup.isosurface_selection

Select where to draw isosurfaces.

Iso-surfaces may be drawn at:
  • Contour group levels

  • At specified value(s) - Specify up to three values of the contour variable at which to draw isosurfaces.

To draw isosurfaces at contour group lines:
  1. Set isosurface_selection to IsoSurfaceSelection.AllContourLevels.

  2. Optional: Change tecplot.plot.ContourLevels

To draw isosurfaces at up to 3 values:
  1. Set isosurface_selection to one of the following: IsoSurfaceSelection.OneSpecificValue IsoSurfaceSelection.TwoSpecificValues IsoSurfaceSelection.ThreeSpecificValues

  2. Set isosurface_values to a 1, 2, or 3 tuple of floats

See also isosurface_values.

Example usage:

>>> plot.isosurface(0).show = True
>>> plot.isosurface(0).isosurface_selection = IsoSurfaceSelection.TwoSpecificValues
>>> plot.isosurface(0).isosurface_values = (.3, .8)
Type:

IsoSurfaceSelection

IsosurfaceGroup.isosurface_values

Values at which to draw isosurfaces.

This may be a 1, 2, or 3-tuple of floats, or a single scalar float.

To draw isosurfaces at up to 3 values:
  1. Set isosurface_selection to one of the following: IsoSurfaceSelection.OneSpecificValue IsoSurfaceSelection.TwoSpecificValues IsoSurfaceSelection.ThreeSpecificValues

  2. Set isosurface_values to a 1, 2, or 3 tuple or list of floats, or set to a scalar float to assign the first value only.

When queried, this property will always return a 3 tuple of floats.

See also isosurface_selection.

Assign first isosurface value using a scalar float:

>>> plot.isosurface(0).isosurface_selection = IsoSurfaceSelection.OneSpecificValue
>>> plot.isosurface(0).isosurface_values = 0.5
>>> plot.isosurface(0).isosurface_values[0]
0.5

Assign first isosurface value using a 1-tuple:

>>> plot.isosurface(0).isosurface_selection = IsoSurfaceSelection.OneSpecificValue
>>> plot.isosurface(0).isosurface_values = (.5,) # 1-tuple
>>> plot.isosurface(0).isosurface_values
0.5

Assign all three isosurface values:

>>> plot.isosurface(0).isosurface_selection = IsoSurfaceSelection.ThreeSpecificValues
>>> plot.isosurface(0).isosurface_values = (.5, .7, 9)

Assign the third isosurface values after assigning the first two:

>>> plot.isosurface(0).isosurface_selection = IsoSurfaceSelection.ThreeSpecificValues
>>> # Assign first and second isosurface value using a tuple
>>> plot.isosurface(0).isosurface_values = (0.0, 0.1)
>>> # Assign third isosurface value
>>> plot.isosurface(0).isosurface_values[2] = .3
>>> plot.isosurface(0).isosurface_values[2]
.3
>>> plot.isosurface(0).isosurface_values
(0.0, 0.1, .3)

Query the three isosurface values:

>>> # isosurface_values always returns a
>>> # list-like object of 3 floats with of current
>>> # isosurface values, even if fewer than three have been set.
>>> values = plot.isosurface(0).isosurface_values
>>> values
(0.1, 0.2, 0.3)
>>> values[0]
0.1
>>> values[1]
0.2
>>> values[2]
0.3
>>> len(values)
3
Type:

tuple or float

IsosurfaceGroup.mesh

Mesh attributes for this isosurface group.

Example usage:

>>> plot.isosurface(0).show = True
>>> plot.isosurface(0).mesh.show = True
Type:

IsosurfaceMesh

IsosurfaceGroup.obey_source_zone_blanking

Obey source zone blanking.

  • When True, isosurfaces are generated for non-blanked regions only.

  • When False, isosurfaces are generated for blanked and unblanked. regions.

Example usage:

>>> plot.isosurface(0).show = True
>>> plot.isosurface(0).obey_source_zone_blanking = True
Type:

bool

IsosurfaceGroup.shade

Shade attributes for this isosurface group.

Example usage:

>>> plot.isosurface(0).shade.show = True
Type:

IsosurfaceShade

IsosurfaceGroup.show

Show isosurfaces for this isosurface group.

Example usage:

>>> plot.isosurface(1).show = True
Type:

bool

IsosurfaceGroup.surface_generation_method

Determines how the surface is generated.

May be one of:

  • SurfaceGenerationMethod.Auto:

    Selects one of the surface generation algorithms best suited for the zones participating in the iso-surface generation. “All polygons” is used if one or more of the participating zones is polytope, otherwise “all triangles” are used unless the iso-surface is defined by a coordinate variable in which case “allow quads” is used.

  • SurfaceGenerationMethod.AllPolygons:

    Similar to the “All triangles” method except that all interior faces generated as a result of triangulation that are not part of the original mesh are eliminated. This preserves the original mesh of the source zones on the resulting iso-surface.

  • SurfaceGenerationMethod.AllTriangles:

    An advanced algorithm that can handle complex saddle issues and guarantees that there will be no holes in the final surface. As the surface is composed entirely of triangles, it can be delivered more efficiently to the graphics hardware.

  • SurfaceGenerationMethod.AllowQuads:

    Produces quads or triangles, and the resulting surface more closely resembles the shape of the volume cells from the source zone. Since the quads are not arbitrarily divided into triangles, no biases are introduced, and the resulting surface may appear smoother. This method is preferred when the source zone is FE-Brick or IJK-Ordered and the surface is aligned with the source cells.

Example usage:

>>> from tecplot.constant import SurfaceGenerationMethod
>>> AllowQuads = SurfaceGenerationMethod.AllowQuads
>>> plot.isosurface(0).surface_generation_method = AllowQuads
Type:

SurfaceGenerationMethod

IsosurfaceGroup.use_slice_clipping

Clip isosurface by any intersecting slices.

Example usage:

>>> from tecplot.constant import ClipPlane
>>> slice = plot.slice(0)
>>> slice.clip = ClipPlane.AbovePrimarySlice
>>> plot.fieldmap(0).effects.clip_planes = slice
>>> plot.isosurface(0).use_slice_clipping = True

See also

SliceGroup.clip

Type:

bool

IsosurfaceGroup.vector

Vector attributes for this isosurface group.

Example usage:

>>> plot.isosurface(0).vector.show = True
Type:

IsosurfaceVector

IsosurfaceContour

class tecplot.plot.IsosurfaceContour(isosurface)[source]

Contour attributes of the isosurface group.

import os
import tecplot as tp
from tecplot.constant import *

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

plot = tp.active_frame().plot()
plot.show_isosurfaces = True
plot.contour(0).colormap_name = 'Magma'
plot.contour(0).variable = dataset.variable('Mach')
plot.contour(0).legend.show = False

iso = plot.isosurface(0)
iso.show = True
iso.definition_contour_group = plot.contour(0)
iso.isosurface_selection = IsoSurfaceSelection.OneSpecificValue
iso.isosurface_values = 1

plot.contour(1).variable = dataset.variable('Density')
iso.contour.show = True
iso.contour.contour_type = ContourType.PrimaryValue
iso.contour.flood_contour_group = plot.contour(1)

view = plot.view
view.psi = 65.777
view.theta = 166.415
view.alpha = -1.05394
view.position = (-23.92541680486183, 101.8931504712126, 47.04269529295333)
view.width = 1.3844

# ensure consistent output between interactive (connected) and batch
plot.contour(0).levels.reset_to_nice()
plot.contour(1).levels.reset_to_nice()

tp.export.save_png('isosurface_contour.png', 600, supersample=3)
../_images/isosurface_contour.png

Attributes

contour_type

Contour display type.

flood_contour_group

Contour group to use for flooding.

flood_contour_group_index

The zero-based Index of the ContourGroup to use for flooding.

line_color

Color of contour lines.

line_contour_group

The contour group to use for contour lines.

line_contour_group_index

The zero-based Index of the ContourGroup to use for contour lines.

line_thickness

Contour line thickness as a percentage of frame width.

show

Show contours on isosurfaces.

use_lighting_effect

Enable lighting effect.

IsosurfaceContour.contour_type

Contour display type.

  • ContourType.Lines - Draws lines of constant value of the specified contour variable.

  • ContourType.Flood - Floods regions between contour lines with colors from a color map. The distribution of colors used for contour flooding may be banded or continuous. When banded distribution is used for flooding, a solid color is used between contour levels. If continuous color distribution is used, the flood color will vary linearly in all directions.

  • ContourType.Overlay - Combines the above two options.

  • ContourType.AverageCell - Floods cells or finite elements with colors from a color map according to the average value of the contour variable over the data points bounding the cell. If the variables are located at the nodes, the values at the nodes are averaged. If the variables are cell-centered, the cell-centered values are averaged to the nodes and the nodes are then averaged.

  • ContourType.PrimaryValue - Floods cells or finite elements with colors from a color map according to the primary value of the contour variable for each cell. If the variable is cell centered, the primary value is the value assigned to the cell. If the variable is node located, the primary value comes from the lowest index node in the cell. If the variables are located at the nodes, the value of the lowest indexed node in the cell is used. When plotting IJK-ordered, FE-brick or FE-tetra cells, each face is considered independently of the other faces. You may get different colors on the different faces of the same cell. If the variables are cell-centered, the cell-centered value is used directly. When plotting I, J, or K-planes in 3D, the cell on the positive side of the plane supplies the value, except in the case of the last plane, where the cell on the negative side supplies the value.

Example usage:

>>> plot.isosurface(0).contour.show = True
>>> plot.isosurface(0).contour.contour_type = ContourType.Flood
Type:

ContourType

IsosurfaceContour.flood_contour_group

Contour group to use for flooding.

Changing style on this ContourGroup will affect all fieldmaps on the same Frame that use it.

Example usage:

>>> group = plot.contour(1)
>>> contour = plot.isosurface(1).contour
>>> contour.flood_contour_group = group
Type:

ContourGroup

IsosurfaceContour.flood_contour_group_index

The zero-based Index of the ContourGroup to use for flooding.

This property sets and gets, by Index, the ContourGroup used for flooding. Changing style on this ContourGroup will affect all fieldmaps on the same Frame that use it.

Example usage:

>>> contour = plot.isosurface(0).contour
>>> contour.flood_contour_group_index = 1
Type:

Index

IsosurfaceContour.line_color

Color of contour lines.

Contour lines can be a solid color or be colored by a ContourGroup as obtained through the plot.contour property.

Example usage:

>>> plot.show_isosurfaces = True
>>> plot.isosurface(0).contour.line_color = Color.Blue
Type:

Color or ContourGroup

IsosurfaceContour.line_contour_group

The contour group to use for contour lines.

Note that changing style on this ContourGroup will affect all other fieldmaps on the same Frame that use it.

Example usage:

>>> contour = plot.isosurface(0).contour
>>> group = plot.contour(1)
>>> contour.line_contour_group = group
Type:

ContourGroup

IsosurfaceContour.line_contour_group_index

The zero-based Index of the ContourGroup to use for contour lines.

This property sets and gets, by Index, the ContourGroup used for line placement. Although all properties of the ContourGroup can be manipulated through this object, many of them (i.e., color) will not affect the lines unless the FieldmapContour.line_color is set to the same ContourGroup. Note that changing style on this ContourGroup will affect all other fieldmaps on the same Frame that use it.

Example usage:

>>> contour = plot.isosurface(0).contour
>>> contour.line_contour_group_index = 2
Type:

int

IsosurfaceContour.line_thickness

Contour line thickness as a percentage of frame width.

Suggested values are one of: .02, .1, .4, .8, 1.5

Example usage:

>>> plot.show_isosurfaces = True
>>> plot.isosurface(0).contour.line_thickness = .4
Type:

float

IsosurfaceContour.show

Show contours on isosurfaces.

Example usage:

>>> plot.isosurface(0).contour.show = True
Type:

bool

IsosurfaceContour.use_lighting_effect

Enable lighting effect.

When set to True, the lighting effect may be selected with the IsosurfaceEffects.lighting_effect attribute.

Example usage:

>>> plot.isosurface(0).contour.use_lighting_effect = True
>>> plot.isosurface(0).effects.lighting_effect = LightingEffect.Paneled
Type:

bool

IsosurfaceEffects

class tecplot.plot.IsosurfaceEffects(isosurface)[source]

Effects of the isosurface group.

import os
import tecplot as tp
from tecplot.constant import *

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

plot = tp.active_frame().plot()
plot.show_isosurfaces = True
plot.contour(0).colormap_name = 'Magma'
plot.contour(0).variable = dataset.variable('Mach')
plot.contour(0).legend.show = False

iso = plot.isosurface(0)
iso.show = True
iso.definition_contour_group = plot.contour(0)
iso.isosurface_selection = IsoSurfaceSelection.ThreeSpecificValues
iso.isosurface_values = [.95,1.0,1.1]

iso.effects.lighting_effect = LightingEffect.Paneled
iso.effects.use_translucency = True
iso.effects.surface_translucency = 80

view = plot.view
view.psi = 65.777
view.theta = 166.415
view.alpha = -1.05394
view.position = (-23.92541680486183, 101.8931504712126, 47.04269529295333)
view.width = 1.3844

tp.export.save_png('isosurface_effects.png', 600, supersample=3)
../_images/isosurface_effects.png

Attributes

lighting_effect

Surface lighting effect.

surface_translucency

Surface translucency of the isosurface group.

use_translucency

Enable surface translucency for this isosurface group.

IsosurfaceEffects.lighting_effect

Surface lighting effect.

Isosurface lighting effects must be enabled by setting IsosurfaceShade.use_lighting_effect to True when setting this value.

There are two types of lighting effects: Paneled and Gouraud:

  • Paneled: Within each cell, the color assigned to each area by

    shading or contour flooding is tinted by a shade constant across the cell. This shade is based on the orientation of the cell relative to your 3D light source.

  • Gouraud: This offers smoother, more continuous shading than

    Paneled shading, but it also results in slower plotting and larger print files. Gouraud shading is not continuous across zone boundaries unless face neighbors are specified in the data. Gouraud shading is not available for finite element volume Zone when blanking is active. The zone’s lighting effect reverts to Paneled shading in this case.

Example usage:

>>> plot.isosurface(0).shade.use_lighting_effect = True
>>> plot.isosurface(0).effects.lighting_effect = LightingEffect.Paneled
Type:

LightingEffect

IsosurfaceEffects.surface_translucency

Surface translucency of the isosurface group.

Iso-surface surface translucency must be enabled by setting IsosurfaceEffects.use_translucency = True when setting this value.

Valid translucency values range from one (opaque) to 99 (translucent).

Example usage:

>>> plot.isosurface(0).effects.use_translucency = True
>>> plot.isosurface(0).effects.surface_translucency = 20
Type:

int

IsosurfaceEffects.use_translucency

Enable surface translucency for this isosurface group.

The surface translucency value can be changed by setting IsosurfaceEffects.surface_translucency.

Example usage:

>>> plot.isosurface(0).effects.use_translucency = True
>>> plot.isosurface(0).effects.surface_translucency = 20
Type:

bool

IsosurfaceMesh

class tecplot.plot.IsosurfaceMesh(isosurface)[source]

Mesh attributes of the isosurface group.

import os
import tecplot as tp
from tecplot.constant import *

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

plot = tp.active_frame().plot()
plot.show_isosurfaces = True
plot.contour(0).colormap_name = 'Magma'
plot.contour(0).variable = dataset.variable('Mach')
plot.contour(0).legend.show = False

iso = plot.isosurface(0)
iso.show = True
iso.definition_contour_group = plot.contour(0)
iso.isosurface_selection = IsoSurfaceSelection.OneSpecificValue
iso.isosurface_values = 1
iso.mesh.show = True
iso.mesh.color = Color.Mahogany
iso.mesh.line_thickness = 0.4

view = plot.view
view.psi = 65.777
view.theta = 166.415
view.alpha = -1.05394
view.position = (-23.92541680486183, 101.8931504712126, 47.04269529295333)
view.width = 1.3844

tp.export.save_png('isosurface_mesh.png', 600, supersample=3)
../_images/isosurface_mesh.png

Attributes

color

Isosurface mesh color.

line_thickness

Isosurface mesh line thickness.

show

Display the mesh on isosurfaces.

IsosurfaceMesh.color

Isosurface mesh color.

Iso-surface mesh lines can be a solid color or be colored by a ContourGroup as obtained through the plot.contour property.

Example usage:

>>> plot.isosurface(0).mesh.show = True
>>> plot.isosurface(0).mesh.color = Color.Blue
Type:

Color or ContourGroup

IsosurfaceMesh.line_thickness

Isosurface mesh line thickness.

Suggested values are .002, .1, .4, .8, 1.5

Example usage:

>>> plot.isosurface(0).mesh.show = True
>>> plot.isosurface(0).mesh.line_thickness = .4
Type:

float

IsosurfaceMesh.show

Display the mesh on isosurfaces.

Example usage:

>>> plot.isosurface(0).mesh.show = True
Type:

bool

IsosurfaceShade

class tecplot.plot.IsosurfaceShade(isosurface)[source]

Shade attributes of the isosurface group.

import tecplot as tp
from os import path
from tecplot.plot import IsosurfaceGroup
from tecplot.constant import Color, LightingEffect

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

plot = tp.active_frame().plot()
plot.show_isosurfaces = True
plot.contour(0).variable = dataset.variable('U(M/S)')
iso = plot.isosurface(0)

iso.contour.show = False  # Hiding the contour will reveal the shade.

iso.shade.show = True
iso.shade.color = Color.Red
iso.shade.use_lighting_effect = True

iso.effects.lighting_effect = LightingEffect.Paneled

tp.export.save_png('isosurface_shade.png', 600, supersample=3)
../_images/isosurface_shade.png

Attributes

color

Shade color.

show

Show shade attributes.

use_lighting_effect

Enable lighting effect.

IsosurfaceShade.color

Shade color.

Color.MultiColor and Color.RGBColor coloring are not available. Use flooded contours for multi-color or RGB flooding

Example usage:

>>> plot.isosurface(0).shade.show = True
>>> plot.isosurface(0).shade.color = Color.Blue
Type:

Color

IsosurfaceShade.show

Show shade attributes.

Example usage:

>>> plot.isosurface(0).shade.show = True
Type:

bool

IsosurfaceShade.use_lighting_effect

Enable lighting effect.

When set to True, the lighting effect may be selected with the IsosurfaceEffects.lighting_effect attribute.

Example usage:

>>> plot.isosurface(0).shade.use_lighting_effect = True
>>> plot.isosurface(0).effects.lighting_effect = LightingEffect.Paneled
Type:

bool

IsosurfaceVector

class tecplot.plot.IsosurfaceVector(isosurface)[source]

Isosurface vector field control.

New in version 2017.3: Isosurface vectors requires Tecplot 360 2017 R3 or later.

import os
import tecplot as tp
from tecplot.constant import *

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

plot = tp.active_frame().plot()
plot.contour(0).variable = dataset.variable('T(K)')
plot.contour(1).variable = dataset.variable('P(N/m2)')
plot.vector.u_variable = dataset.variable('U(M/S)')
plot.vector.v_variable = dataset.variable('V(M/S)')
plot.vector.w_variable = dataset.variable('W(M/S)')

plot.show_isosurfaces = True
plot.contour(0).legend.show = False
plot.contour(1).legend.show = False

iso = plot.isosurface(0)
iso.definition_contour_group = plot.contour(0)
iso.contour.flood_contour_group = plot.contour(1)
iso.isosurface_values = 200
iso.show = True

iso.vector.show = True
iso.vector.line_thickness = 0.4
iso.vector.color = Color.Grey

view = plot.view
view.psi = 53.80
view.theta = -139.15
view.alpha = 0
view.position = (7.54498, 8.42026, 7.94559)
view.width = 0.551882

tp.export.save_png('isosurface_vector.png', 600, supersample=3)
../_images/isosurface_vector.png

Attributes

arrowhead_style

Arrowhead style of isosurface vectors.

color

Isosurface vector color.

is_tangent

Use tangent vectors for isosurfaces.

line_thickness

Vector line thickness as a percentage of the frame height.

show

Show vectors on isosurfaces.

vector_type

Type of vector for isosurfaces.

IsosurfaceVector.arrowhead_style

Arrowhead style of isosurface vectors.

Example usage:

>>> isosurface_vector = plot.isosurface(0).vector
>>> isosurface_vector.show = True
>>> isosurface_vector.arrowhead_style = ArrowheadStyle.Hollow

New in version 2017.3: Isosurface vectors requires Tecplot 360 2017 R3 or later.

Type:

ArrowheadStyle

IsosurfaceVector.color

Isosurface vector color.

Iso-surface vectors can be a solid color or be colored by a ContourGroup as obtained through the plot.contour property.

Example usage:

>>> plot.isosurface(0).vector.show = True
>>> plot.isosurface(0).vector.color = Color.Blue

New in version 2017.3: Isosurface vectors requires Tecplot 360 2017 R3 or later.

Type:

Color or ContourGroup

IsosurfaceVector.is_tangent

Use tangent vectors for isosurfaces.

Example usage:

>>> plot.isosurface(0).vector.show = True
>>> plot.isosurface(0).vector.is_tangent = True

New in version 2017.3: Isosurface vectors requires Tecplot 360 2017 R3 or later.

Type:

bool

IsosurfaceVector.line_thickness

Vector line thickness as a percentage of the frame height.

Typical values are .02, .1, .4, .8, 1.5

Example usage:

>>> plot.isosurface(0).vector.show = True
>>> plot.isosurface(0).vector.line_thickness = .1

New in version 2017.3: Isosurface vectors requires Tecplot 360 2017 R3 or later.

Type:

float

IsosurfaceVector.show

Show vectors on isosurfaces.

Example usage:

>>> plot.isosurface(0).vector.show = True

New in version 2017.3: Isosurface vectors requires Tecplot 360 2017 R3 or later.

Type:

bool

IsosurfaceVector.vector_type

Type of vector for isosurfaces.

Example usage:

>>> plot.isosurface(0).vector.show = True
>>> plot.isosurface(0).vector.vector_type = VectorType.MidAtPoint

New in version 2017.3: Isosurface vectors requires Tecplot 360 2017 R3 or later.

Type:

VectorType

Slice

SliceGroup

class tecplot.plot.SliceGroup(plot, index)[source]

Change attributes associated with a specific slice group.

Slices can include lighting effects, contours, meshes, and more. To customize these and other attributes of slices, use this object.

This object controls the style for a specific slice group within a Frame. Slice contour, vector, edge, effects, mesh, visibility and position information are accessed through this class:

from os import path
import tecplot as tp
from tecplot.constant import *

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

plot = tp.active_frame().plot()
plot.contour(0).variable = dataset.variable('U(M/S)')
plot.show_edge = True
plot.fieldmap(0).edge.edge_type = EdgeType.Creases

vectors = plot.vector
vectors.u_variable = dataset.variable('U(M/S)')
vectors.v_variable = dataset.variable('V(M/S)')
vectors.w_variable = dataset.variable('W(M/S)')

plot.show_slices = True
slice_0 = plot.slice(0)

slice_0.contour.show = True
slice_0.contour.contour_type = ContourType.Overlay  # AKA "Both lines and flood"

slice_0.effects.use_translucency = True
slice_0.effects.surface_translucency = 30

# Show an arbitrary slice
slice_0.orientation = SliceSurface.Arbitrary
slice_0.arbitrary_normal = (1, .5, 0)

slice_0.show_primary_slice = False
slice_0.show_start_and_end_slices = True
slice_0.start_position = (-.21, .05, .025)
slice_0.end_position = (1.342, .95, .475)
slice_0.show_intermediate_slices = True
slice_0.num_intermediate_slices = 3

slice_0.edge.show = True
slice_0.edge.line_thickness = 0.4

# ensure consistent output between interactive (connected) and batch
plot.contour(0).levels.reset_to_nice()

tp.export.save_png('slice_group.png', 600, supersample=3)
../_images/slice_group.png

Up to eight different slice groups can be set. Each slice group can use different slice planes or different ranges for the same slice plane.

>>> slice_3 = plot.slice(3)
>>> slice_3.contour.show = True

Attributes

arbitrary_normal

Normal for arbitrary slices.

clip

Orientation of data clipping for this slice group.

contour

Contour attributes for the slice group.

edge

Edge attributes for this slice group.

effects

Effects attributes for this slice group.

end_position

Position of the end slice.

indices

mesh

Mesh attributes for this slice group.

num_intermediate_slices

Number of intermediate slicing planes.

obey_source_zone_blanking

Obey source zone blanking.

orientation

Select on which plane the slice is drawn.

origin

Origin of the slice.

shade

Shade attributes for this slice group.

show

Show slices for this slice group.

show_intermediate_slices

Show intermediate slices.

show_primary_slice

bool; Include the primary slice (first slice placed) in the Plot.

show_start_and_end_slices

Include start and end slices.

slice_source

Zones to slice through.

start_position

Position of the start slice.

surface_generation_method

Determines how the surface is generated.

use_slice_clipping

Clip this slice by any intersecting slices.

vector

Vector attributes for this slice group.

Methods

extract([mode, assign_strand_ids, ...])

Create new zones from this slice.

set_arbitrary_from_points(p1, p2, p3)

Set an arbitrary slice from 3 points.

SliceGroup.arbitrary_normal

Normal for arbitrary slices.

Example usage:

>>> plot.slice(0).orientation = SliceSurface.Arbitrary
>>> plot.slice(0).arbitrary_normal = (0.1, 0.2, 0.3)
>>> plot.slice(0).arbitrary_normal.x
0.1
>>> plot.slice(0).arbitrary_normal.y
0.2
>>> plot.slice(0).arbitrary_normal.z
0.3
Type:

tuple

SliceGroup.clip

Orientation of data clipping for this slice group.

Clipping the field data, isosurfaces, streamtraces or other plot objects using slices requires setting the clip property of the slice as well as adding the slice group to the clip_planes property on the fieldmap effects. Only slice groups 0 to 5 are available for clipping in this framework:

>>> from tecplot.constant import *
>>> # setup slice and clipping orientation
>>> slice = plot.slice(0)
>>> slice.origin = (7, 0, 0)
>>> slice.clip = ClipPlane.AbovePrimarySlice
>>> # add slice group to the fieldmap clip planes
>>> plot.fieldmap(0).effects.clip_planes = [slice]
>>> # turn on and set value of isosurface
>>> # and enforce slice clipping
>>> isosurf = plot.isosurface(0)
>>> isosurf.isosurface_values = 3
>>> isosurf.use_slice_clipping = True
>>> # turn on isosurfaces and slices
>>> pt.show_isosurfaces = True
>>> pt.show_slices = True

Warning

Slice clipping is only supported for X, Y and Z-planes.

Slice clipping has no effect for slices that have an orientation of SliceSurface.Arbitrary, SliceSurface.IPlanes, SliceSurface.JPlanes or , SliceSurface.KPlanes. That is, the orientation must be one of: SliceSurface.XPlanes, SliceSurface.YPlanes or SliceSurface.ZPlanes.

Type:

ClipPlane

SliceGroup.contour

Contour attributes for the slice group.

Example usage:

>>> plot.slice(0).contour.show = True
Type:

SliceContour

SliceGroup.edge

Edge attributes for this slice group.

Example usage:

>>> plot.slice(0).edge.show = True
Type:

SliceEdge

SliceGroup.effects

Effects attributes for this slice group.

Example usage:

>>> plot.slice(0).effects.use_translucency = True
Type:

SliceEffects

SliceGroup.end_position

Position of the end slice.

SliceGroup.show_start_and_end_slices must be True to show the end slice. This will be a 3-tuple of float if orientation is X,Y,Z or zero-based int if orientation is I,J,K.

Example usage:

>>> plot.slice(0).show_start_and_end_slices = True
>>> plot.slice(0).end_position = (1, 1, 1)
>>> plot.slice(0).end_position.i
1
Type:

tuple or int

SliceGroup.extract(mode=ExtractMode.SingleZone, assign_strand_ids=True, resulting_1d_zone_type=Resulting1DZoneType.IOrderedIfPossible, transient_mode=TransientOperationMode.SingleSolutionTime)[source]

Create new zones from this slice.

Extracts the current slices represented by this group to the Dataset as one or more zones.

Parameters:
Returns:

The extracted zone is returned if mode is ExtractMode.SingleZone and transient_mode is TransientOperationMode.SingleSolutionTime, otherwise a generator of the extracted zones.

Example usage:

>>> slice_zone = plot.slice(0).extract()
SliceGroup.indices
SliceGroup.mesh

Mesh attributes for this slice group.

Example usage:

>>> plot.slice(0).mesh.show = True
Type:

SliceMesh

SliceGroup.num_intermediate_slices

Number of intermediate slicing planes.

You may specify between 1 and 5,000 intermediate slices.

Example usage:

>>> # Show 2 intermediate slices
>>> plot.slice(0).num_intermediate_slices = 2
Type:

int

SliceGroup.obey_source_zone_blanking

Obey source zone blanking.

When set to True, slices are subject to any blanking used for the data. When set to False, slices are generated for blanked and unblanked regions.

Example usage:

>>> plot.slice(0).obey_source_zone_blanking = True
Type:

bool

SliceGroup.orientation

Select on which plane the slice is drawn.

You may also choose SliceSurface.Arbitrary to place the slice on an arbitrary plane.

To orient slices in an arbitrary direction, choose SliceSurface.Arbitrary. As with other slices, you may specify origin points for a primary slice and/or for start and end slices. Slices pass through the indicated origin point(s), so you can easily align the edge of a slice or group of slices along some other feature of the plot, such as an axis. If intermediate slices are activated, they are drawn equally spaced between the slices defined by the start and end origins.

Example usage:

>>> plot.slice(0).orientation = SliceSurface.XPlanes
Type:

SliceSurface

SliceGroup.origin

Origin of the slice.

This will be a 3-tuple of float if orientation is X,Y,Z or zero-based int if orientation is I,J,K. For arbitrary slice orientation, the origin can be any location. For axis orientations (XPlanes, YPlanes, etc.) two of the three components are not used.

Example usage:

>>> slice_0 = plot.slice(0)
>>> slice_0.orientation = SliceSurface.IPlanes
>>> slice_0.origin = (1, 0, 0)
>>> dx = (1, 1, 1)
>>> slice_0.origin += dx
>>> slice_0.origin.i
2
>>> slice_0.origin.j
1
>>> slice_0.origin.k
1

>>> slice_0.orientation = SliceSurface.Arbitrary
>>> slice_0.origin = (.5, .1, .1)
>>> slice_0.origin += dx
>>> slice_0.origin.x
1.5
>>> slice_0.origin.y
.1
>>> slice_0.origin.z
.1
Type:

tuple or int

SliceGroup.set_arbitrary_from_points(p1, p2, p3)[source]

Set an arbitrary slice from 3 points.

Set the normal and origin of an arbitrary slice using three points. The origin will be set to the 3rd point.

The three points must not be coincident or collinear. The slice’s origin is set to the third point and its normal is recalculated such that the cutting plane passes through all three points.

Parameters:
  • p1 – 3-tuple of floats (x, y, z)

  • p2 – 3-tuple of floats (x, y, z)

  • p3 – 3-tuple of floats (x, y, z)

Example usage:

>>> slice0 = plot.slice(0)
>>> slice0.set_arbitrary_from_points((0.0, 0.0, 0.0),
...                                  (0.1, 0.2, 0.3),
...                                  (0.1, 0.1, 0.1))
SliceGroup.shade

Shade attributes for this slice group.

Example usage:

>>> plot.slice(0).shade.show = True
Type:

SliceShade

SliceGroup.show

Show slices for this slice group.

Example usage:

>>> plot.slice(0).show = True
Type:

bool

SliceGroup.show_intermediate_slices

Show intermediate slices.

Intermediate slices are evenly distributed between the start and end slices.

Example usage:

>>> plot.slice(0).show_intermediate_slices = True
SliceGroup.show_primary_slice

bool; Include the primary slice (first slice placed) in the Plot.

Example usage:

>>> plot.slice(0).show = True
>>> plot.slice(0).show_primary_slice = True
SliceGroup.show_start_and_end_slices

Include start and end slices.

Example usage:

>>> plot.slice(0).show_start_and_end_slices = True
Type:

bool

SliceGroup.slice_source

Zones to slice through.

Choose to slice through volume Zones, surface Zones, or the surfaces of volume Zones.

Example usage:

>>> plot.slice(0).slice_source = SliceSource.SurfaceZones
Type:

SliceSource

SliceGroup.start_position

Position of the start slice.

SliceGroup.show_start_and_end_slices must be True to show the start slice. This will be a 3-tuple of float if orientation is X,Y,Z or zero-based int if orientation is I,J,K.

Example usage:

>>> plot.slice(0).show_start_and_end_slices = True
>>> plot.slice(0).start_position = (1, 1, 1)
>>> plot.slice(0).start_position.i
1
Type:

tuple or int

SliceGroup.surface_generation_method

Determines how the surface is generated.

May be one of:

  • SurfaceGenerationMethod.Auto:

    Selects one of the surface generation algorithms best suited for the zones participating in the slice generation. “All polygons” is used if one or more of the participating zones is polytope, otherwise “allow quads” is used.

  • SurfaceGenerationMethod.AllPolygons:

    Similar to the “All triangles” method except that all interior faces generated as a result of triangulation that are not part of the original mesh are eliminated. This preserves the original mesh of the source zones on the resulting slice.

  • SurfaceGenerationMethod.AllTriangles:

    An advanced algorithm that can handle complex saddle issues and guarantees that there will be no holes in the final surface. As the surface is composed entirely of triangles, it can be delivered more efficiently to the graphics hardware.

  • SurfaceGenerationMethod.AllowQuads:

    Produces quads or triangles, and the resulting surface more closely resembles the shape of the volume cells from the source zone. Since the quads are not arbitrarily divided into triangles, no biases are introduced, and the resulting surface may appear smoother. This method is preferred when the source zone is FE-Brick or IJK-Ordered and the surface is aligned with the source cells.

Example usage:

>>> from tecplot.constant import SurfaceGenerationMethod
>>> plot.slice(0).surface_generation_method = \
...     SurfaceGenerationMethod.AllowQuads
Type:

SurfaceGenerationMethod

SliceGroup.use_slice_clipping

Clip this slice by any intersecting slices.

Example usage:

>>> from tecplot.constant import ClipPlane
>>> slice = plot.slice(0)
>>> slice.clip = ClipPlane.AbovePrimarySlice
>>> plot.fieldmap(0).effects.clip_planes = slice
>>> plot.slice(1).use_slice_clipping = True

See also

SliceGroup.clip

Type:

bool

SliceGroup.vector

Vector attributes for this slice group.

Example usage:

>>> plot.slice(0).vector.show = True
Type:

SliceVector

SliceGroupCollection

class tecplot.plot.SliceGroupCollection(plot, *indices)[source]

Change attributes associated with multiple slices.

Slices can include lighting effects, contours, meshes, and more. To customize these and other attributes of slices, use this object. It controls the style for specific slice groups within a Frame. Slice contour, vector, edge, effects, mesh, visibility and position information are accessed through this class:

from os import path
import tecplot as tp
from tecplot.constant import *

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

plot = tp.active_frame().plot()
plot.contour(0).variable = dataset.variable('U(M/S)')

plot.show_slices = True
slices = plot.slices(0, 1, 2)
slices.show = True

slices.contour.show = True
slices.contour.contour_type = ContourType.Overlay
slices.effects.use_translucency = True
slices.effects.surface_translucency = 70

# Show arbitrary slices
slices.orientation = SliceSurface.Arbitrary
slices.origin = (0.1, 0.2, 0)
slices[0].arbitrary_normal = (1, 0.5, 0)
slices[1].arbitrary_normal = (0.2, 1, 0)
slices[2].arbitrary_normal = (0, 0, 1)

slices.edge.show = True
slices.edge.line_thickness = 0.4

plot.contour(0).levels.reset_to_nice()
plot.contour(0).legend.show = False

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

Up to eight different slice groups can be set and each slice group can use different slice planes or different ranges for the same slice plane.

This class behaves like SliceGroup except that setting any underlying style will do so for all of the represented slice groups. The style properties are then always returned as a tuple of properties, one for each group, ordered by index number. This means there is an asymmetry between setting and getting any property under this object, illustrated by the following example:

>>> slices = plot.slices(0, 1, 2)
>>> slices.show = True
>>> print(slices.show)
(True, True, True)

All examples that set style on a single slice like the following:

>>> plot.slice(0).contour.show = True

may be converted to setting the same style on all slice groups like so:

>>> plot.slices().contour.show = True

See also

SliceGroup

New in version 1.2: Slice collection objects.

Attributes

arbitrary_normal

Normal for arbitrary slices.

clip

Orientation of data clipping for this slice group.

contour

Contour attributes for the slice group.

edge

Edge attributes for this slice group.

effects

Effects attributes for this slice group.

end_position

Position of the end slice.

indices

mesh

Mesh attributes for this slice group.

num_intermediate_slices

Number of intermediate slicing planes.

obey_source_zone_blanking

Obey source zone blanking.

orientation

Select on which plane the slice is drawn.

origin

Origin of the slice.

shade

Shade attributes for this slice group.

show

Show slices for this slice group.

show_intermediate_slices

Show intermediate slices.

show_primary_slice

bool; Include the primary slice (first slice placed) in the Plot.

show_start_and_end_slices

Include start and end slices.

slice_source

Zones to slice through.

start_position

Position of the start slice.

surface_generation_method

Determines how the surface is generated.

use_slice_clipping

Clip this slice by any intersecting slices.

vector

Vector attributes for this slice group.

Methods

extract([mode, assign_strand_ids, ...])

Create new zones from this slice collection.

SliceGroupCollection.arbitrary_normal

Normal for arbitrary slices.

Example usage:

>>> plot.slice(0).orientation = SliceSurface.Arbitrary
>>> plot.slice(0).arbitrary_normal = (0.1, 0.2, 0.3)
>>> plot.slice(0).arbitrary_normal.x
0.1
>>> plot.slice(0).arbitrary_normal.y
0.2
>>> plot.slice(0).arbitrary_normal.z
0.3
Type:

tuple

SliceGroupCollection.clip

Orientation of data clipping for this slice group.

Clipping the field data, isosurfaces, streamtraces or other plot objects using slices requires setting the clip property of the slice as well as adding the slice group to the clip_planes property on the fieldmap effects. Only slice groups 0 to 5 are available for clipping in this framework:

>>> from tecplot.constant import *
>>> # setup slice and clipping orientation
>>> slice = plot.slice(0)
>>> slice.origin = (7, 0, 0)
>>> slice.clip = ClipPlane.AbovePrimarySlice
>>> # add slice group to the fieldmap clip planes
>>> plot.fieldmap(0).effects.clip_planes = [slice]
>>> # turn on and set value of isosurface
>>> # and enforce slice clipping
>>> isosurf = plot.isosurface(0)
>>> isosurf.isosurface_values = 3
>>> isosurf.use_slice_clipping = True
>>> # turn on isosurfaces and slices
>>> pt.show_isosurfaces = True
>>> pt.show_slices = True

Warning

Slice clipping is only supported for X, Y and Z-planes.

Slice clipping has no effect for slices that have an orientation of SliceSurface.Arbitrary, SliceSurface.IPlanes, SliceSurface.JPlanes or , SliceSurface.KPlanes. That is, the orientation must be one of: SliceSurface.XPlanes, SliceSurface.YPlanes or SliceSurface.ZPlanes.

Type:

ClipPlane

SliceGroupCollection.contour

Contour attributes for the slice group.

Example usage:

>>> plot.slice(0).contour.show = True
Type:

SliceContour

SliceGroupCollection.edge

Edge attributes for this slice group.

Example usage:

>>> plot.slice(0).edge.show = True
Type:

SliceEdge

SliceGroupCollection.effects

Effects attributes for this slice group.

Example usage:

>>> plot.slice(0).effects.use_translucency = True
Type:

SliceEffects

SliceGroupCollection.end_position

Position of the end slice.

SliceGroup.show_start_and_end_slices must be True to show the end slice. This will be a 3-tuple of float if orientation is X,Y,Z or zero-based int if orientation is I,J,K.

Example usage:

>>> plot.slice(0).show_start_and_end_slices = True
>>> plot.slice(0).end_position = (1, 1, 1)
>>> plot.slice(0).end_position.i
1
Type:

tuple or int

SliceGroupCollection.extract(mode=ExtractMode.SingleZone, assign_strand_ids=True, resulting_1d_zone_type=Resulting1DZoneType.IOrderedIfPossible, transient_mode=TransientOperationMode.SingleSolutionTime)[source]

Create new zones from this slice collection.

Extracts the current slices represented by this group to the Dataset as one or more zones.

Parameters:
Returns:

generator of the extracted zones.

Example usage showing how to convert the resulting generator into a reusable list object of zones:

>>> slice_zones = list(plot.slices(0, 1).extract())
SliceGroupCollection.indices
SliceGroupCollection.mesh

Mesh attributes for this slice group.

Example usage:

>>> plot.slice(0).mesh.show = True
Type:

SliceMesh

SliceGroupCollection.num_intermediate_slices

Number of intermediate slicing planes.

You may specify between 1 and 5,000 intermediate slices.

Example usage:

>>> # Show 2 intermediate slices
>>> plot.slice(0).num_intermediate_slices = 2
Type:

int

SliceGroupCollection.obey_source_zone_blanking

Obey source zone blanking.

When set to True, slices are subject to any blanking used for the data. When set to False, slices are generated for blanked and unblanked regions.

Example usage:

>>> plot.slice(0).obey_source_zone_blanking = True
Type:

bool

SliceGroupCollection.orientation

Select on which plane the slice is drawn.

You may also choose SliceSurface.Arbitrary to place the slice on an arbitrary plane.

To orient slices in an arbitrary direction, choose SliceSurface.Arbitrary. As with other slices, you may specify origin points for a primary slice and/or for start and end slices. Slices pass through the indicated origin point(s), so you can easily align the edge of a slice or group of slices along some other feature of the plot, such as an axis. If intermediate slices are activated, they are drawn equally spaced between the slices defined by the start and end origins.

Example usage:

>>> plot.slice(0).orientation = SliceSurface.XPlanes
Type:

SliceSurface

SliceGroupCollection.origin

Origin of the slice.

This will be a 3-tuple of float if orientation is X,Y,Z or zero-based int if orientation is I,J,K. For arbitrary slice orientation, the origin can be any location. For axis orientations (XPlanes, YPlanes, etc.) two of the three components are not used.

Example usage:

>>> slice_0 = plot.slice(0)
>>> slice_0.orientation = SliceSurface.IPlanes
>>> slice_0.origin = (1, 0, 0)
>>> dx = (1, 1, 1)
>>> slice_0.origin += dx
>>> slice_0.origin.i
2
>>> slice_0.origin.j
1
>>> slice_0.origin.k
1

>>> slice_0.orientation = SliceSurface.Arbitrary
>>> slice_0.origin = (.5, .1, .1)
>>> slice_0.origin += dx
>>> slice_0.origin.x
1.5
>>> slice_0.origin.y
.1
>>> slice_0.origin.z
.1
Type:

tuple or int

SliceGroupCollection.shade

Shade attributes for this slice group.

Example usage:

>>> plot.slice(0).shade.show = True
Type:

SliceShade

SliceGroupCollection.show

Show slices for this slice group.

Example usage:

>>> plot.slice(0).show = True
Type:

bool

SliceGroupCollection.show_intermediate_slices

Show intermediate slices.

Intermediate slices are evenly distributed between the start and end slices.

Example usage:

>>> plot.slice(0).show_intermediate_slices = True
SliceGroupCollection.show_primary_slice

bool; Include the primary slice (first slice placed) in the Plot.

Example usage:

>>> plot.slice(0).show = True
>>> plot.slice(0).show_primary_slice = True
SliceGroupCollection.show_start_and_end_slices

Include start and end slices.

Example usage:

>>> plot.slice(0).show_start_and_end_slices = True
Type:

bool

SliceGroupCollection.slice_source

Zones to slice through.

Choose to slice through volume Zones, surface Zones, or the surfaces of volume Zones.

Example usage:

>>> plot.slice(0).slice_source = SliceSource.SurfaceZones
Type:

SliceSource

SliceGroupCollection.start_position

Position of the start slice.

SliceGroup.show_start_and_end_slices must be True to show the start slice. This will be a 3-tuple of float if orientation is X,Y,Z or zero-based int if orientation is I,J,K.

Example usage:

>>> plot.slice(0).show_start_and_end_slices = True
>>> plot.slice(0).start_position = (1, 1, 1)
>>> plot.slice(0).start_position.i
1
Type:

tuple or int

SliceGroupCollection.surface_generation_method

Determines how the surface is generated.

May be one of:

  • SurfaceGenerationMethod.Auto:

    Selects one of the surface generation algorithms best suited for the zones participating in the slice generation. “All polygons” is used if one or more of the participating zones is polytope, otherwise “allow quads” is used.

  • SurfaceGenerationMethod.AllPolygons:

    Similar to the “All triangles” method except that all interior faces generated as a result of triangulation that are not part of the original mesh are eliminated. This preserves the original mesh of the source zones on the resulting slice.

  • SurfaceGenerationMethod.AllTriangles:

    An advanced algorithm that can handle complex saddle issues and guarantees that there will be no holes in the final surface. As the surface is composed entirely of triangles, it can be delivered more efficiently to the graphics hardware.

  • SurfaceGenerationMethod.AllowQuads:

    Produces quads or triangles, and the resulting surface more closely resembles the shape of the volume cells from the source zone. Since the quads are not arbitrarily divided into triangles, no biases are introduced, and the resulting surface may appear smoother. This method is preferred when the source zone is FE-Brick or IJK-Ordered and the surface is aligned with the source cells.

Example usage:

>>> from tecplot.constant import SurfaceGenerationMethod
>>> plot.slice(0).surface_generation_method = \
...     SurfaceGenerationMethod.AllowQuads
Type:

SurfaceGenerationMethod

SliceGroupCollection.use_slice_clipping

Clip this slice by any intersecting slices.

Example usage:

>>> from tecplot.constant import ClipPlane
>>> slice = plot.slice(0)
>>> slice.clip = ClipPlane.AbovePrimarySlice
>>> plot.fieldmap(0).effects.clip_planes = slice
>>> plot.slice(1).use_slice_clipping = True

See also

SliceGroup.clip

Type:

bool

SliceGroupCollection.vector

Vector attributes for this slice group.

Example usage:

>>> plot.slice(0).vector.show = True
Type:

SliceVector

SliceContour

class tecplot.plot.SliceContour(slice_group)[source]

Contour attributes of the slice group.

from os import path
import tecplot as tp
from tecplot.constant import SliceSurface, ContourType

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

plot = tp.active_frame().plot()

plot.show_slices = True
slice_0 = plot.slice(0)

# Use contour(0) for Flooding and contour(2) for Lines
plot.contour(0).variable = dataset.variable('P(N/m2)')
plot.contour(2).variable = dataset.variable('T(K)')
plot.contour(2).legend.show = False
slice_0.contour.show = True
slice_0.contour.flood_contour_group = plot.contour(0)
slice_0.contour.line_contour_group = plot.contour(2)
slice_0.contour.contour_type = ContourType.Overlay  # AKA "Both lines and flood"

slice_0.show_primary_slice = False
slice_0.show_start_and_end_slices = True
slice_0.show_intermediate_slices = True
slice_0.start_position = (-.21, .05, .025)
slice_0.end_position = (1.342, .95, .475)
slice_0.num_intermediate_slices = 3

# ensure consistent output between interactive (connected) and batch
slice_0.contour.flood_contour_group.levels.reset_to_nice()
slice_0.contour.line_contour_group.levels.reset_to_nice()

tp.export.save_png('slice_contour.png', 600, supersample=3)
../_images/slice_contour.png

Attributes

contour_type

Contour type for the slice contours.

flood_contour_group

Contour group to use for flooding.

flood_contour_group_index

Zero-based Index of the flodding ContourGroup.

line_color

Color of contour lines.

line_contour_group

Contour group to use for contour lines.

line_contour_group_index

Zero-based Index of the ContourGroup for contour lines.

line_thickness

Contour line thickness as a percentage of frame width.

show

Show contours on the slice.

use_lighting_effect

bool; Enable lighting effect.

SliceContour.contour_type

Contour type for the slice contours.

Example usage:

>>> plot.show_slices = True
>>> plot.slice(0).contour.contour_type = ContourType.AverageCell
Type:

ContourType

SliceContour.flood_contour_group

Contour group to use for flooding.

Changing style on this ContourGroup will affect all fieldmaps on the same Frame that use it.

Example usage:

>>> group = plot.contour(1)
>>> contour = plot.slice(1).contour
>>> contour.flood_contour_group = group
Type:

ContourGroup

SliceContour.flood_contour_group_index

Zero-based Index of the flodding ContourGroup.

This property sets and gets, by Index, the ContourGroup used for flooding. Changing style on this ContourGroup will affect all fieldmaps on the same Frame that use it.

Example usage:

>>> plot.show_slices = True
>>> contour = plot.slice(0).contour
>>> contour.flood_contour_group_index = 1
Type:

Index

SliceContour.line_color

Color of contour lines.

Selecting Color.MultiColor will color the slice contour lines based on the contour group variable.

Example usage:

>>> plot.show_slices = True
>>> plot.slice(0).contour.line_color = Color.Blue
Type:

Color

SliceContour.line_contour_group

Contour group to use for contour lines.

Changing style on this ContourGroup will affect all fieldmaps on the same Frame that use it.

Example usage:

>>> group = plot.contour(1)
>>> contour = plot.slice(1).contour
>>> contour.line_contour_group = group
Type:

ContourGroup

SliceContour.line_contour_group_index

Zero-based Index of the ContourGroup for contour lines.

This property sets and gets, by Index, the ContourGroup used for line placement. Although all properties of the ContourGroup can be manipulated through this object, many of them (i.e., color) will not affect the lines unless the FieldmapContour.line_color is set to the same ContourGroup. Note that changing style on this ContourGroup will affect all other fieldmaps on the same Frame that use it.

Example usage:

>>> plot.show_slices = True
>>> contour = plot.slice(0).contour
>>> contour.line_contour_group_index = 2
Type:

int

SliceContour.line_thickness

Contour line thickness as a percentage of frame width.

Suggested values are one of: .02, .1, .4, .8, 1.5

Example usage:

>>> plot.show_slices = True
>>> plot.slice(0).contour.line_thickness = .4
Type:

float

SliceContour.show

Show contours on the slice.

Example usage:

>>> plot.show_slices = True
>>> plot.slice(1).contour.show = True
Type:

bool

SliceContour.use_lighting_effect

bool; Enable lighting effect.

Note

Setting SliceContour.use_lighting_effect will also set the same value for SliceShade.use_lighting_effect, and vice-versa.

The lighting effect is set with SliceEffects.lighting_effect, and may be one of LightingEffect.Gouraud or LightingEffect.Paneled.

Example usage:

>>> plot.show_slices = True
>>> contour = plot.slice(0).contour
>>> contour.use_lighting_effect = True
>>> plot.slice(0).effects.lighting_effect = LightingEffect.Paneled

SliceEdge

class tecplot.plot.SliceEdge(slice_group)[source]

Edge attributes of the slice group.

When enabled, selected edge lines of all slices in this group will be shown:

from os import path
import tecplot as tp

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

plot = tp.active_frame().plot()
plot.show_slices = True
plot.contour(0).variable = dataset.variable('U(M/S)')

slice_0 = plot.slice(0)
slice_0.edge.show = True
slice_0.edge.line_thickness = 0.8

# ensure consistent output between interactive (connected) and batch
plot.contour(0).levels.reset_to_nice()

tp.export.save_png('slice_edge.png', 600, supersample=3)
../_images/slice_edge.png

Attributes

color

Edge color.

edge_type

Edge type.

line_thickness

Edge line thickness as a percentage of frame width.

show

Show edges.

SliceEdge.color

Edge color.

Example usage:

>>> plot.slice(0).edge.show = True
>>> plot.slice(0).edge.color = Color.Blue
Type:

Color

SliceEdge.edge_type

Edge type.

There are two types of edges in Tecplot 360: creases and borders.

An edge border is the boundary of a Zone. An edge crease appears when the inside angle between two cells is less than a user-defined limit. The inside angle can range from 0-180 degrees (where 180 degrees indicates coplanar surfaces). The default inside angle for determining an edge crease is 135 degrees.

Example usage:

>>> plot.slice(0).edge.show = True
>>> plot.slice(0).edge.edge_type = EdgeType.BordersAndCreases
Type:

EdgeType

SliceEdge.line_thickness

Edge line thickness as a percentage of frame width.

Example usage:

>>> plot.slice(0).edge.show = True
>>> plot.slice(0).edge.line_thickness = .8
Type:

float

SliceEdge.show

Show edges.

This property must be set to True to show any of the other edge properties.

Example usage:

>>> plot.slice(0).edge.show = True
>>> plot.slice(0).edge.edge_type = EdgeType.BordersAndCreases
Type:

bool

SliceEffects

class tecplot.plot.SliceEffects(slice_group)[source]

Slice effects for this slice.

from os import path
import tecplot as tp

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

plot = tp.active_frame().plot()

plot.show_slices = True
slice_0 = plot.slice(0)

plot.contour(0).variable = dataset.variable('U(M/S)')
slice_0.contour.show = True

slice_0.effects.use_translucency = True
slice_0.effects.surface_translucency = 70

# ensure consistent output between interactive (connected) and batch
plot.contour(0).levels.reset_to_nice()

tp.export.save_png('slice_effects.png', 600, supersample=3)
../_images/slice_effects.png

Attributes

lighting_effect

Surface lighting effect.

surface_translucency

Surface translucency of the slice group.

use_translucency

Enable surface translucency for this slice group.

SliceEffects.lighting_effect

Surface lighting effect.

Slice lighting effects must be enabled by setting SliceContour.use_lighting_effect or SliceShade.use_lighting_effect to True when setting this value.

There are two types of lighting effects: Paneled and Gouraud:

  • Paneled: Within each cell, the color assigned to each area by

    shading or contour flooding is tinted by a shade constant across the cell. This shade is based on the orientation of the cell relative to your 3D light source.

  • Gouraud: This offers smoother, more continuous shading than

    Paneled shading, but it also results in slower plotting and larger print files. Gouraud shading is not continuous across zone boundaries unless face neighbors are specified in the data. Gouraud shading is not available for finite element volume Zones when blanking is active. The zone’s lighting effect reverts to Paneled shading in this case.

Example usage:

>>> plot.slice(0).contour.use_lighting_effect = True
>>> plot.slice(0).effects.lighting_effect = LightingEffect.Paneled
Type:

LightingEffect

SliceEffects.surface_translucency

Surface translucency of the slice group.

Slice surface translucency must be enabled by setting SliceEffects.use_translucency = True when setting this value.

Valid slice translucency values range from one (opaque) to 99 (translucent).

Example usage:

>>> plot.slice(0).effects.use_translucency = True
>>> plot.slice(0).effects.surface_translucency = 20
Type:

int

SliceEffects.use_translucency

Enable surface translucency for this slice group.

The surface translucency value can be changed by setting SliceEffects.surface_translucency.

Example usage:

>>> plot.slice(0).effects.use_translucency = True
>>> plot.slice(0).effects.surface_translucency = 20
Type:

bool

SliceMesh

class tecplot.plot.SliceMesh(slice_group)[source]

Mesh attributes of the slice group.

from os import path
import tecplot as tp
from tecplot.constant import SliceSurface, ContourType

examples_dir = tp.session.tecplot_examples_directory()
datafile = path.join(examples_dir, 'SimpleData', 'DuctFlow.plt')
dataset = tp.data.load_tecplot(datafile)
plot = tp.active_frame().plot()
plot.show_slices = True
plot.contour(0).variable = dataset.variable('U(M/S)')

plot.slice(0).mesh.show = True

# ensure consistent output between interactive (connected) and batch
plot.contour(0).levels.reset_to_nice()

tp.export.save_png('slice_mesh.png', 600, supersample=3)
../_images/slice_mesh.png

Attributes

color

Slice mesh line Color.

line_thickness

Mesh line thickness.

show

Show mesh lines.

SliceMesh.color

Slice mesh line Color.

Slice mesh lines can be a solid color or be colored by a ContourGroup as obtained through the plot.contour property.

Example usage:

>>> plot.slice(0).mesh.show = True
>>> plot.slice(0).mesh.color = Color.Green
Type:

Color or ContourGroup

SliceMesh.line_thickness

Mesh line thickness.

The mesh line thickness is specified as a percentage of the frame width.

Example usage:

>>> plot.slice(0).mesh.show = True
>>> plot.slice(0).mesh.line_thickness = 0.8
Type:

float

SliceMesh.show

Show mesh lines.

Example usage:

>>> plot.slice(0).mesh.show = True
Type:

bool

SliceShade

class tecplot.plot.SliceShade(slice_group)[source]

Shade attributes of the slice group.

Show shading on the slice when SliceContour.show has not been selected or is set to ContourType.Lines:

from os import path
import tecplot as tp
from tecplot.constant import Color

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

plot = tp.active_frame().plot()
plot.show_slices = True
plot.slice(0).contour.show = False
shade = plot.slice(0).shade
shade.show = True
shade.color = Color.Red  # Slice will be colored solid red.
tp.export.save_png('slice_shade.png', 600, supersample=3)
../_images/slice_shade.png

Attributes

color

Shade color.

show

Show shade attributes.

use_lighting_effect

Use lighting effect.

SliceShade.color

Shade color.

Color.MultiColor and Color.RGBColor coloring are not available. Use flooded contours for multi-color or RGB flooding

Example usage:

>>> plot.slice(0).shade.show = True
>>> plot.slice(0).shade.color = Color.Blue
Type:

Color

SliceShade.show

Show shade attributes.

Example usage:

>>> plot.slice(0).shade.show = True
Type:

bool

SliceShade.use_lighting_effect

Use lighting effect.

When set to True, the lighting effect may be selected with the SliceEffects.lighting_effect attribute.

Note

Setting SliceShade.use_lighting_effect will also set the same value for SliceContour.use_lighting_effect, and vice-versa.

Example usage:

>>> plot.slice(0).shade.use_lighting_effect = True
>>> plot.slice(0).effects.lighting_effect = LightingEffect.Paneled
Type:

bool

SliceVector

class tecplot.plot.SliceVector(slice_group)[source]

Vector attributes of the slice group.

from os import path
import tecplot as tp
from tecplot.constant import *

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

plot = tp.active_frame().plot()

plot.show_slices = True
slice_0 = plot.slice(0)

plot.contour(0).variable = dataset.variable('T(K)')

# Vector variables must be assigned before displaying
vectors = plot.vector
vectors.u_variable = dataset.variable('U(M/S)')
vectors.v_variable = dataset.variable('V(M/S)')
vectors.w_variable = dataset.variable('W(M/S)')

slice_vector = plot.slice(0).vector
slice_vector.show = True
slice_vector.vector_type = VectorType.MidAtPoint
slice_vector.color = Color.BluePurple

slice_0.effects.use_translucency = True
slice_0.effects.surface_translucency = 30

# ensure consistent output between interactive (connected) and batch
plot.contour(0).levels.reset_to_nice()

tp.export.save_png('slice_vector.png', 600, supersample=3)
../_images/slice_vector.png

Attributes

arrowhead_style

Arrowhead style of slice vectors.

color

Set slice vector color.

is_tangent

Use tangent vectors for slices.

line_thickness

Vector line thickness as a percentage of the frame height.

show

Show vectors on slices.

vector_type

Type of vector for slices in this slice group.

SliceVector.arrowhead_style

Arrowhead style of slice vectors.

Example usage:

>>> plot.slice(0).vector.show = True
>>> plot.slice(0).vector.arrowhead_style = ArrowheadStyle.Hollow
Type:

ArrowheadStyle

SliceVector.color

Set slice vector color.

Example usage:

>>> plot.slice(0).vector.show = True
>>> plot.slice(0).vector.color = Color.Red
Type:

Color

SliceVector.is_tangent

Use tangent vectors for slices.

Example usage:

>>> plot.slice(0).vector.show = True
>>> plot.slice(0).vector.is_tangent = True
Type:

bool

SliceVector.line_thickness

Vector line thickness as a percentage of the frame height.

Typical values are .02, .1, .4, .8, 1.5

Example usage:

>>> plot.slice(0).vector.show = True
>>> plot.slice(0).vector.line_thickness = .1
Type:

float

SliceVector.show

Show vectors on slices.

Example usage:

>>> plot.slice(0).vector.show = True
Type:

bool

SliceVector.vector_type

Type of vector for slices in this slice group.

Example usage:

>>> plot.slice(0).vector.show = True
>>> plot.slice(0).vector.vector_type = VectorType.MidAtPoint
Type:

VectorType

Streamtraces

Streamtraces

class tecplot.plot.Streamtraces(plot)[source]

Streamtrace attributes for the plot.

A streamtrace is the path traced by a massless particle placed at an arbitrary location in a steady-state vector field. Streamtraces may be used to illustrate the nature of the vector field flow in a particular region of the Plot.

Note

Because streamtraces are dependent upon a vector field, you must define vector components before creating streamtraces. However, it is not necessary to activate the Vector zone layer to use streamtraces.

import os
import tecplot
from tecplot.constant import *

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

frame = tecplot.active_frame()
frame.plot_type = tecplot.constant.PlotType.Cartesian3D

plot = frame.plot()
plot.fieldmap(0).surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
plot.show_mesh = True
plot.show_shade = False

plot.vector.u_variable_index = 4
plot.vector.v_variable_index = 5
plot.vector.w_variable_index = 6
plot.show_streamtraces = True

streamtraces = plot.streamtraces
streamtraces.color = Color.Blue

streamtraces.show_arrows = True
streamtraces.arrowhead_size = 2
streamtraces.step_size = .25
streamtraces.line_thickness = .2
streamtraces.max_steps = 100

streamtraces.add_rake(start_position=(45.49, 15.32, 59.1),
                      end_position=(48.89, 53.2, 47.6),
                      stream_type=Streamtrace.SurfaceLine,
                      num_seed_points=4)


tecplot.export.save_png('streamtrace_example.png', 600, supersample=3)
../_images/streamtrace_example.png

Attributes

active

Determine if there are active streamtraces.

arrowhead_size

Arrowhead size as a percentage of frame height.

arrowhead_spacing

Distance between arrowheads in terms of Y-frame units.

color

Color of streamtraces line (not rods or ribbons).

count

Query the number of active streamtraces for the current plot type.

dash_skip

Number of time deltas used for the "off" sections of the streamlines.

has_terminating_line

Determine if the streamtraces have the terminating line.

line_thickness

Streamtrace line thickness.

marker_color

Color of the streamline markers.

marker_size

Size of streamline markers.

marker_symbol_type

The SymbolType to use for stream markers.

max_steps

Maximum number of steps before the streamtrace is terminated.

min_step_size

Smallest step size to use as a percentage of cell distance.

obey_source_zone_blanking

Obey source zone blanking.

rod_ribbon

Streamtrace rod/ribbon attributes.

show_arrows

Display arrowheads along all streamlines.

show_dashes

Display streamtrace dashes.

show_markers

Display streamtrace markers.

show_paths

Draw streamtrace paths (lines, ribbons, or rods).

step_size

Maximum fraction of the distance across a cell that a streamtrace moves in one step.

termination_line

Streamtraces termination line attributes.

timing

Streamtraces timing attributes.

use_slice_clipping

Clip isosurface by any intersecting slices.

Methods

add(seed_point, stream_type[, direction])

Add a single streamtrace to the plot of the current frame.

add_on_zone_surface(stream_type[, zones, ...])

Add streamtraces to one or more zones in a plot.

add_rake(start_position, end_position, ...)

Add a rake of streamtraces to the plot of the current frame.

delete_all()

Delete all streamtraces for the current plot type.

delete_range(range_start, range_end)

Delete a range of streamtraces.

extract([concatenate, assign_strand_ids])

Create new zones from streamtraces

marker_symbol([symbol_type])

Returns a streamline symbol style object.

position(stream_number)

Query the starting position of a streamtrace.

set_termination_line(line_points)

Set the position of the termination line for streamtraces.

streamtrace_type(stream_number)

Query the type of a streamtrace by streamtrace number.

Streamtraces.active

Determine if there are active streamtraces.

Note

This property is read-only.

Returns:

bool. True if there are active streamtraces in the current plot type.

Example usage:

>>> streamtraces_are_active = plot.streamtraces.active
Type:

bool

Streamtraces.add(seed_point, stream_type, direction=StreamDir.Both)[source]

Add a single streamtrace to the plot of the current frame.

The plot type must be either Cartesian2D or Cartesian3D.

Parameters:

Note

stream_type is automatically set to Streamtrace.SurfaceLine if the plot type is Cartesian2DFieldPlot. The only stream type available for 2D plots is Streamtrace.SurfaceLine.

import os
import tecplot
from tecplot.constant import *
import numpy as np

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

frame = tecplot.active_frame()
frame.plot_type = tecplot.constant.PlotType.Cartesian3D

plot = frame.plot()
plot.contour(0).variable = dataset.variable('P(N/m2)')
plot.contour(0).levels.reset_to_nice()
plot.contour(0).legend.show = False

plot.vector.u_variable = dataset.variable('U(M/S)')
plot.vector.v_variable = dataset.variable('V(M/S)')
plot.vector.w_variable = dataset.variable('W(M/S)')

# Goal: create a grid of 12 stream trace ribbons
x_slice_location = .79
y_start = .077
y_end = .914
z_start = .052
z_end = .415

num_left_right_slices = 4  # Must be >= 2
num_top_bottom_slices = 3  # Must be >= 2

plot.show_streamtraces = True
streamtraces = plot.streamtraces
streamtraces.show_paths = True

rod = streamtraces.rod_ribbon
rod.width = .03
rod.contour.show = True

for y in np.linspace(y_start, y_end, num=num_left_right_slices):
    for z in np.linspace(z_start, z_end, num=num_top_bottom_slices):
        streamtraces.add([x_slice_location,y,z], Streamtrace.VolumeRibbon)

tecplot.export.save_png('streamtrace_add_xyz.png', 600, supersample=3)
../_images/streamtrace_add_xyz.png
Streamtraces.add_on_zone_surface(stream_type, zones=None, num_seed_points=10, direction=StreamDir.Both)[source]

Add streamtraces to one or more zones in a plot.

The plot type must be either Cartesian2D or Cartesian3D.

Note

For volume zones the streamtraces are propagated from the surfaces of the volume.

Parameters:
  • stream_type – (Streamtrace): Type of streamtraces to add.

  • zones (set of integers, optional) – Set of Zones on which to add streamtraces. If None, then streamtraces will be added to the currently active zones.

  • num_seed_points – (int, optional): Number of seed points for distributing along a rake or on defined surfaces.

  • direction – (StreamDir, optional): Direction of propagation of the streamtraces being added.

import os

import tecplot
from tecplot.constant import *

examples_dir = tecplot.session.tecplot_examples_directory()
datafile = os.path.join(examples_dir, 'OneraM6wing', 'OneraM6_SU2_RANS.plt')
dataset = tecplot.data.load_tecplot(datafile)

frame = tecplot.active_frame()
frame.plot_type = tecplot.constant.PlotType.Cartesian3D

plot = frame.plot()

plot.vector.u_variable_index = 4
plot.vector.v_variable_index = 5
plot.vector.w_variable_index = 6
plot.show_streamtraces = True

plot.streamtraces.add_on_zone_surface(
            # To add streamtraces to the currently active zones,
            # pass zones=None
            zones=[1],  # Add streamtraces on 2nd zone only
            stream_type=Streamtrace.SurfaceLine,
            num_seed_points=200)

tecplot.export.save_png('streamtrace_add_on_zone_surface.png', 600, supersample=3)
../_images/streamtrace_add_on_zone_surface.png
Streamtraces.add_rake(start_position, end_position, stream_type, num_seed_points=10, direction=StreamDir.Both)[source]

Add a rake of streamtraces to the plot of the current frame.

The plot type must be either Cartesian2D or Cartesian3D.

Parameters:
import os

import tecplot
from tecplot.constant import *

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

frame = tecplot.active_frame()
frame.plot_type = tecplot.constant.PlotType.Cartesian3D

plot = frame.plot()
plot.fieldmap(0).surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
plot.show_mesh = True
plot.show_shade = False

plot.vector.u_variable_index = 4
plot.vector.v_variable_index = 5
plot.vector.w_variable_index = 6
plot.show_streamtraces = True

streamtraces = plot.streamtraces
streamtraces.add_rake(start_position=[.5, .5, .5],
                      end_position=[20, 20, 20],
                      stream_type=Streamtrace.VolumeLine)

tecplot.export.save_png('streamtrace_add_rake.png', 600, supersample=3)