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.

Attributes

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.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

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)

for fmap in plot.fieldmaps():
    fmap.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.
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_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.
Vector2D.arrowhead_angle

Angle between the vector body and the head line.

Type:float (degrees)

Example usage:

>>> plot.vector.arrowhead_angle = 10
Vector2D.arrowhead_fraction

Size of the arrowhead when sizing by fraction.

Type:float (ratio)

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
Vector2D.arrowhead_size

Size of arrowhead when sizing by frame height.

Type:float (percent of 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
Vector2D.length

Length of all vectors when not using relative sizing.

Type:float (percent of plot height)

Example usage:

>>> plot.vector.use_relative = False
>>> plot.vector.length = 5
Vector2D.reference_vector

Vector field reference vector.

Type:ReferenceVector

Example usage:

>>> plot.vector.reference_vector.show = True
Vector2D.relative_length

Magnitude-varying length of the vector line.

Type:float (grid units or cm per magnitude)

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
Vector2D.size_arrowhead_by_fraction

Base arrowhead size on length of vector line.

Type:bool

Example usage:

>>> plot.vector.size_arrowhead_by_fraction = True
>>> plot.vector.relative_length = 0.1
Vector2D.u_variable

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

Type:Variable

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

>>> plot.vector.u_variable = dataset.variable('Pressure X')
Vector2D.u_variable_index

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

Type:integer (Zero-based index)

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

>>> plot.vector.u_variable_index = 3
Vector2D.use_grid_units

Use grid-units when determining the relative length.

Type:bool

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
Vector2D.use_relative

Use relative sizing for vector lines.

Type:bool

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
Vector2D.v_variable

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

Type:Variable

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

>>> plot.vector.v_variable = dataset.variable('Pressure Y')
Vector2D.v_variable_index

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

Type:integer (Zero-based index)

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

>>> plot.vector.v_variable_index = 4

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.
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_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.
Vector3D.arrowhead_angle

Angle between the vector body and the head line.

Type:float (degrees)

Example usage:

>>> plot.vector.arrowhead_angle = 10
Vector3D.arrowhead_fraction

Size of the arrowhead when sizing by fraction.

Type:float (ratio)

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
Vector3D.arrowhead_size

Size of arrowhead when sizing by frame height.

Type:float (percent of 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
Vector3D.length

Length of all vectors when not using relative sizing.

Type:float (percent of plot height)

Example usage:

>>> plot.vector.use_relative = False
>>> plot.vector.length = 5
Vector3D.reference_vector

Vector field reference vector.

Type:ReferenceVector

Example usage:

>>> plot.vector.reference_vector.show = True
Vector3D.relative_length

Magnitude-varying length of the vector line.

Type:float (grid units or cm per magnitude)

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
Vector3D.size_arrowhead_by_fraction

Base arrowhead size on length of vector line.

Type:bool

Example usage:

>>> plot.vector.size_arrowhead_by_fraction = True
>>> plot.vector.relative_length = 0.1
Vector3D.u_variable

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

Type:Variable

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

>>> plot.vector.u_variable = dataset.variable('Pressure X')
Vector3D.u_variable_index

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

Type:integer (Zero-based index)

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

>>> plot.vector.u_variable_index = 3
Vector3D.use_grid_units

Use grid-units when determining the relative length.

Type:bool

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
Vector3D.use_relative

Use relative sizing for vector lines.

Type:bool

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
Vector3D.v_variable

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

Type:Variable

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

>>> plot.vector.v_variable = dataset.variable('Pressure Y')
Vector3D.v_variable_index

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

Type:integer (Zero-based index)

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

>>> plot.vector.v_variable_index = 4
Vector3D.w_variable

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

Type:Variable

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

>>> plot.vector.w_variable = dataset.variable('Pressure Z')
Vector3D.w_variable_index

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

Type:integer (Zero-based index)

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

>>> plot.vector.w_variable_index = 5

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.
show Draw the reference vector.
ReferenceVector.angle

Degrees counter-clockwise to rotate the reference vector.

Type:float (degrees)

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.angle = 90  # vertical, up
ReferenceVector.color

Color of the reference vector.

Type:Color

Example usage:

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

reference vector label style control.

Type:ReferenceVectorLabel

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.label.show = True
ReferenceVector.line_thickness

reference vector line thickness.

Type:float (percentage of frame height)

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.line_thickness = 0.3
ReferenceVector.magnitude

Length of the reference vector.

Type:float (data units)

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.magnitude = 2
ReferenceVector.position

\((x,y)\) of the reference vector.

Type:2-tuple of floats (\((x,y)\) percent of frame height)

Example usage:

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

Draw the reference vector.

Type:boolean

Example usage:

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

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 Font 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.

Type:Color

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
ReferenceVectorLabel.font

Font of the reference vector label.

Type:Font

Example usage:

>>> ref_vector = plot.vector.reference_vector
>>> ref_vector.show = True
>>> ref_vector.label.show = True
>>> ref_vector.label.font.size = 6
ReferenceVectorLabel.format

Number formatting control for the reference vector label.

Type:LabelFormat

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
ReferenceVectorLabel.offset

Distance from the reference vector to the associated label.

Type:float (percent of frame height)

Example usage:

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

Print a label next to the reference vector.

Type:boolean

Example usage:

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

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.

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 Automatically skip some levels to create a reasonably sized legend.
box Legend box attributes.
header_font Font used to display the name of the contour variable.
include_cutoff_levels Show color bands and labels for levels affected by color cutoff.
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 of the legend as a percentage of frame width/height.
row_spacing Spacing between rows in the legend.
show Show or hide the legend.
show_header Show the name of the contour variable in the legend.
text_color Color of legend text.
vertical Orientation of the legend.
ContourLegend.anchor_alignment

Anchor location of the legend.

Type:AnchorAlignment

Example usage:

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

Automatically skip some levels to create a reasonably sized legend.

Type:boolean

Example usage:

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

Legend box attributes.

Type:text.TextBox

Example usage:

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

Font used to display the name of the contour variable.

Note

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

Type:text.Font

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.header_font.italic = True
ContourLegend.include_cutoff_levels

Show color bands and labels for levels affected by color cutoff.

Type:boolean

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.include_cutoff_levels = True
ContourLegend.label_format

Number formatting for labels along the legend.

Type:LabelFormat

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
ContourLegend.label_increment

Spacing between labels along the contour legend.

Type:float

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

ContourLegend.label_location

Placement of labels on the legend.

Type:ContLegendLabelLocation

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

ContourLegend.label_step

Step size between labels along the legend.

Type:integer

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

>>> contour = frame.plot().contour(0)
>>> contour.legend.label_step = 3
>>> print(contour.labels.step)
3
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.

Type:text.Font

Example usage:

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

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

Type:boolean

Example usage:

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

Position of the legend 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.

Type:2-tuple of floats

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
ContourLegend.row_spacing

Spacing between rows in the legend.

Type:float

Example usage:

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

Show or hide the legend.

Type:boolean

Example usage:

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

Show the name of the contour variable in the legend.

Type:boolean

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
>>> legend.show_header = True
ContourLegend.text_color

Color of legend text.

Type:Color

Example usage:

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

Orientation of the legend.

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

Type:boolean

Example usage:

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

LineLegend

class tecplot.legend.LineLegend(plot, *svargs)[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.

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 of the legend 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.

Type:AnchorAlignment

Example usage:

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

Legend box attributes.

Type:text.TextBox

Example usage:

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

Legend font attributes.

Note

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

Type:text.Font

Example usage:

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

Position of the legend 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.

Type:2-tuple of floats

Example usage:

>>> from tecplot.constant import PlotType
>>> legend = frame.plot(PlotType.XYLine).legend
>>> legend.position = (.1, .3)
>>> pos = legend.position
>>> pos.x  # == position[0]
.1
>>> pos.y  # == position[1]
.3
LineLegend.row_spacing

Spacing between rows in the legend.

Type:float

Example usage:

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

Show or hide the legend.

Type:boolean

Example usage:

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

Show/hide mapping names in the legend.

Type:boolean

Example usage:

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

Color of legend text.

Type:Color

Example usage:

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

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'

# 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.

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

ContourColormapFilter object controlling colormap style properties.

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

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

Type:string

Example:

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

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

Type:integer

Example:

>>> plot.contour(0).default_num_levels = 20
ContourGroup.labels

ContourLabels object controlling contour line labels.

Type:ContourLabels

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
ContourGroup.legend

ContourLegend associated with this ContourGroup.

Type:ContourLegend

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

Example usage:

>>> plot.contour(0).legend.show = True
ContourGroup.levels

ContourLevels holding the list of contour levels.

Type:ContourLevels

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)
ContourGroup.lines

ContourLines object controlling contour line style.

Type:ContourLines

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
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

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.

Type:boolean

Thie example turns off the maximum cutoff:

>>> plot.contour(0).color_cutoff.include_max = False
ContourColorCutoff.include_min

Use the minimum cutoff value.

Type:boolean

Example usage:

>>> plot.contour(0).color_cutoff.include_min = True
>>> plot.contour(0).color_cutoff.min = 3.14
ContourColorCutoff.inverted

Cuts values outside the range instead of inside.

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

The maximum cutoff value.

Type:float or None

The include_max must be set to True:

>>> plot.contour(0).color_cutoff.include_max = True
>>> plot.contour(0).color_cutoff.max = None
ContourColorCutoff.min

The minimum cutoff value.

Type:float or None

The include_min must be set to True:

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

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

# 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.

Type:float

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()
ContourColormapFilter.continuous_min

Lower limit for continuous colormap flooding.

Type:float

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
ContourColormapFilter.distribution

Rendering style of the colormap.

Type:ColorMapDistribution

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
ContourColormapFilter.fast_continuous_flood

Use a fast approximation to continuously flood the colormap.

Type:bool

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
ContourColormapFilter.num_cycles

Number of cycles to repeat the colormap.

Type:integer
>>> plot.contour(0).colormap_filter.num_cycles = 3
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.

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

Enable the colormap overrides in this contour group.

Type:boolean

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
ContourColormapFilter.zebra_shade

Returns a ContourColormapZebraShade filtering object.

Type:ContourColormapZebraShade

Example usage:

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

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.

Type:Color

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
ContourColormapOverride.end_level

Last level to override.

Type:integer

Example usage:

>>> colormap_filter = plot.contour(0).colormap_filter
>>> cmap_override = colormap_filter.override(0)
>>> cmap_override.end_level = 2
ContourColormapOverride.show

Include this colormap override when filter is shown.

Type:boolean

Example usage:

>>> colormap_filter = plot.contour(0).colormap_filter
>>> cmap_override = colormap_filter.override(0)
>>> cmap_override.show = True
ContourColormapOverride.start_level

First level to override.

Type:integer

Example usage:

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

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

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.

Type:Color

Example usage:

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

Show zebra shading in this ContourGroup.

Type:boolean

Example usage:

>>> cmap_filter = plot.contour(0).colormap_filter
>>> cmap_filter.zebra_shade.show = True
ContourColormapZebraShade.transparent

Set the the zebra bands to be transparent.

Type:boolean

Example usage:

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

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

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.

Type:bool

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
ContourLabels.auto_generate

Automatically generate labels along contour lines.

Type:bool

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
ContourLabels.background_color

Background fill color behind the text labels.

Type:Color

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
ContourLabels.color

Text color of the labels.

Type:Color

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
ContourLabels.filled

Fill the background area behind the text labels.

Type:boolean

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
ContourLabels.font

text.Font used to show the labels.

Type:text.Font

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
ContourLabels.format

Number formatting for contour labels.

Type:LabelFormat

Example usage:

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

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

Type:bool

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
ContourLabels.margin

Spacing around the text and the filled background area.

Type:float in percentage of the text height.

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
ContourLabels.show

Show the contour line labels.

Type:bool

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
ContourLabels.spacing

Spacing between labels along the contour lines.

Type:float

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
ContourLabels.step

Number of contour lines from one label to the next.

Type:int

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

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 (integer) – 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 (integer) – Approximate number of levels to create. (default: 10)

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

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).

Type: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
ContourLines.pattern_length

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

Type: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
ContourLines.step

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

Type:int

Example:

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

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 Query/Assign up to 3 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.
vector Vector attributes for this isosurface group.
IsosurfaceGroup.contour

Contour attributes for this isosurface group.

Type:IsosurfaceContour

Example usage:

>>> plot.isosurface(0).show = True
>>> plot.isosurface(0).contour.show = True
IsosurfaceGroup.definition_contour_group

Contour group from which isosurfaces are based.

Type:ContourGroup

Example usage:

>>> group = plot.contour(1)
>>> plot.isosurface(0).definition_contour_group = group
IsosurfaceGroup.definition_contour_group_index

Contour group index from which isosurfaces are based.

Type:Index

Contour group settings can be changed from plot.ContourGroup.

Example usage:

>>> plot.isosurface(0).show = True
>>> plot.isosurface(0).definition_contour_group_index = 1
IsosurfaceGroup.effects

Settings for isosurface effects.

Type:IsosurfaceEffects

Example usage:

>>> plot.isosurface(0).show = True
>>> plot.isosurface(0).effects.use_translucency = True
IsosurfaceGroup.isosurface_selection

Select where to draw isosurfaces.

Type:IsoSurfaceSelection
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)
IsosurfaceGroup.isosurface_values

Query/Assign up to 3 values at which to draw isosurfaces.

Type:1, 2, or 3-tuple of floats, or 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
IsosurfaceGroup.mesh

Mesh attributes for this isosurface group.

Type:IsosurfaceMesh

Example usage:

>>> plot.isosurface(0).show = True
>>> plot.isosurface(0).mesh.show = True
IsosurfaceGroup.obey_source_zone_blanking

Obey source zone blanking.

Type:

boolean

  • 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
IsosurfaceGroup.shade

Shade attributes for this isosurface group.

Type:IsosurfaceShade

Example usage:

>>> plot.isosurface(0).shade.show = True
IsosurfaceGroup.show

Show isosurfaces for this isosurface group.

Type:bool

Example usage:

>>> plot.isosurface(1).show = True
IsosurfaceGroup.surface_generation_method

Determines how the surface is generated.

Type:SurfaceGenerationMethod

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
IsosurfaceGroup.vector

Vector attributes for this isosurface group.

Type:IsosurfaceVector

Example usage:

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

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

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 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 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.

Type:ContourType
  • 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
IsosurfaceContour.flood_contour_group

Contour group to use for flooding.

Type:ContourGroup

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
IsosurfaceContour.flood_contour_group_index

The Index of the ContourGroup to use for flooding.

Type:Index (zero-based index)

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
IsosurfaceContour.line_color

Color of contour lines.

Type:Color or ContourGroup

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
IsosurfaceContour.line_contour_group

The contour group to use for contour lines.

Type: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
>>> group = plot.contour(1)
>>> contour.line_contour_group = group
IsosurfaceContour.line_contour_group_index

The Index of the ContourGroup to use for contour lines.

Type:integer (zero-based index)

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
IsosurfaceContour.line_thickness

Contour line thickness as a percentage of frame width.

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

Type:float

Example usage:

>>> plot.show_isosurfaces = True
>>> plot.isosurface(0).contour.line_thickness = .4
IsosurfaceContour.show

Show contours on isosurfaces.

Type:boolean

Example usage:

>>> plot.isosurface(0).contour.show = True
IsosurfaceContour.use_lighting_effect

Enable lighting effect.

Type:Boolean

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

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 Lighting effect.
surface_translucency Surface translucency of the isosurface group.
use_translucency Enable surface translucency for this isosurface group.
IsosurfaceEffects.lighting_effect

Lighting effect.

Type:LightingEffect

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
IsosurfaceEffects.surface_translucency

Surface translucency of the isosurface group.

Type:integer

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
IsosurfaceEffects.use_translucency

Enable surface translucency for this isosurface group.

Type:boolean

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

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.

Type:Color or ContourGroup

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
IsosurfaceMesh.line_thickness

Isosurface mesh line thickness.

Type:float

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

Example usage:

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

Display the mesh on isosurfaces.

Type:boolean

Example usage:

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

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.

Type: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
IsosurfaceShade.show

Show shade attributes.

Type:boolean

Example usage:

>>> plot.isosurface(0).shade.show = True
IsosurfaceShade.use_lighting_effect

Enable lighting effect.

Type:Boolean

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

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.

Type:ArrowheadStyle

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.

IsosurfaceVector.color

Isosurface vector color.

Type:Color or ContourGroup

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.

IsosurfaceVector.is_tangent

Use tangent vectors for isosurfaces.

Type:boolean

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.

IsosurfaceVector.line_thickness

Vector line thickness as a percentage of the frame height.

Type:float

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.

IsosurfaceVector.show

Show vectors on isosurfaces.

Type:boolean

Example usage:

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

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

IsosurfaceVector.vector_type

Type of vector for isosurfaces.

Type:VectorType

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.

Slice

SliceGroup

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

Change attributes associated with slices.

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

tp.export.save_png('slice_example.png', 600, supersample=3)
../_images/slice_example.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.
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.
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 which plane the slice is drawn on (X,Y,Z, I, J, K or arbitrary).
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 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.
vector Vector attributes for this slice group.

Methods

set_arbitrary_from_points(p1, p2, p3) Set an arbitrary slice from 3 points.
SliceGroup.arbitrary_normal

Normal for arbitrary slices.

Type:3-tuple of floats

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
SliceGroup.contour

Contour attributes for the slice group.

Type:SliceContour

Example usage:

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

Edge attributes for this slice group.

Type:SliceEdge

Example usage:

>>> plot.slice(0).edge.show = True
SliceGroup.effects

Effects attributes for this slice group.

Type:SliceEffects

Example usage:

>>> plot.slice(0).effects.use_translucency = True
SliceGroup.end_position

Position of the end slice.

SliceGroup.show_start_and_end_slices must be True to show the end slice.

Type: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
SliceGroup.mesh

Mesh attributes for this slice group.

Type:SliceMesh

Example usage:

>>> plot.slice(0).mesh.show = True
SliceGroup.num_intermediate_slices

Number of intermediate slicing planes.

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

Type:integer

Example usage:

>>> # Show 2 intermediate slices
>>> plot.slice(0).num_intermediate_slices = 2
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.

Type:boolean

Example usage:

>>> plot.slice(0).obey_source_zone_blanking = True
SliceGroup.orientation

Select which plane the slice is drawn on (X,Y,Z, I, J, K or arbitrary).

Type:SliceSurface

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
SliceGroup.origin

Origin of the slice.

Type: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
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
p2:  3-`tuple` of floats
p3:  3-`tuple` of floats

Example usage:

>>> slice_0 = plot.slice(0)
>>> slice_0.set_arbitrary_from_points((0,0,0), (.1,.2,.3), (.1,.1,.1))
SliceGroup.shade

Shade attributes for this slice group.

Type:SliceShade

Example usage:

>>> plot.slice(0).shade.show = True
SliceGroup.show

Show slices for this slice group.

Type:bool

Example usage:

>>> plot.slice(0).show = True
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

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

Type:bool

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.

Type:boolean

Example usage:

>>> plot.slice(0).show_start_and_end_slices = True
SliceGroup.slice_source

Zones to slice through.

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

Type:SliceSource

Example usage:

>>> plot.slice(0).slice_source = SliceSource.SurfaceZones
SliceGroup.start_position

Position of the start slice.

SliceGroup.show_start_and_end_slices must be True to show the start slice.

Type: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
SliceGroup.surface_generation_method

Determines how the surface is generated.

Type:SurfaceGenerationMethod

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
SliceGroup.vector

Vector attributes for this slice group.

Type:SliceVector

Example usage:

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

SliceContour

class tecplot.plot.SliceContour(parent_slice)[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
plot.contour(2).labels.show = True
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

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 The Index of the ContourGroup to use for flooding.
line_color Color of contour lines.
line_contour_group Contour group to use for contour lines.
line_contour_group_index The Index of the ContourGroup to use for contour lines.
line_thickness Contour line thickness as a percentage of frame width.
show Show contours on the slice.
use_lighting_effect Enable lighting effect.
SliceContour.contour_type

Contour type for the slice contours.

Type:ContourType

Example usage:

>>> plot.show_slices = True
>>> plot.slice(0).contour.contour_type = ContourType.AverageCell
SliceContour.flood_contour_group

Contour group to use for flooding.

Type:ContourGroup

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
SliceContour.flood_contour_group_index

The Index of the ContourGroup to use for flooding.

Type:Index (zero-based index)

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
SliceContour.line_color

Color of contour lines.

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

Type:Color

Example usage:

>>> plot.show_slices = True
>>> plot.slice(0).contour.line_color = Color.Blue
SliceContour.line_contour_group

Contour group to use for contour lines.

Type:ContourGroup

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
SliceContour.line_contour_group_index

The Index of the ContourGroup to use for contour lines.

Type:integer (zero-based index)

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
SliceContour.line_thickness

Contour line thickness as a percentage of frame width.

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

Type:float

Example usage:

>>> plot.show_slices = True
>>> plot.slice(0).contour.line_thickness = .4
SliceContour.show

Show contours on the slice.

Type:bool

Example usage:

>>> plot.show_slices = True
>>> plot.slice(1).contour.show = True
SliceContour.use_lighting_effect

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.

Type:boolean

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(vector)[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
slice_0 = plot.slice(0)

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

slice_0.edge.show = True
slice_0.edge.line_thickness = 0.8

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.

Type:Color

Example usage:

>>> plot.slice(0).edge.show = True
>>> plot.slice(0).edge.color = Color.Blue
SliceEdge.edge_type

Edge type.

Type:EdgeType

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
SliceEdge.line_thickness

Edge line thickness as a percentage of frame width.

Type:float

Example usage:

>>> plot.slice(0).edge.show = True
>>> plot.slice(0).edge.line_thickness = .8
SliceEdge.show

Show edges.

This property must be set to True to show any of the other edge properties.

Type:boolean

Example usage:

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

SliceEffects

class tecplot.plot.SliceEffects(effects)[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

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

Attributes

lighting_effect Lighting effect.
surface_translucency Surface translucency of the slice group.
use_translucency Enable surface translucency for this slice group.
SliceEffects.lighting_effect

Lighting effect.

Type:LightingEffect

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
SliceEffects.surface_translucency

Surface translucency of the slice group.

Type:integer

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
SliceEffects.use_translucency

Enable surface translucency for this slice group.

Type:boolean

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

SliceMesh

class tecplot.plot.SliceMesh(mesh)[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

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

Attributes

color Slice mesh line Color or ContourGroup.
line_thickness Mesh line thickness.
show Show mesh lines.
SliceMesh.color

Slice mesh line Color or ContourGroup.

Type:Color or ContourGroup

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
SliceMesh.line_thickness

Mesh line thickness.

Type:float

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
SliceMesh.show

Show mesh lines.

Type:boolean

Example usage:

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

SliceShade

class tecplot.plot.SliceShade(shade)[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.

Type: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
SliceShade.show

Show shade attributes.

Type:boolean

Example usage:

>>> plot.slice(0).shade.show = True
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.

Type:Boolean

Example usage:

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

SliceVector

class tecplot.plot.SliceVector(vector)[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

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.

Type:ArrowheadStyle

Example usage:

>>> plot.slice(0).vector.show = True
>>> plot.slice(0).vector.arrowhead_style = ArrowheadStyle.Hollow
SliceVector.color

Set slice vector color.

Type:Color

Example usage:

>>> plot.slice(0).vector.show = True
>>> plot.slice(0).vector.color = Color.Red
SliceVector.is_tangent

Use tangent vectors for slices.

Type:boolean

Example usage:

>>> plot.slice(0).vector.show = True
>>> plot.slice(0).vector.is_tangent = True
SliceVector.line_thickness

Vector line thickness as a percentage of the frame height.

Type:float

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

Example usage:

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

Show vectors on slices.

Type:boolean

Example usage:

>>> plot.slice(0).vector.show = True
SliceVector.vector_type

Type of vector for slices in this slice group.

Type:VectorType

Example usage:

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

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

are_active Determine if there are active streamtraces in the current plot type.
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.

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.
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.add(seed_point, stream_type, direction=<StreamDir.Both: 2>)[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.

Raises:TecplotSystemError – The streamtraces could not be added.
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: 2>)[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 – (integer, 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 tecplot
from tecplot.constant import *
import os

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: 2>)[source]

Add a rake of streamtraces to the plot of the current frame.

The plot type must be either Cartesian2D or Cartesian3D.

Parameters:
import tecplot
from tecplot.constant import *
import os

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)
../_images/streamtrace_add_rake.png
Streamtraces.are_active

Determine if there are active streamtraces in the current plot type.

Note

This property is read-only.

Returns:boolean. True if there are active streamtraces in the current plot type.

Example usage:

>>> streamtraces_are_active = plot.streamtraces.are_active
Streamtraces.arrowhead_size

Arrowhead size as a percentage of frame height.

Type:float

Recommend values are one of 1, 3, 5, 8, or 12.

Example usage:

>>> plot.streamtraces.show_arrows = True
>>> plot.streamtraces.arrowhead_size = 1.0
Streamtraces.arrowhead_spacing

Distance between arrowheads in terms of Y-frame units.

Type:float

For example, a value of 10 will space arrowheads approximately ten percent of the frame height apart from each other along each streamline.

Example usage:

>>> plot.streamtraces.show_arrows = True
>>> plot.streamtraces.arrowhead_spacing = 10
Streamtraces.color

Color of streamtraces line (not rods or ribbons).

Type:Color or ContourGroup

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

Example usage:

>>> plot.streamtraces.color = Color.Red
Streamtraces.count

Query the number of active streamtraces for the current plot type.

Returns:integer

Note

This property is read-only.

>>> num_active_streamtraces = plot.streamtraces.count
Streamtraces.dash_skip

Number of time deltas used for the “off” sections of the streamlines.

Note

The dash_skip value must be greater than 0.

Type:integer

Example usage:

>>> plot.streamtraces.dash_skip = 2
Streamtraces.delete_all()[source]

Delete all streamtraces for the current plot type.

2D and 3D streamtraces are independent of each other.

If the plot type is Cartesian2D, all 2D streamtraces are deleted. If the plot type is Cartesian3D, all 3D streamtraces are deleted.

Raises:TecplotSystemError – The streamtraces could not be deleted.

Example usage:

>>> plot.streamtraces.delete_all()
Streamtraces.delete_range(range_start, range_end)[source]

Delete a range of streamtraces.

Parameters:
  • range_start – (integer): 0-based start streamtrace number to delete.
  • range_end – (integer): 0-based end streamtrace number to delete.
Raises:

TecplotSystemError – The streamtraces in the range could not be deleted.

Example usage:

>>> # Delete the first 100 streamtraces
>>> plot.streamtraces.delete_range(0, 99)
Streamtraces.has_terminating_line

Determine if the streamtraces have the terminating line.

Note

This property is read-only.

Returns:boolean. True if the streamtraces have the terminating line, False otherwise.

Example usage:

>>> has_terminating_line = plot.streamtraces.has_terminating_line
Streamtraces.line_thickness

Streamtrace line thickness.

Type:float

Line thickness as a percentage of the frame height for 2D lines, or a percentage of the median axis length for 3D surface lines and volume lines.

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

Example usage:

>>> plot.streamtraces.line_thickness = 1.1
Streamtraces.marker_color

Color of the streamline markers.

Type:Color or ContourGroup

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

Example usage:

>>> plot.streamtraces.marker_color = Color.Blue
Streamtraces.marker_size

Size of streamline markers.

Type:float

Example usage:

>>> plot.streamtraces.marker_size = 1.1
Streamtraces.marker_symbol(symbol_type=None)[source]

Returns a streamline symbol style object.

Parameters:symbol_type (SymbolType, optional) – The type of symbol to return. By default, this will return the active marker symbol type which is obtained from Streamtraces.marker_symbol_type.

Returns: TextSymbol or GeometrySymbol, depending on marker_symbol_type

Example usage:

>>> from tecplot.constant import SymbolType
>>> streamtrace = plot.streamtraces
>>> streamtraces.marker_symbol_type = SymbolType.Text
>>> symbol = streamtraces.marker_symbol(SymbolType.Text)
>>> symbol.text = 'a'
Streamtraces.marker_symbol_type

The SymbolType to use for stream markers.

Type:SymbolType

This sets the active symbol type for streamtrace markers. Use Streamtraces.marker_symbol to access the symbol:

>>> from tecplot.constant import SymbolType
>>> streamtrace = plot.streamtraces
>>> streamtraces.marker_symbol_type = SymbolType.Text
>>> symbol = streamtraces.marker_symbol(SymbolType.Text)
>>> symbol.text = 'a'
Streamtraces.max_steps

Maximum number of steps before the streamtrace is terminated.

Type:integer

max_steps prevents streamtraces from spinning forever in a vortex, or from wandering into a region where the vector components are very small, very random, or both.

If a small step_size is selected, the max_steps should be a large value.

Example usage:

>>> plot.streamtraces.max_steps = 5000
Streamtraces.min_step_size

Smallest step size to use as a percentage of cell distance.

A typical minimum step size value is 0.00001, which is the default.

Type:float

Warning

Setting this too small results in integration problems. Setting this greater than or equal to the step_size results in a constant step size.

Example usage:

>>> plot.streamtraces.min_step_size = .0002
Streamtraces.obey_source_zone_blanking

Obey source zone blanking.

Type:boolean

When True, streamtraces are generated for non-blanked regions only. When False, streamtraces are generated for both blanked and unblanked regions.

Example usage:

>>> plot.streamtraces.obey_source_zone_blanking = True
Streamtraces.position(stream_number)[source]

Query the starting position of a streamtrace.

Parameters:stream_number – (integer): 0-based stream number to query.
Returns:tuple of floats

Get the position of streamtrace number 3:

>>> position = plot.streamtraces.position(2) # Note: 0-based
>>> position.x  # == position[0]
0.1
>>> position.y  # == position[1]
0.2
>>> position.z  # == position[2]
0.3
Streamtraces.rod_ribbon

Streamtrace rod/ribbon attributes.

Type:StreamtraceRodRibbon

Example usage:

>>> streamtraces.rod_ribbon.mesh.show = True
Streamtraces.set_termination_line(line_points)[source]

Set the position of the termination line for streamtraces.

Parameters:line_points – (array of float tuple) Points of the termination line.
Raises:TecplotSystemError – Termination line could not be set.

Example usage:

>>> # Multi-segment line between points (0,0)-(5,8)-(3,6)
>>> line_points = [(0, 0), (5, 8), (3,6)]
>>> plot.streamtraces.set_termination_line(line_points)
Streamtraces.show_arrows

Display arrowheads along all streamlines.

Type:boolean

Example usage:

>>> plot.streamtraces.show_arrows = True
Streamtraces.show_dashes

Display streamtrace dashes.

The lengths of the dashes and the spaces between the dashes are controlled by the value of StreamtraceTiming.delta. Set the Streamtraces.dash_skip attribute to control the number of time deltas used for the “off” sections of the streamtraces.

Type:boolean

Example usage:

>>> plot.streamtraces.show_dashes = True
Streamtraces.show_markers

Display streamtrace markers.

Type:boolean

Stream markers are only available for surface and volume type streamlines.

You may also specify the size, color, and shape of the markers.

Example usage:

>>> plot.streamtraces.show_markers = True
Streamtraces.show_paths

Draw streamtrace paths (lines, ribbons, or rods).

Type:boolean

A streamtrace path may be a line, ribbon or rod.

Example usage:

>>> plot.streamtraces.show_paths = True

See also Streamtraces.show_markers

Streamtraces.step_size

Maximum fraction of the distance across a cell that a streamtrace moves in one step.

Type:float

The step size is the maximum fraction of the distance across a cell that a streamtrace moves in one step. A streamtrace adjusts its step size between step_size and min_step_size, depending on local curvature of the streamtrace.

A typical value (and the default) is 0.25, which results in four integration steps through each cell or element. The value for Step Size affects the accuracy of the integration.

Warning

Setting step size too small can result in round-off errors, while setting it too large can result in truncation errors and missed cells.

Example usage:

>>> plot.streamtraces.step_size = .25
Streamtraces.streamtrace_type(stream_number)[source]

Query the type of a streamtrace by streamtrace number.

Parameters:stream_number – (integer): 0-based stream number to query.
Returns:Streamtrace

Get the type of streamtrace 3. Note 0-based stream number:

>>> streamtrace_type = plot.streamtraces.streamtrace_type(2) # streamtrace 3
>>> streamtrace_type
<Streamtrace.VolumeLine: 2>
Streamtraces.termination_line

Streamtraces termination line attributes.

A streamtrace termination line is a polyline that terminates any streamtraces that cross it. The termination line is useful for stopping streamtraces before they spiral or stall.

Type:StreamtraceTerminationLine

Example usage:

>>> term_line = plot.streamtraces.termination_line
>>> term_line.show = True
Streamtraces.timing

Streamtraces timing attributes.

Type:StreamtraceTiming

Example usage:

>>> timing = plot.streamtraces.timing
>>> timing.start = 0.01

StreamtraceRodRibbon

class tecplot.plot.StreamtraceRodRibbon(streamtrace)[source]

Get/Set streamtrace rod/ribbon attributes.

The StreamtraceRodRibbon class allows you to query and set attributes of streamtrace rod/ribbon types:

In addition to attributes common to all rod/ribbon streamtrace types such as width, some attributes are further divided into subcategories:

Note

To change the color of streamtrace rods/ribbons, set StreamtraceRodRibbonShade.color.

import os
import tecplot
from tecplot.constant import *

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.show_mesh = False
plot.show_shade = False
plot.show_edge = True
plot.fieldmap(0).edge.edge_type = EdgeType.Creases
plot.contour(0).variable = dataset.variable(3)
plot.contour(0).levels.reset_to_nice()

plot.vector.u_variable_index = 3
plot.vector.v_variable_index = 4
plot.vector.w_variable_index = 5

plot.show_streamtraces = True
plot.streamtraces.rod_ribbon.width = .03
plot.streamtraces.rod_ribbon.contour.show = True

plot.streamtraces.add_rake(start_position=(1.5, 0.1, .4),
                           end_position=(1.5, .9, 0.1),
                           stream_type=Streamtrace.VolumeRibbon,
                           num_seed_points=3)
plot.streamtraces.add_rake(start_position=(1.5, 0.1, 0.1),
                           end_position=(1.5, .9, .4),
                           stream_type=Streamtrace.VolumeRod,
                           num_seed_points=4)

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

Attributes

contour Streamtraces rod/ribbon contour attributes.
effects Streamtraces rod/ribbon effects.
mesh Streamtraces rod/ribbon mesh attributes.
num_rod_points Number of rod points.
shade Streamtraces rod/ribbon color and lighting attributes.
width Rod/ribbon width in grid units.
StreamtraceRodRibbon.contour

Streamtraces rod/ribbon contour attributes.

Type:StreamtraceRodRibbonContour

Example usage:

>>> plot.streamtraces.rod_ribbon.contour.show = True
StreamtraceRodRibbon.effects

Streamtraces rod/ribbon effects.

Type:StreamtraceRodRibbonEffects

Example usage:

>>> plot.streamtraces.rod_ribbon.effects.use_translucency = True
StreamtraceRodRibbon.mesh

Streamtraces rod/ribbon mesh attributes.

Type:StreamtraceRodRibbonMesh

Example usage:

>>> plot.streamtraces.rod_ribbon.mesh.show = True
StreamtraceRodRibbon.num_rod_points

Number of rod points.

Type:integer, valid range 3-100

Volume rods have a polygonal cross-section; this parameter tells Tecplot 360 what that cross-section should be. (Three is an equilateral triangle, four is a square, five is a regular pentagon, and so on.) If you want two sets of volume rods with different cross-sections, you must create one set and then extract the set as a zone, then configure a new set of streamtraces with the second cross-section.

Example usage:

>>> plot.streamtraces.rod_ribbon.num_rod_points = 10
StreamtraceRodRibbon.shade

Streamtraces rod/ribbon color and lighting attributes.

Type:StreamtraceRodRibbonShade

Example usage:

>>> plot.streamtraces.rod_ribbon.shade.color = Color.Magenta
StreamtraceRodRibbon.width

Rod/ribbon width in grid units.

Type:float

Example usage:

>>> plot.streamtraces.rod_ribbon.width = 0.01

StreamtraceTiming

class tecplot.plot.StreamtraceTiming(streamtrace)[source]

Timed markers for streamlines.

Use StreamtraceTiming to control timed markers for streamlines, and timed dashes for all types of streamtraces. Stream markers are drawn at time locations along streamlines. The spacing between stream markers is proportional to the magnitude of the local vector field.

import tecplot
from tecplot.constant import *
import os

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

frame = tecplot.active_frame()
frame.plot_type = tecplot.constant.PlotType.Cartesian2D

plot = frame.plot()
plot.vector.u_variable = dataset.variable('U(M/S)')
plot.vector.v_variable = dataset.variable('V(M/S)')
plot.show_streamtraces = True
plot.show_shade = True
plot.fieldmap(0).shade.color = Color.LightBlue


streamtraces = plot.streamtraces
streamtraces.show_markers = True
timing = streamtraces.timing
timing.anchor = 0
timing.delta = 0.0001

streamtraces.marker_size = 1.5
streamtraces.marker_symbol().shape =GeomShape.RTri
streamtraces.marker_color = Color.Mahogany

streamtraces.add_rake(start_position=(-0.003, 0.005),
                      end_position=(-0.003, -0.005),
                      stream_type=Streamtrace.TwoDLine,
                      num_seed_points=10)


plot.axes.y_axis.min = -0.02
plot.axes.y_axis.max = 0.02
plot.axes.x_axis.min = -0.008
plot.axes.x_axis.max = 0.04

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

Attributes

anchor Time that a dash is guaranteed to start.
delta Time between stream markers.
end Time after which no stream markers are drawn.
start Time at which the first marker should be drawn.

Methods

reset_delta() Reset the time delta for dashed streamtraces.
StreamtraceTiming.anchor

Time that a dash is guaranteed to start.

Type:float

A dash is guaranteed to start at anchor, provided the start and end time surround the dash.

Example usage:

>>> plot.streamtraces.timing.anchor = 1.1
StreamtraceTiming.delta

Time between stream markers.

Type:float

delta is the time interval that measures the time between stream markers. The actual distance between markers is the product of this number and the local Vector magnitude.

Call StreamtraceTiming.reset_delta() to reset this to the default.

Example usage:

>>> plot.streamtraces.timing.delta = 0.1
StreamtraceTiming.end

Time after which no stream markers are drawn.

Type:float

Example usage:

>>> plot.streamtraces.timing.end = 3.0
StreamtraceTiming.reset_delta()[source]

Reset the time delta for dashed streamtraces.

The delta time is reset such that a stream dash in the vicinity of the maximum vector magnitude will have a length approximately equal to 10 percent of the frame width.

Raises:TecplotSystemError – Streamtraces time delta could not be reset.

Example usage:

>>> plot.streamtraces.timing.reset_delta()
StreamtraceTiming.start

Time at which the first marker should be drawn.

Type:float

A start time of zero means that the first marker is drawn at the starting point. A start time of 2.5 means that the first stream marker is drawn 2.5 time units downstream of the starting point.

Example usage:

>>> plot.streamtraces.timing.start = 2.5

StreamtraceRodRibbonContour

class tecplot.plot.StreamtraceRodRibbonContour(streamtrace)[source]

Contour flooding display for streamtrace rod/ribbons.

import os
import numpy as np
import tecplot
from tecplot.constant import *

examples_dir = tecplot.session.tecplot_examples_directory()
datafile = os.path.join(examples_dir, 'SimpleData', 'DownDraft.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.contour(0).variable = dataset.variable(3)
plot.contour(0).levels.reset_levels(np.linspace(1.15,1.25,11))
plot.show_mesh = False
plot.show_shade = False
plot.show_edge = True

plot.vector.u_variable_index = 4
plot.vector.v_variable_index = 5
plot.vector.w_variable_index = 6
plot.show_streamtraces = True

rod = plot.streamtraces.rod_ribbon
rod.width = .008
rod.contour.show = True
rod.contour.use_lighting_effect = True

plot.streamtraces.add_rake(
    start_position=(0, 0.22, 0),
    end_position=(0, 0.22, 0.1),
    stream_type=Streamtrace.VolumeRod)

plot.view.width = 0.644
plot.view.alpha = 66.4
plot.view.theta = -122.4
plot.view.psi   = 124.5
plot.view.position = (5.3, 3.56, -4.3)

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

Attributes

flood_contour_group Contour group to use for flooding.
flood_contour_group_index The Index of the ContourGroup to use for flooding.
show Enable or disable contour flooding display.
use_lighting_effect Enable lighting effect for streamtrace rod/ribbons.
StreamtraceRodRibbonContour.flood_contour_group

Contour group to use for flooding.

Type:ContourGroup

This property sets and gets the ContourGroup used 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.streamtraces.rod_ribbon.contour
>>> contour.flood_contour_group = group
StreamtraceRodRibbonContour.flood_contour_group_index

The Index of the ContourGroup to use for flooding.

Type:Index (zero-based index)

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.streamtraces.rod_ribbon.contour
>>> contour.flood_contour_group_index = 0  # First contour group
StreamtraceRodRibbonContour.show

Enable or disable contour flooding display.

Type:boolean

Example usage:

>>> plot.streamtraces.rod_ribbon.contour.show = True
StreamtraceRodRibbonContour.use_lighting_effect

Enable lighting effect for streamtrace rod/ribbons.

Note

Setting StreamtraceRodRibbonContour.use_lighting_effect will also set the same value for StreamtraceRodRibbonShade.use_lighting_effect, and vice-versa.

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

Type:boolean

Example usage:

>>> ribbon = plot.streamtraces.rod_ribbon
>>> contour = ribbon.contour
>>> contour.use_lighting_effect = True
>>> ribbon.effects.lighting_effect = LightingEffect.Paneled

StreamtraceRodRibbonEffects

class tecplot.plot.StreamtraceRodRibbonEffects(streamtrace)[source]

Controls how lighting and translucency interacts with streamtrace rods and ribbons.

import os
import tecplot
from tecplot.constant import *

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.show_mesh = False
plot.show_shade = False
plot.show_edge = True
plot.fieldmap(0).edge.edge_type = EdgeType.Creases

plot.show_mesh = False
plot.show_shade = False

plot.vector.u_variable_index = 3
plot.vector.v_variable_index = 4
plot.vector.w_variable_index = 5
plot.show_streamtraces = True
plot.streamtraces.rod_ribbon.width = .03
plot.streamtraces.rod_ribbon.shade.color = Color.Green

plot.streamtraces.rod_ribbon.effects.use_translucency = True
plot.streamtraces.rod_ribbon.effects.surface_translucency = 80

plot.streamtraces.add_rake(start_position=(1.5, 0, .45),
                               end_position=(1.5, 1, 0),
                               stream_type=Streamtrace.VolumeRibbon)

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

Attributes

lighting_effect Get/set the lighting algorithm used when lighting streamtrace rods and ribbons.
surface_translucency Surface translucency of the streamtraces ribbon.
use_translucency Enable surface translucency.
StreamtraceRodRibbonEffects.lighting_effect
Get/set the lighting algorithm used when lighting
streamtrace rods and ribbons.
Type:LightingEffect

Ribbon lighting effects must be enabled by setting StreamtraceRodRibbonShade.use_lighting_effect to True when setting this value.

Note that setting StreamtraceRodRibbonShade.use_lighting_effect will also set this value for ribbon contours.

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.streamtraces.rod_ribbon.shade.use_lighting_effect = True
>>> plot.streamtraces.rod_ribbon.effects.lighting_effect = LightingEffect.Paneled
StreamtraceRodRibbonEffects.surface_translucency

Surface translucency of the streamtraces ribbon.

Type:integer

Surface translucency must be enabled by setting StreamtraceRodRibbonEffects.use_translucency = True when setting this value.

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

Example usage:

>>> plot.streamtraces.rod_ribbon.effects.use_translucency = True
>>> plot.streamtraces.rod_ribbon.effects.surface_translucency = 20
StreamtraceRodRibbonEffects.use_translucency

Enable surface translucency.

Type:boolean

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

Example usage:

>>> plot.streamtraces.rod_ribbon.effects.use_translucency = True
>>> plot.streamtraces.rod_ribbon.effects.surface_translucency = 20

StreamtraceRodRibbonMesh

class tecplot.plot.StreamtraceRodRibbonMesh(streamtrace)[source]

Streamtraces rod/ribbon mesh attributes.

Note

To set the mesh color or line thickness, see Streamtraces.color and Streamtraces.line_thickness.

import os
import tecplot
from tecplot.constant import *

examples_dir = tecplot.session.tecplot_examples_directory()
datafile = os.path.join(examples_dir, 'SimpleData', 'DownDraft.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 = False
plot.show_shade = False
plot.show_edge = True

plot.vector.u_variable_index = 4
plot.vector.v_variable_index = 5
plot.vector.w_variable_index = 6
plot.show_streamtraces = True

ribbon = plot.streamtraces.rod_ribbon
ribbon.width = .008
ribbon.mesh.show = True
ribbon.mesh.line_thickness = 0.2
#Ribbon mesh color inherited from streamtrace color
plot.streamtraces.color = Color.AquaGreen

plot.streamtraces.add_rake(
    start_position=(0, 0.22, 0),
    end_position=(0, 0.22, 0.1),
    stream_type=Streamtrace.VolumeRibbon)

plot.view.width = 0.644
plot.view.alpha = 66.4
plot.view.theta = -122.4
plot.view.psi   = 124.5
plot.view.position = (5.3, 3.56, -4.3)

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

Attributes

line_thickness Get/Set streamtrace rod/ribbon mesh line thickness as a percentage of frame height.
show Display mesh.
StreamtraceRodRibbonMesh.line_thickness

Get/Set streamtrace rod/ribbon mesh line thickness as a percentage of frame height.

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

Type:float

Example usage:

>>> plot.streamtraces.rod_ribbon.mesh.line_thickness = 0.2
StreamtraceRodRibbonMesh.show

Display mesh.

Note

The mesh color for streamtraces is determined by the line color.

Type:boolean

Example usage:

>>> plot.streamtraces.rod_ribbon.mesh.show = True

StreamtraceRodRibbonShade

class tecplot.plot.StreamtraceRodRibbonShade(streamtrace)[source]

Color and lighting display for rod/ribbons.

import os
import tecplot
from tecplot.constant import *

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.show_mesh = False
plot.show_shade = False
plot.show_edge = True
plot.fieldmap(0).edge.edge_type = EdgeType.Creases

plot.vector.u_variable_index = 3
plot.vector.v_variable_index = 4
plot.vector.w_variable_index = 5

plot.show_streamtraces = True
plot.streamtraces.show_paths = True

ribbon = plot.streamtraces.rod_ribbon
ribbon.shade.show = True
ribbon.shade.color = Color.Blue
ribbon.shade.use_lighting_effect = True
ribbon.width = .03


plot.streamtraces.add_rake(start_position=(1.5, 0, .45),
                           end_position=(1.5, 1, 0),
                           stream_type=Streamtrace.VolumeRibbon)

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

Attributes

color Shade color.
show Show shade attributes.
use_lighting_effect Use lighting effect.
StreamtraceRodRibbonShade.color

Shade color.

Type:Color

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

Example usage:

>>> plot.streamtraces.rod_ribbon.shade.show = True
>>> plot.streamtraces.rod_ribbon.shade.color = Color.Blue
StreamtraceRodRibbonShade.show

Show shade attributes.

Type:boolean

Example usage:

>>> plot.streamtraces.rod_ribbon.shade.show = True
StreamtraceRodRibbonShade.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.

Type:Boolean

Example usage:

>>> plot.streamtraces.rod_ribbon.shade.use_lighting_effect = True
>>> plot.streamtraces.rod_ribbon.effects.lighting_effect = LightingEffect.Paneled

StreamtraceTerminationLine

class tecplot.plot.StreamtraceTerminationLine(streamtrace)[source]

Streamtraces termination line attributes.

A streamtrace termination line is a polyline that terminates any streamtraces that cross it. The termination line is useful for stopping streamtraces before they spiral or stall.

Note

Before setting any StreamtraceTerminationLine properties, you must add a termination line.

Streamtraces are terminated whenever any of the following occur:

  • The maximum number of integration steps is reached.
  • Any point where a streamtrace passes outside the available data.
  • The streamtrace reaches a point where the velocity magnitude is zero.
import tecplot
from tecplot.constant import *
import os

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

frame = tecplot.active_frame()
frame.plot_type = tecplot.constant.PlotType.Cartesian2D

plot = frame.plot()
plot.vector.u_variable = dataset.variable('U(M/S)')
plot.vector.v_variable = dataset.variable('V(M/S)')
plot.show_streamtraces = True
plot.show_shade = True
plot.fieldmap(0).shade.color = Color.LightBlue

streamtraces = plot.streamtraces
streamtraces.set_termination_line([(0.03, 0.005),
                                   (0.03, -0.005),])

term_line = streamtraces.termination_line
term_line.is_active = True
term_line.show = True
term_line.color = Color.Red
term_line.line_pattern = LinePattern.Dashed
term_line.pattern_length = .5
term_line.line_thickness = .5

streamtraces.add_rake(start_position=(-0.003, 0.005),
                      end_position=(-0.003, -0.005),
                      stream_type=Streamtrace.TwoDLine,
                      num_seed_points=10)

plot.axes.y_axis.min = -0.02
plot.axes.y_axis.max = 0.02
plot.axes.x_axis.min = -0.01
plot.axes.x_axis.max = 0.04

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

Attributes

color Color of the termination line.
is_active Activate/disable the streamtrace termination line.
line_pattern Pattern of the terminating line.
line_thickness Thickness of the termination line as a percentage of frame height.
pattern_length Length of the pattern as a percentage of frame height.
show Display the termination line.
StreamtraceTerminationLine.color

Color of the termination line.

Type:Color

Example usage:

>>> plot.streamtraces.termination_line.color = Color.Red
StreamtraceTerminationLine.is_active

Activate/disable the streamtrace termination line.

Type:boolean

Set to True to activate the termination line and terminate any streamtraces that cross it. Set to False and redraw the plot with unterminated streamtraces.

Note

To display the termination line itself, set show to True.

Example usage:

>>> plot.streamtraces.termination_line.is_active = True
StreamtraceTerminationLine.line_pattern

Pattern of the terminating line.

Type:LinePattern

Example usage:

>>> plot.streamtraces.termination_line.line_pattern = LinePattern.Dotted
StreamtraceTerminationLine.line_thickness

Thickness of the termination line as a percentage of frame height.

Type:float

Example usage:

>>> plot.streamtraces.termination_line.line_thickness = 0.1
StreamtraceTerminationLine.pattern_length

Length of the pattern as a percentage of frame height.

Type:float

Example usage:

>>> plot.streamtraces.termination_line.pattern_length = 2
StreamtraceTerminationLine.show

Display the termination line.

Type:boolean

Set to True to display the termination line. Set to False and redraw the plot to display terminated streamlines (if is_active is set to True), but not the termination line itself.

Note

To display terminated streamtraces, is_active must be set to True.

Example usage:

>>> plot.streamtraces.termination_line.show = True

Text

TextBox

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

Rectangular frame around a text element.

Warning

text.TextBox objects cannot be created directly. They are returned by various other read-only properties.

Attributes

box_type Type of box surrounding the text.
color Color of the box surrounding the text.
fill_color Fill color of the box surrounding the text.
line_thickness Line thickness of the box surrounding the text.
margin Margin of the box surrounding the text.
TextBox.box_type

Type of box surrounding the text.

Type:constant.TextBox

Example usage:

>>> plot = frame.plot()
>>> plot.legend.box.box_type = constant.TextBox.None_
TextBox.color

Color of the box surrounding the text.

Type:Color

Example usage:

>>> plot = frame.plot()
>>> plot.legend.box.color = Color.Blue
TextBox.fill_color

Fill color of the box surrounding the text.

Type:Color

Example usage:

>>> plot = frame.plot()
>>> plot.legend.box.fill_color = Color.Blue
TextBox.line_thickness

Line thickness of the box surrounding the text.

Type:float

Example usage:

>>> plot = frame.plot()
>>> plot.legend.box.line_thickness = 0.2
TextBox.margin

Margin of the box surrounding the text.

This property is the margin between the text inside the text box and the box as a percentage of frame height.

Type:float

Example usage:

>>> plot = frame.plot()
>>> plot.legend.box.margin = 0.3

Font

class tecplot.text.Font(parent, sv_textshape='TEXTSHAPE')[source]

Style of text objects such as titles and labels.

This class controls the typeface and size of various text objects found in plots and axes:

from os import path
import tecplot as tp
from tecplot.constant import PlotType, Units, AxisTitleMode

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

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

plot.show_contour = True

xaxis = plot.axes.x_axis
xaxis.title.title_mode = AxisTitleMode.UseText
xaxis.title.text = 'Longitudinal (m)'
xaxis.min, xaxis.max = 0, 1.2

yaxis = plot.axes.y_axis
yaxis.title.title_mode = AxisTitleMode.UseText
yaxis.title.text = 'Transverse (m)'
yaxis.min, yaxis.max = 0, 1.3

for ax in [xaxis, yaxis]:
    ax.title.font.typeface = 'Times'
    ax.title.font.bold = False
    ax.title.font.italic = True
    ax.title.font.size_units = Units.Frame
    ax.title.font.size = 7

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

Attributes

bold Use the bold version of the current typeface.
italic Use the italic version of the current typeface.
size Height of the font.
size_units Units used by the size attribute.
typeface Specific font (or typeface) to use for text.
Font.bold

Use the bold version of the current typeface.

Type:boolean

Example:

>>> axis.title.font.bold = True
Font.italic

Use the italic version of the current typeface.

Type:boolean

Example:

>>> axis.title.font.italic = True
Font.size

Height of the font.

Type:float in units of Font.size_units

Example usage:

>>> axis.title.font.size = 10
Font.size_units

Units used by the size attribute.

Type:Units

Possible values: Units.Point, Units.Frame (percentage of frame height). This example sets the axis title to 10% of the frame height:

>>> from tecplot.constant import Units
>>> axis.title.font.size_units = Units.Frame
>>> axis.title.font.size = 10
Font.typeface

Specific font (or typeface) to use for text.

Type:string

This can be any font installed on the current system. If the font is not found, Times or Helvetica will be used when rendering the text. Example usage:

>>> axis.title.font.typeface = 'Times'

LabelFormat

class tecplot.text.LabelFormat(labels)[source]

Formatting of numbers shown along in axes and in legends.

This example shows how to format tick label along an axis:

from datetime import datetime
import tecplot as tp
from tecplot.constant import PlotType, AxisMode, AxisAlignment, NumberFormat

tp.new_layout()
plot = tp.active_frame().plot(tp.constant.PlotType.Sketch)
plot.activate()

# setup the plot area margins
plot.axes.viewport.left = 10
plot.axes.viewport.right = 90

# show the x-axis, set the title, and alignment with the viewport
xaxis = plot.axes.x_axis
xaxis.show = True
xaxis.title.text = 'Negative numbers in parentheses'
xaxis.title.offset = 20
xaxis.line.alignment = AxisAlignment.WithViewport
xaxis.line.position = 50

# set limits, tick placement and tick label properties
xaxis.ticks.auto_spacing = False
xaxis.min, xaxis.max = -5.123e-5, 5.234e-5
xaxis.ticks.spacing = (xaxis.max - xaxis.min) / 6
xaxis.ticks.spacing_anchor = 0
xaxis.tick_labels.angle = 45
xaxis.tick_labels.offset = 3

# format the tick labels in superscript form. example: 1.234x10^5
# format negative numbers to use parentheses instead of a negative sign
xformat = xaxis.tick_labels.format
xformat.format_type = NumberFormat.SuperScript
xformat.precision = 3
xformat.show_negative_sign = False
xformat.negative_prefix = '('
xformat.negative_suffix = ')'

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

Attributes

custom_labels_index Index of the custom label to use.
datetime_format The date/time format to be used.
format_type Type of number formatting to use.
negative_prefix Prefix string to use for negative valued tick labels.
negative_suffix Suffix string to use for negative valued tick labels.
num_custom_labels Number of custom label sets available to use.
positive_prefix Prefix string to use for positive valued tick labels.
positive_suffix Suffix string to use for positive valued tick labels.
precision Number digits after decimal for fixed floating point format.
remove_leading_zeros Strip leading zeros in the formatted number.
show_decimals_on_whole_numbers Include trailing decimal character with whole numbers.
show_negative_sign Include negative sign for negative values.
zero_prefix Prefix string to use for zero valued tick labels.
zero_suffix Suffix string to use for zero valued tick labels.

Methods

add_custom_labels(*labels) Append a list of custom labels as a new set.
custom_labels(index) List of labels for custom labels for set specified by index.
LabelFormat.add_custom_labels(*labels)[source]

Append a list of custom labels as a new set.

Example usage:

>>> labels = ['apples', 'bananas', 'carrots']
>>> axis.tick_labels.format.add_custom_labels(*labels)
>>> print(axis.tick_labels.format.custom_labels(-1))
['apples', 'bananas', 'carrots']
LabelFormat.custom_labels(index)[source]

List of labels for custom labels for set specified by index.

Example usage:

>>> axis.tick_labels.format.custom_labels(0)
['apples', 'bananas', 'carrots']
LabelFormat.custom_labels_index

Index of the custom label to use.

Type:Index (zero-based)

Example usage:

>>> axis.tick_labels.format.custom_labels_index = 0
LabelFormat.datetime_format

The date/time format to be used.

Type:string

Example usage:

>>> from tecplot.constant import NumberFormat
>>> axis.tick_labels.format.format_type = NumberFormat.TimeDate
>>> axis.tick_labels.format.datetime_format = 'mmm d, yyyy'

The format can be any combination of the following codes. Placing a backslash in front of a y, m, d, or s in the Time/Date formula will keep it from being processed as part of the formula. All characters not part of the Time/Date formula will appear as entered. For example, “\year yyyy” will appear as “year 2008”, as the backslash keeps the first y from being processed as part of the formula. If you use “m” immediately after the “h” or “hh” code or immediately before the “ss” code, the minutes instead of the month will be displayed.

Years:
yy 00-99
yyyy 1800-9999
Months:
m 1-12
mm 01-12
mmm Jan-Dec
mmmm January-December
mmmmm first letter of the month
Days:
[d] elapsed days
d 1-31
dd 01-31
ddd Sun-Sat
dddd Sunday-Saturday
ddddd S,M,T,W,T,F,S
Hours:
[h] elapsed hours
h 0-23 or 1-12
hh 00-23 or 1-12
AM/PM AM or PM
A/P AM or PM as “A” or “P”
Minutes:
[m] elapsed minutes
m 0-59
mm 00-59
Seconds:  
s 0-59
ss 00-59
.0 Tenths
.00 Hundredths
.000 Thousandths

To display the time and date on your plot as a “Sat-Jan-05-2008”, enter the following code:

"ddd-mmm-dd-yyyy"

To display the time and date on your plot as a “1-3-08”, enter the following code:

"m-d-yy"

To display the time and date on your plot as a “9:30:05 AM”, enter the following code:

"h:mm:ss AM"

To display an elapsed time, such as “3:10:15”, enter the following code:

"[d]:hh:mm"
LabelFormat.format_type

Type of number formatting to use.

Type:NumberFormat

Possible values: Integer, FixedFloat, Exponential, BestFloat, SuperScript, CustomLabel, LogSuperScript, RangeBestFloat, DynamicLabel, TimeDate.

Example usage:

>>> from tecplot.constant import NumberFormat
>>> axis.tick_labels.format.format_type = NumberFormat.BestFloat
LabelFormat.negative_prefix

Prefix string to use for negative valued tick labels.

Type:string

This example shows how to use parentheses instead of a negative sign:

>>> axis.tick_labels.format.show_negative_sign = False
>>> axis.tick_labels.format.negative_prefix = '('
>>> axis.tick_labels.format.negative_suffix = ')'
LabelFormat.negative_suffix

Suffix string to use for negative valued tick labels.

Type:string

This example shows how to use parentheses instead of a negative sign:

>>> axis.tick_labels.format.show_negative_sign = False
>>> axis.tick_labels.format.negative_prefix = '('
>>> axis.tick_labels.format.negative_suffix = ')'
LabelFormat.num_custom_labels

Number of custom label sets available to use.

Type:int

Example usage:

>>> print(axis.tick_labels.format.num_custom_labels)
1
LabelFormat.positive_prefix

Prefix string to use for positive valued tick labels.

Type:string

Example usage:

>>> axis.tick_labels.format.positive_prefix = 'increase: '
LabelFormat.positive_suffix

Suffix string to use for positive valued tick labels.

Type:string

Example usage:

>>> axis.tick_labels.format.positive_suffix = ' (m)'
LabelFormat.precision

Number digits after decimal for fixed floating point format.

Type:integer

Example usage:

>>> from tecplot.constant import NumberFormat
>>> axis.tick_labels.format.format_type = NumberFormat.FixedFloat
>>> axis.tick_labels.format.precision = 3
LabelFormat.remove_leading_zeros

Strip leading zeros in the formatted number.

Type:boolean

Example usage:

>>> axis.tick_labels.format.remove_leading_zeros = True
LabelFormat.show_decimals_on_whole_numbers

Include trailing decimal character with whole numbers.

Type:boolean

Example usage:

>>> axis.tick_labels.format.show_decimals_on_whole_numbers = True
LabelFormat.show_negative_sign

Include negative sign for negative values.

Type:boolean

Example usage:

>>> axis.tick_labels.format.show_negative_sign = True
LabelFormat.zero_prefix

Prefix string to use for zero valued tick labels.

Type:string

Example usage:

>>> axis.tick_labels.format.zero_prefix = 'origin: '
LabelFormat.zero_suffix

Suffix string to use for zero valued tick labels.

Type:string

Example usage:

>>> axis.tick_labels.format.zero_suffix = ' (origin)'

Viewport

ReadOnlyViewport

class tecplot.plot.ReadOnlyViewport(axes)[source]

Attributes

bottom (float) Bottom position of viewport relative to the Frame.
left (float) Left position of viewport relative to the Frame.
right (float) Right position of viewport relative to the Frame.
top (float) Top position of viewport relative to the Frame.
ReadOnlyViewport.bottom

(float) Bottom position of viewport relative to the Frame.

Type:float in percentage of frame height from the bottom of the frame.

Example usage:

>>> print(plot.axes.viewport.bottom)
10.0
ReadOnlyViewport.left

(float) Left position of viewport relative to the Frame.

Type:float in percentage of frame width from the left of the frame.

Example usage:

>>> print(plot.axes.viewport.left)
10.0
ReadOnlyViewport.right

(float) Right position of viewport relative to the Frame.

Type:float in percentage of frame width from the left of the frame.

Example usage:

>>> print(plot.axes.viewport.right)
90.0
ReadOnlyViewport.top

(float) Top position of viewport relative to the Frame.

Type:float in percentage of frame height from the bottom of the frame.

Example usage:

>>> print(plot.axes.viewport.top)
90.0

Viewport

class tecplot.plot.Viewport(axes)[source]

Attributes

bottom (float) Bottom position of viewport relative to the Frame.
left (float) Left position of viewport relative to the Frame.
right (float) Right position of viewport relative to the Frame.
top (float) Top position of viewport relative to the Frame.
Viewport.bottom

(float) Bottom position of viewport relative to the Frame.

Type:float in percentage of frame height from the bottom of the frame.

Example usage:

>>> print(plot.axes.viewport.bottom)
10.0
Viewport.left

(float) Left position of viewport relative to the Frame.

Type:float in percentage of frame width from the left of the frame.

Example usage:

>>> print(plot.axes.viewport.left)
10.0
Viewport.right

(float) Right position of viewport relative to the Frame.

Type:float in percentage of frame width from the left of the frame.

Example usage:

>>> print(plot.axes.viewport.right)
90.0
Viewport.top

(float) Top position of viewport relative to the Frame.

Type:float in percentage of frame height from the bottom of the frame.

Example usage:

>>> print(plot.axes.viewport.top)
90.0

Cartesian2DViewport

class tecplot.plot.Cartesian2DViewport(axes)[source]

Attributes

bottom (float) Bottom position of viewport relative to the Frame.
left (float) Left position of viewport relative to the Frame.
nice_fit_buffer Tolerance for viewport/frame fit niceness.
right (float) Right position of viewport relative to the Frame.
top (float) Top position of viewport relative to the Frame.
top_snap_target Target value for top when being adjusted or dragged.
top_snap_tolerance Tolerance for snapping to target value for top.
Cartesian2DViewport.bottom

(float) Bottom position of viewport relative to the Frame.

Type:float in percentage of frame height from the bottom of the frame.

Example usage:

>>> print(plot.axes.viewport.bottom)
10.0
Cartesian2DViewport.left

(float) Left position of viewport relative to the Frame.

Type:float in percentage of frame width from the left of the frame.

Example usage:

>>> print(plot.axes.viewport.left)
10.0
Cartesian2DViewport.nice_fit_buffer

Tolerance for viewport/frame fit niceness.

Type:float

Example usage:

>>> plot.axes.viewport.nice_fit_buffer = 20
Cartesian2DViewport.right

(float) Right position of viewport relative to the Frame.

Type:float in percentage of frame width from the left of the frame.

Example usage:

>>> print(plot.axes.viewport.right)
90.0
Cartesian2DViewport.top

(float) Top position of viewport relative to the Frame.

Type:float in percentage of frame height from the bottom of the frame.

Example usage:

>>> print(plot.axes.viewport.top)
90.0
Cartesian2DViewport.top_snap_target

Target value for top when being adjusted or dragged.

Type:float

Example usage:

>>> plot.axes.viewport.top_snap_target = 90
Cartesian2DViewport.top_snap_tolerance

Tolerance for snapping to target value for top.

Type:float

Example usage:

>>> plot.axes.viewport.top_snap_tolerance = 8

PolarViewport

class tecplot.plot.PolarViewport(axes)[source]

Attributes

border_color
border_thickness
bottom (float) Bottom position of viewport relative to the Frame.
fill_color
left (float) Left position of viewport relative to the Frame.
right (float) Right position of viewport relative to the Frame.
show_border
top (float) Top position of viewport relative to the Frame.
PolarViewport.border_color
PolarViewport.border_thickness
PolarViewport.bottom

(float) Bottom position of viewport relative to the Frame.

Type:float in percentage of frame height from the bottom of the frame.

Example usage:

>>> print(plot.axes.viewport.bottom)
10.0
PolarViewport.fill_color
PolarViewport.left

(float) Left position of viewport relative to the Frame.

Type:float in percentage of frame width from the left of the frame.

Example usage:

>>> print(plot.axes.viewport.left)
10.0
PolarViewport.right

(float) Right position of viewport relative to the Frame.

Type:float in percentage of frame width from the left of the frame.

Example usage:

>>> print(plot.axes.viewport.right)
90.0
PolarViewport.show_border
PolarViewport.top

(float) Top position of viewport relative to the Frame.

Type:float in percentage of frame height from the bottom of the frame.

Example usage:

>>> print(plot.axes.viewport.top)
90.0

View

Cartesian2DView

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

Adjust the way cartesian 2D data is displayed.

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

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()
plot = frame.plot(PlotType.Cartesian2D)
plot.activate()
plot.show_contour = True
plot.contour(0).variable = dataset.variable('P(N)')
plot.contour(0).colormap_name = 'Sequential - Yellow/Green/Blue'

plot.view.fit_to_nice()

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

Attributes

magnification Magnification for the data being plotted.

Methods

adjust_to_nice() Shifts axes to make axis-line values “nice”
center([consider_blanking]) Center the data within the axis grid area.
fit([consider_blanking]) Fit the data being plotted within the axis grid area.
fit_data([consider_blanking]) Fit data zones or line mappings within the grid area.
fit_to_nice([consider_blanking]) Set axis range to begin/end on major axis increments.
translate([x, y]) Shift the data being plotted in the X and/or Y direction.
zoom(xmin, xmax, ymin, ymax) Zoom the view to a rectangular region of the plot.
Cartesian2DView.adjust_to_nice()

Shifts axes to make axis-line values “nice”

Modifies the axis range to fit the minimum and maximum of the variable assigned to that axis, then snaps the major tick marks to the ends of the axis. If axis dependency is not independent, this may affect the range on another axis.

In other words, given an existing range of values RMin, RMax and an initial delta, D (such as axis ranges with grid spacing or contour levels), determine a new delta (ND) that:

  • Is 1,2, or 5 times 10 to some power that is the “best” alternative to D.
  • Produces new range min and max values that are some multiple of ND that are nearest the original RMin and RMax

Axes are shifted without changing the extents of the window.

Raises:TecplotSystemError – Internal error.
Cartesian2DView.center(consider_blanking=True)

Center the data within the axis grid area.

Parameters:consider_blanking (Boolean, optional) – If True and blanking is enabled, the resulting view excludes blanked cells at the edges of the plot. If ‘False`, then the resulting view will ignore blanked cells at the edges of the plot. (default: True)
Raises:TecplotSystemError – View could not be centered.
Cartesian2DView.fit(consider_blanking=True)

Fit the data being plotted within the axis grid area.

Note

This also takes into consideration text and geometries that are plotted using the grid coordinate system.

Parameters:consider_blanking (Boolean, optional) – If True and blanking is enabled, the resulting view excludes blanked cells at the edges of the plot. If ‘False`, then the resulting view will ignore blanked cells at the edges of the plot. (default: True)
Raises:TecplotSystemError – Internal error.
Cartesian2DView.fit_data(consider_blanking=True)

Fit data zones or line mappings within the grid area.

Parameters:consider_blanking (Boolean, optional) – If True and blanking is enabled, the resulting view excludes blanked cells at the edges of the plot. If ‘False`, then the resulting view will ignore blanked cells at the edges of the plot. (default: True)

Note

This does not take into consideration text and geometries that are plotted using the grid coordinate system.

Raises:TecplotSystemError – Internal error.
Cartesian2DView.fit_to_nice(consider_blanking=True)

Set axis range to begin/end on major axis increments.

Changes the view to make the extents of the frame neatly hold the plot with integer values for axis labels.

Parameters:consider_blanking (Boolean, optional) – If True and blanking is enabled, the resulting view excludes blanked cells at the edges of the plot. If ‘False`, then the resulting view will ignore blanked cells at the edges of the plot. (default: True)
Raises:TecplotSystemError – Internal error.
Cartesian2DView.magnification

Magnification for the data being plotted.

Type:float

The magnification value is a decimal percent and must be greater than 0. A magnification size of 1.0 (100%) will size the plot so that it can fit within the grid area.

Raises:TecplotSystemError – Magnification could not be queried or set. Possible cases where TecplotSystemError is raised include XY plots where no mappings are active or floating point out of range error

Scale the view to ten percent of the size at which the data would fit the full frame:

>>> view.magnification = 0.10
>>> view.magnification
0.10
Cartesian2DView.translate(x=0.0, y=0.0)

Shift the data being plotted in the X and/or Y direction.

Note

The amount translated is in frame units.

Parameters:
  • x (float, optional) – Amount to shift in the X direction as a percentage of the frame width. Positive values shift right, negative values shift left. (default: 0.0)
  • y (float, optional) – Amount to shift in the Y direction as a percentage of the frame height. Positive values shift up, negative values shift down. (default: 0.0)
Raises:

TecplotSystemError – View could not be translated.

Translate the view 10 percent of the frame width to the right:

>>> view.translate(x=10)

Translate the view 5 percent of the frame width to the right, 20 of the frame height down:

>>> view.translate(x=5, y=-20)
Cartesian2DView.zoom(xmin, xmax, ymin, ymax)

Zoom the view to a rectangular region of the plot.

Change the view by “zooming” into the data. Ranges on the axes are adjusted to view the region defined by the rectangle with corners at (xmin, ymin) and (xmax, ymax).

Note

All position values are defined in units of the X- and Y- axis (that is, grid coordinates).

Parameters:
  • xmin – (float) X min corner of the rectangle to be viewed.
  • xmax – (float) X max corner of the rectangle to be viewed.
  • ymin – (float) Y min corner of the rectangle to be viewed.
  • ymax – (float) Y max corner of the rectangle to be viewed.
Raises:

TecplotSystemError – The view could not be zoomed.

Zoom so the rectangular region with corners at (xmin, ymin)=(1,0) and (xmax, ymax)=(7,9) is in view:

>>> view.zoom(1, 7, 0, 9)

Cartesian3DView

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

Adjust the way cartesian 3D data is displayed.

import tecplot
import os
from tecplot.constant import *
examples_dir = tecplot.session.tecplot_examples_directory()
infile = os.path.join(examples_dir, 'SimpleData', 'F18.plt')
ds = tecplot.data.load_tecplot(infile)
plot = tecplot.active_frame().plot(PlotType.Cartesian3D)
plot.activate()
plot.view.width = 17.5
plot.view.alpha = 0
plot.view.theta = 125
plot.view.psi   = 65
plot.view.position = (-100, 80, 65)

tecplot.export.save_jpeg('view_3D.jpeg', 600, supersample=3)
../_images/view_3D.jpeg

Attributes

alpha Eye origin view Alpha angle in degrees.
distance Get or set the view distance.
field_of_view Amount of the plot which is displayed.
magnification Magnification for the data being plotted.
position 3D viewer position.
projection Projection type (Perspective or Orthographic).
psi Eye origin view Psi angle in degrees.
theta Eye origin view Theta angle in degrees.
width 3D view width.

Methods

center([consider_blanking]) Center the data within the axis grid area.
fit([consider_blanking]) Fit the data being plotted within the axis grid area.
fit_data([consider_blanking]) Fit data zones or line mappings within the grid area.
fit_surfaces([consider_blanking]) Fit 3D plot surfaces to the grid area.
fit_to_nice([consider_blanking]) Set axis range to begin/end on major axis increments.
rotate_to_angles(psi, theta, alpha) Rotate the plot to specific angles.
translate([x, y]) Shift the data being plotted in the X and/or Y direction.
zoom(xmin, xmax, ymin, ymax) Zoom the view to a rectangular region of the plot.
Cartesian3DView.alpha

Eye origin view Alpha angle in degrees.

The Alpha angle is the twist about the eye origin ray.

Type:float

Example usage:

>>> plot.view.alpha = 95.0
Cartesian3DView.center(consider_blanking=True)

Center the data within the axis grid area.

Parameters:consider_blanking (Boolean, optional) – If True and blanking is enabled, the resulting view excludes blanked cells at the edges of the plot. If ‘False`, then the resulting view will ignore blanked cells at the edges of the plot. (default: True)
Raises:TecplotSystemError – View could not be centered.
Cartesian3DView.distance

Get or set the view distance.

Type:float

The view distance is the distance from the viewer to the plane that is parallel to the screen and passes through the 3-D rotation origin.

Note

Changing this value will also change the viewer position.

See also

position

Example usage:

>>> plot.view.distance
13.5
>>> plot.view.distance = 10.0
>>> plot.view.distance
10.0
Cartesian3DView.field_of_view

Amount of the plot which is displayed.

Type:float

Get or set the amount of the plot (in terms of spherical arc) in front of the viewer that may be seen.

Warning

field_of_view cannot be set if projection is Projection.Orthographic.

Example usage:

>>> from tecplot.constant import Projection
>>> plot.view.projection = Projection.Perspective
>>> plot.view.field_of_view = 9.6
Cartesian3DView.fit(consider_blanking=True)[source]

Fit the data being plotted within the axis grid area.

Note

This also takes into consideration text and geometries that are plotted using the grid coordinate system. Axes are also included.

Parameters:consider_blanking (Boolean, optional) – If True and blanking is enabled, the resulting view excludes blanked cells at the edges of the plot. If ‘False`, then the resulting view will ignore blanked cells at the edges of the plot. (default: True)
Raises:TecplotSystemError – Internal error.
Cartesian3DView.fit_data(consider_blanking=True)

Fit data zones or line mappings within the grid area.

Parameters:consider_blanking (Boolean, optional) – If True and blanking is enabled, the resulting view excludes blanked cells at the edges of the plot. If ‘False`, then the resulting view will ignore blanked cells at the edges of the plot. (default: True)

Note

This does not take into consideration text and geometries that are plotted using the grid coordinate system.

Raises:TecplotSystemError – Internal error.
Cartesian3DView.fit_surfaces(consider_blanking=True)[source]

Fit 3D plot surfaces to the grid area.

Parameters:consider_blanking (Boolean, optional) – If True and blanking is enabled, the resulting view excludes blanked cells at the edges of the plot. If ‘False`, then the resulting view will ignore blanked cells at the edges of the plot. (default: True)

Note

3D volume zones are excluded when surfaces_to_plot is SurfacesToPlot.None_.

Raises:TecplotSystemError – Internal error.
Cartesian3DView.fit_to_nice(consider_blanking=True)

Set axis range to begin/end on major axis increments.

Changes the view to make the extents of the frame neatly hold the plot with integer values for axis labels.

Parameters:consider_blanking (Boolean, optional) – If True and blanking is enabled, the resulting view excludes blanked cells at the edges of the plot. If ‘False`, then the resulting view will ignore blanked cells at the edges of the plot. (default: True)
Raises:TecplotSystemError – Internal error.
Cartesian3DView.magnification

Magnification for the data being plotted.

Type:float

The magnification value is a decimal percent and must be greater than 0. A magnification size of 1.0 (100%) will size the plot so that it can fit within the grid area.

Raises:TecplotSystemError – Magnification could not be queried or set. Possible cases where TecplotSystemError is raised include XY plots where no mappings are active or floating point out of range error

Scale the view to ten percent of the size at which the data would fit the full frame:

>>> view.magnification = 0.10
>>> view.magnification
0.10
Cartesian3DView.position

3D viewer position.

The viewer position is the viewer’s relation to the image.

Type:3-tuple of floats

Example usage:

>>> plot.view.position
(1.25, 3.2, 0.74)
>>> plot.view.position.x
1.25
>>> plot.view.position = (2.5, 0.0, 1.0)
>>> plot.view.position.y
0.0
>>> plot.view.position.z
1.0

See also

distance

Cartesian3DView.projection

Projection type (Perspective or Orthographic).

Type:Projection

When set to Perspective, Tecplot 360 draws the plot in perspective. When set to Orthographic, the plot is drawn with orthographic projection where the shape of the object does not change with distance.

Note

Requires Tecplot version 2017.2 or later.

Example usage:

>>> from tecplot.constant import Projection
>>> plot.view.projection = Projection.Orthographic
Cartesian3DView.psi

Eye origin view Psi angle in degrees.

The Psi angle is the tilt of the eye origin ray away from the Z-axis.

Type:float

Example usage:

>>> plot.view.psi = 90.0
Cartesian3DView.rotate_to_angles(psi, theta, alpha)[source]

Rotate the plot to specific angles.

Parameters:
  • psi – (float): Tilt, in degrees, of the eye origin ray away from the Z-axis.
  • theta – (float): Rotation, in degrees, of the eye origin ray about the Z-axis.
  • alpha – (float): Twist, in degrees, about the eye origin ray.
Cartesian3DView.theta

Eye origin view Theta angle in degrees.

The Theta angle is the rotation of the eye origin ray about the Z-axis.

Type:float

Example usage:

>>> plot.view.theta = 24.3
Cartesian3DView.translate(x=0.0, y=0.0)

Shift the data being plotted in the X and/or Y direction.

Note

The amount translated is in frame units.

Parameters:
  • x (float, optional) – Amount to shift in the X direction as a percentage of the frame width. Positive values shift right, negative values shift left. (default: 0.0)
  • y (float, optional) – Amount to shift in the Y direction as a percentage of the frame height. Positive values shift up, negative values shift down. (default: 0.0)
Raises:

TecplotSystemError – View could not be translated.

Translate the view 10 percent of the frame width to the right:

>>> view.translate(x=10)

Translate the view 5 percent of the frame width to the right, 20 of the frame height down:

>>> view.translate(x=5, y=-20)
Cartesian3DView.width

3D view width.

Type:float

The 3D view width is the amount of the plot (in X-axis units) in front of the viewer that may be seen.

Warning

width cannot be set if projection is Perspective.

Example usage:

>>> plot.view.width = 1.5
Cartesian3DView.zoom(xmin, xmax, ymin, ymax)[source]

Zoom the view to a rectangular region of the plot.

Change the view by “zooming” into the data. Ranges on the axes are adjusted to view the region defined by the rectangle with corners at (xmin, ymin) and (xmax, ymax).

Note

All position values are defined in units of the X- and Y- axis (that is, grid coordinates).

Parameters:
  • xmin – (float) X min corner of the rectangle to be viewed.
  • xmax – (float) X max corner of the rectangle to be viewed.
  • ymin – (float) Y min corner of the rectangle to be viewed.
  • ymax – (float) Y max corner of the rectangle to be viewed.
Raises:

TecplotSystemError – The view could not be zoomed.

Zoom so the rectangular region with corners at (xmin, ymin)=(1,0) and (xmax, ymax)=(7,9) is in view:

>>> view.zoom(1, 7, 0, 9)

LineView

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

Adjust the way XY Line data is displayed.

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)'
plot.view.fit_to_nice()

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

Attributes

magnification Magnification for the data being plotted.

Methods

adjust_to_nice() Shifts axes to make axis-line values “nice”
center() Center the data within the axis grid area.
fit() Fit the data being plotted within the axis grid area.
fit_data() Fit data zones or line mappings within the grid area.
fit_to_nice() Set axis range to begin/end on major axis increments.
translate([x, y]) Shift the data being plotted in the X and/or Y direction.
zoom(xmin, xmax, ymin, ymax) Zoom the view to a rectangular region of the plot.
LineView.adjust_to_nice()

Shifts axes to make axis-line values “nice”

Modifies the axis range to fit the minimum and maximum of the variable assigned to that axis, then snaps the major tick marks to the ends of the axis. If axis dependency is not independent, this may affect the range on another axis.

In other words, given an existing range of values RMin, RMax and an initial delta, D (such as axis ranges with grid spacing or contour levels), determine a new delta (ND) that:

  • Is 1,2, or 5 times 10 to some power that is the “best” alternative to D.
  • Produces new range min and max values that are some multiple of ND that are nearest the original RMin and RMax

Axes are shifted without changing the extents of the window.

Raises:TecplotSystemError – Internal error.
LineView.center()

Center the data within the axis grid area.

Raises:TecplotSystemError – View could not be centered.
LineView.fit()

Fit the data being plotted within the axis grid area.

Note

This also takes into consideration text and geometries that are plotted using the grid coordinate system.

Raises:TecplotSystemError – Internal error.
LineView.fit_data()

Fit data zones or line mappings within the grid area.

Note

This does not take into consideration text and geometries that are plotted using the grid coordinate system.

Raises:TecplotSystemError – Internal error.
LineView.fit_to_nice()

Set axis range to begin/end on major axis increments.

Changes the view to make the extents of the frame neatly hold the plot with integer values for axis labels.

Raises:TecplotSystemError – Internal error.
LineView.magnification

Magnification for the data being plotted.

Type:float

The magnification value is a decimal percent and must be greater than 0. A magnification size of 1.0 (100%) will size the plot so that it can fit within the grid area.

Raises:TecplotSystemError – Magnification could not be queried or set. Possible cases where TecplotSystemError is raised include XY plots where no mappings are active or floating point out of range error

Scale the view to ten percent of the size at which the data would fit the full frame:

>>> view.magnification = 0.10
>>> view.magnification
0.10
LineView.translate(x=0.0, y=0.0)

Shift the data being plotted in the X and/or Y direction.

Note

The amount translated is in frame units.

Parameters:
  • x (float, optional) – Amount to shift in the X direction as a percentage of the frame width. Positive values shift right, negative values shift left. (default: 0.0)
  • y (float, optional) – Amount to shift in the Y direction as a percentage of the frame height. Positive values shift up, negative values shift down. (default: 0.0)
Raises:

TecplotSystemError – View could not be translated.

Translate the view 10 percent of the frame width to the right:

>>> view.translate(x=10)

Translate the view 5 percent of the frame width to the right, 20 of the frame height down:

>>> view.translate(x=5, y=-20)
LineView.zoom(xmin, xmax, ymin, ymax)

Zoom the view to a rectangular region of the plot.

Change the view by “zooming” into the data. Ranges on the axes are adjusted to view the region defined by the rectangle with corners at (xmin, ymin) and (xmax, ymax).

Note

All position values are defined in units of the X- and Y- axis (that is, grid coordinates).

Parameters:
  • xmin – (float) X min corner of the rectangle to be viewed.
  • xmax – (float) X max corner of the rectangle to be viewed.
  • ymin – (float) Y min corner of the rectangle to be viewed.
  • ymax – (float) Y max corner of the rectangle to be viewed.
Raises:

TecplotSystemError – The view could not be zoomed.

Zoom so the rectangular region with corners at (xmin, ymin)=(1,0) and (xmax, ymax)=(7,9) is in view:

>>> view.zoom(1, 7, 0, 9)

PolarView

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

Adjust the way polar data is displayed.

import numpy as np
import tecplot as tp
from tecplot.constant import PlotType, ThetaMode

frame = tp.active_frame()

npoints = 300
r = np.linspace(0, 2000, npoints)
theta = np.linspace(0, 10, npoints)

dataset = frame.create_dataset('Data', ['R', 'Theta'])
zone = dataset.add_ordered_zone('Zone', (300,))
zone.values('R')[:] = r
zone.values('Theta')[:] = theta

plot = frame.plot(PlotType.PolarLine)
plot.activate()

plot.axes.r_axis.max = np.max(r)
plot.axes.theta_axis.mode = ThetaMode.Radians

plot.delete_linemaps()
lmap = plot.add_linemap('Linemap', zone, dataset.variable('R'),
                        dataset.variable('Theta'))
lmap.line.line_thickness = 0.8

plot.view.reset_to_entire_circle()
plot.view.fit()

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

Attributes

extents View extents in grid units of transformed X & Y.
magnification Magnification for the data being plotted.

Methods

center() Center the data within the axis grid area.
fit() Fit the data being plotted within the axis grid area.
fit_data() Fit data zones or line mappings within the grid area.
fit_to_nice() Set axis range to begin/end on major axis increments.
reset_to_entire_circle() Set the range of Theta to encompass an entire circle.
translate([x, y]) Shift the data being plotted in the X and/or Y direction.
PolarView.center()

Center the data within the axis grid area.

Raises:TecplotSystemError – View could not be centered.
PolarView.extents

View extents in grid units of transformed X & Y.

Type:4-tuple of float (x1, y1, x2, y2)
  • x1, y1: Upper left corner of the extents.
  • x2, y2: Lower right corner of the extents.

Set the view of the polar plot to view the full extents of the plot area:

>>> plot.view.extents = (10, 10, 90, 90)
>>> plot.view.extents.x1
10.0
>>> plot.view.extents.y1
10.0
>>> plot.view.extents.x2
90.0
>>> plot.view.extents.y2
90.0
PolarView.fit()

Fit the data being plotted within the axis grid area.

Note

This also takes into consideration text and geometries that are plotted using the grid coordinate system.

Raises:TecplotSystemError – Internal error.
PolarView.fit_data()

Fit data zones or line mappings within the grid area.

Note

This does not take into consideration text and geometries that are plotted using the grid coordinate system.

Raises:TecplotSystemError – Internal error.
PolarView.fit_to_nice()

Set axis range to begin/end on major axis increments.

Changes the view to make the extents of the frame neatly hold the plot with integer values for axis labels.

Raises:TecplotSystemError – Internal error.
PolarView.magnification

Magnification for the data being plotted.

Type:float

The magnification value is a decimal percent and must be greater than 0. A magnification size of 1.0 (100%) will size the plot so that it can fit within the grid area.

Raises:TecplotSystemError – Magnification could not be queried or set. Possible cases where TecplotSystemError is raised include XY plots where no mappings are active or floating point out of range error

Scale the view to ten percent of the size at which the data would fit the full frame:

>>> view.magnification = 0.10
>>> view.magnification
0.10
PolarView.reset_to_entire_circle()[source]

Set the range of Theta to encompass an entire circle.

>>> plot.view.reset_to_entire_circle()
Raises:TecplotSystemError – Internal error.
PolarView.translate(x=0.0, y=0.0)

Shift the data being plotted in the X and/or Y direction.

Note

The amount translated is in frame units.

Parameters:
  • x (float, optional) – Amount to shift in the X direction as a percentage of the frame width. Positive values shift right, negative values shift left. (default: 0.0)
  • y (float, optional) – Amount to shift in the Y direction as a percentage of the frame height. Positive values shift up, negative values shift down. (default: 0.0)
Raises:

TecplotSystemError – View could not be translated.

Translate the view 10 percent of the frame width to the right:

>>> view.translate(x=10)

Translate the view 5 percent of the frame width to the right, 20 of the frame height down:

>>> view.translate(x=5, y=-20)