Plotting Style Manipulation

For axes and axis style and manipulations, see Axes Settings.

Scatter Plots

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

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

Field Plots

Cartesian2DFieldPlot

class tecplot.plot.Cartesian2DFieldPlot(frame)[source]

2D plot containing field data associated with style through fieldmaps.

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, '2D', 'intflow.lpk')
dataset = tp.load_layout(infile)

frame = tp.active_frame()
plot = frame.plot(PlotType.Cartesian2D)
plot.activate()
plot.show_edge = False
plot.show_mesh = False

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

# save image to file
tp.export_image('plot_field2d.png')
../_images/plot_field2d.png

Attributes

active_fieldmaps Active fieldmaps in this plot.
active_fieldmap_indices Set of active fieldmaps by index.
axes Axes style control for this plot.
draw_order The order in which objects are drawn to the screen.
fieldmaps All fieldmaps in this plot.
num_fieldmaps Number of all fieldmaps in this plot.
scatter Plot-local Scatter style control.
show_contour Enable contours for this plot.
show_edge Enable zone edge lines for this plot.
show_lighting_effect Enable lighting effect for all objects within this plot.
show_mesh Enable mesh lines for this plot.
show_scatter Enable scatter symbols for this plot.
show_shade Enable surface shading effect for this plot.
show_streamtraces Enable drawing streamtraces on this plot.
show_translucency Enable translucent effect for all objects within this plot.
show_vector Enable drawing of vectors.
vector Vector variable and style control for this plot.
view Axes orientation and limits adjustments.

Methods

activate Make this the active plot type on the parent frame.
contour Plot-local ContourGroup style control.
fieldmap Returns a Cartesian2DFieldmap by Zone or index.
fieldmap_index Returns the index of the fieldmap associated with a Zone.
Cartesian2DFieldPlot.activate()[source]

Make this the active plot type on the parent frame.

Example usage:

>>> from tecplot.constant import PlotType
>>> plot = frame.plot(PlotType.Cartesian2D)
>>> plot.activate()
Cartesian2DFieldPlot.num_fieldmaps

Number of all fieldmaps in this plot.

Type:integer

Example usage:

>>> print(frame.plot().num_fieldmaps)
3
Cartesian2DFieldPlot.fieldmap(key)[source]

Returns a Cartesian2DFieldmap by Zone or index.

Parameter:
key (Zone or integer): The Zone must be in the Dataset
attached to the assocated frame of this plot.

Example usage:

>>> fmap = plot.fieldmap(dataset.zone(0))
>>> fmap.scatter.show = True
Cartesian2DFieldPlot.fieldmap_index(zone)

Returns the index of the fieldmap associated with a Zone.

Parameter:
zone (Zone): The Zone object that belongs to the Dataset
associated with this plot.
Returns:Index

Example usage:

>>> fmap_index = plot.fieldmap_index(dataset.zone('Zone'))
>>> plot.fieldmap(fmap_index).show_mesh = True
Cartesian2DFieldPlot.fieldmaps

All fieldmaps in this plot.

Yields: Cartesian2DFieldmap or Cartesian3DFieldmap

Example usage:

>>> for fmap in plot.fieldmaps:
...     fmap.mesh.show = True
Cartesian2DFieldPlot.active_fieldmaps

Active fieldmaps in this plot.

Yields: Cartesian2DFieldmap or Cartesian3DFieldmap

Example usage:

>>> for fmap in plot.active_fieldmaps:
...     fmap.vector.show = True
Cartesian2DFieldPlot.active_fieldmap_indices

Set of active fieldmaps by index.

Type:set

Example usage:

>>> for i in plot.active_fieldmap_indices:
...     plot.fieldmap(i).scatter.show = True
Cartesian2DFieldPlot.draw_order

The order in which objects are drawn to the screen.

Type:TwoDDrawOrder

Possible values: TwoDDrawOrder.ByZone, TwoDDrawOrder.ByLayer.

The order is either by Zone or by visual layer (contour, mesh, etc.):

>>> plot.draw_order = TwoDDrawOrder.ByZone
Cartesian2DFieldPlot.show_contour

Enable contours for this plot.

Type:bool

Example usage:

>>> frame.plot().show_contour = True
Cartesian2DFieldPlot.show_edge

Enable zone edge lines for this plot.

Type:bool

Example usage:

>>> frame.plot().show_edge = True
Cartesian2DFieldPlot.show_lighting_effect

Enable lighting effect for all objects within this plot.

Type:bool

Example usage:

>>> frame.plot().show_lighting_effect = True
Cartesian2DFieldPlot.show_mesh

Enable mesh lines for this plot.

Type:bool

Example usage:

>>> frame.plot().show_mesh = True
Cartesian2DFieldPlot.show_scatter

Enable scatter symbols for this plot.

Type:bool

Example usage:

>>> frame.plot().show_scatter = True
Cartesian2DFieldPlot.show_shade

Enable surface shading effect for this plot.

Type:bool

Example usage:

>>> frame.plot().show_shade = True
Cartesian2DFieldPlot.show_streamtraces

Enable drawing streamtraces on this plot.

Type:bool

Example usage:

>>> frame.plot().show_streamtraces = True
Cartesian2DFieldPlot.show_translucency

Enable translucent effect for all objects within this plot.

Type:bool

Example usage:

>>> frame.plot().show_translucency = True
Cartesian2DFieldPlot.show_vector

Enable drawing of vectors.

Type:bool

Example usage:

>>> frame.plot().show_vector = True
Cartesian2DFieldPlot.axes

Axes style control for this plot.

Type:Cartesian2DFieldAxes

Example usage:

>>> from tecplot.constant import PlotType
>>> frame.plot_type = PlotType.Cartesian2D
>>> axes = frame.plot().axes
>>> axes.x_axis.variable = dataset.variable('U')
>>> axes.y_axis.variable = dataset.variable('V')
Cartesian2DFieldPlot.contour(index)

Plot-local ContourGroup style control.

Type:ContourGroup

Example usage:

>>> contour = frame.plot().contour(0)
>>> contour.colormap_name = 'Magma'
Cartesian2DFieldPlot.scatter

Plot-local Scatter style control.

Type:Scatter

Example usage:

>>> scatter = frame.plot().scatter
>>> scatter.variable = dataset.variable('P')
Cartesian2DFieldPlot.vector

Vector variable and style control for this plot.

Type:Vector2D

Example usage:

>>> plot.vector.u_variable = dataset.variable('U')
Cartesian2DFieldPlot.view

Axes orientation and limits adjustments.

Type:Cartesian2DView

Example usage:

>>> plot.view.fit()

Cartesian3DFieldPlot

class tecplot.plot.Cartesian3DFieldPlot(frame)[source]

3D plot containing field data associated with style through fieldmaps.

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, '3D', 'spaceship.lpk')
dataset = tp.load_layout(infile)

frame = tp.active_frame()
plot = frame.plot(PlotType.Cartesian3D)
plot.activate()
plot.show_lighting_effect = False
plot.show_streamtraces = False

# save image to file
tp.export_image('plot_field3d.png')
../_images/plot_field3d.png

Attributes

active_fieldmaps Active fieldmaps in this plot.
active_fieldmap_indices Set of active fieldmaps by index.
axes Axes style control for this plot.
fieldmaps All fieldmaps in this plot.
num_fieldmaps Number of all fieldmaps in this plot.
scatter Plot-local Scatter style control.
show_contour Enable contours for this plot.
show_edge Enable zone edge lines for this plot.
show_lighting_effect Enable lighting effect for all objects within this plot.
show_mesh Enable mesh lines for this plot.
show_scatter Enable scatter symbols for this plot.
show_shade Enable surface shading effect for this plot.
show_streamtraces Enable drawing streamtraces on this plot.
show_translucency Enable translucent effect for all objects within this plot.
show_vector Enable drawing of vectors.
vector Vector variable and style control for this plot.
view Viewport, axes orientation and limits adjustments.

Methods

activate Make this the active plot type on the parent frame.
contour Plot-local ContourGroup style control.
fieldmap Returns a Cartesian3DFieldmap by Zone or index.
fieldmap_index Returns the index of the fieldmap associated with a Zone.
Cartesian3DFieldPlot.activate()[source]

Make this the active plot type on the parent frame.

Example usage:

>>> from tecplot.constant import PlotType
>>> plot = frame.plot(PlotType.Cartesian3D)
>>> plot.activate()
Cartesian3DFieldPlot.num_fieldmaps

Number of all fieldmaps in this plot.

Type:integer

Example usage:

>>> print(frame.plot().num_fieldmaps)
3
Cartesian3DFieldPlot.fieldmap(key)[source]

Returns a Cartesian3DFieldmap by Zone or index.

Parameter:
key (Zone or integer): The Zone must be in the Dataset
attached to the assocated frame of this plot.

Example usage:

>>> fmap = plot.fieldmap(dataset.zone(0))
>>> fmap.scatter.show = True
Cartesian3DFieldPlot.fieldmap_index(zone)

Returns the index of the fieldmap associated with a Zone.

Parameter:
zone (Zone): The Zone object that belongs to the Dataset
associated with this plot.
Returns:Index

Example usage:

>>> fmap_index = plot.fieldmap_index(dataset.zone('Zone'))
>>> plot.fieldmap(fmap_index).show_mesh = True
Cartesian3DFieldPlot.fieldmaps

All fieldmaps in this plot.

Yields: Cartesian2DFieldmap or Cartesian3DFieldmap

Example usage:

>>> for fmap in plot.fieldmaps:
...     fmap.mesh.show = True
Cartesian3DFieldPlot.active_fieldmaps

Active fieldmaps in this plot.

Yields: Cartesian2DFieldmap or Cartesian3DFieldmap

Example usage:

>>> for fmap in plot.active_fieldmaps:
...     fmap.vector.show = True
Cartesian3DFieldPlot.active_fieldmap_indices

Set of active fieldmaps by index.

Type:set

Example usage:

>>> for i in plot.active_fieldmap_indices:
...     plot.fieldmap(i).scatter.show = True
Cartesian3DFieldPlot.show_contour

Enable contours for this plot.

Type:bool

Example usage:

>>> frame.plot().show_contour = True
Cartesian3DFieldPlot.show_edge

Enable zone edge lines for this plot.

Type:bool

Example usage:

>>> frame.plot().show_edge = True
Cartesian3DFieldPlot.show_lighting_effect

Enable lighting effect for all objects within this plot.

Type:bool

Example usage:

>>> frame.plot().show_lighting_effect = True
Cartesian3DFieldPlot.show_mesh

Enable mesh lines for this plot.

Type:bool

Example usage:

>>> frame.plot().show_mesh = True
Cartesian3DFieldPlot.show_scatter

Enable scatter symbols for this plot.

Type:bool

Example usage:

>>> frame.plot().show_scatter = True
Cartesian3DFieldPlot.show_shade

Enable surface shading effect for this plot.

Type:bool

Example usage:

>>> frame.plot().show_shade = True
Cartesian3DFieldPlot.show_streamtraces

Enable drawing streamtraces on this plot.

Type:bool

Example usage:

>>> frame.plot().show_streamtraces = True
Cartesian3DFieldPlot.show_translucency

Enable translucent effect for all objects within this plot.

Type:bool

Example usage:

>>> frame.plot().show_translucency = True
Cartesian3DFieldPlot.show_vector

Enable drawing of vectors.

Type:bool

Example usage:

>>> frame.plot().show_vector = True
Cartesian3DFieldPlot.axes

Axes style control for this plot.

Type:Cartesian3DFieldAxes

Example usage:

>>> from tecplot.constant import PlotType
>>> frame.plot_type = PlotType.Cartesian3D
>>> axes = frame.plot().axes
>>> axes.x_axis.variable = dataset.variable('U')
>>> axes.y_axis.variable = dataset.variable('V')
>>> axes.z_axis.variable = dataset.variable('W')
Cartesian3DFieldPlot.contour(index)

Plot-local ContourGroup style control.

Type:ContourGroup

Example usage:

>>> contour = frame.plot().contour(0)
>>> contour.colormap_name = 'Magma'
Cartesian3DFieldPlot.scatter

Plot-local Scatter style control.

Type:Scatter

Example usage:

>>> scatter = frame.plot().scatter
>>> scatter.variable = dataset.variable('P')
Cartesian3DFieldPlot.vector

Vector variable and style control for this plot.

Type:Vector3D

Example usage:

>>> plot.vector.u_variable = dataset.variable('U')
Cartesian3DFieldPlot.view

Viewport, axes orientation and limits adjustments.

Type:Cartesian3DView

Example usage:

>>> plot.view.fit()

Fieldmaps

Cartesian2DFieldmap

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

Attributes

contour FieldmapContour style including flooding, lines and line coloring.
edge FieldmapEdge style control for boundary lines.
effects FieldmapEffects style control for clipping and blanking effects.
group Zero-based group number for this Fieldmaps.
mesh FieldmapMesh style lines connecting neighboring data points.
points FieldmapPoints object to control which points to draw.
scatter FieldmapScatter style for scatter plots.
shade FieldmapShade style control for surface shading.
show Display this fieldmap on the plot.
show_iso_surfaces (bool) Enable drawing of Iso-surfaces.
show_slices (bool) Enable drawing of slice surfaces.
show_streamtraces (bool) Enable drawing of streamtraces.
surfaces FieldmapSurfaces object to control which surfaces to draw.
vector FieldmapVector style for vector field plots using arrows.
zones List of zones used by this fieldmap.
Cartesian2DFieldmap.group

Zero-based group number for this Fieldmaps.

Type:integer

This is a piece of auxiliary data and can be useful for identifying a subset of fieldmaps. For example, to loop over all fieldmaps that have group set to 4:

>>> plot.fieldmap(0).group = 4
>>> plot.fieldmap(3).group = 4
>>> for fmap in filter(lambda f: f.group == 4, plot.fieldmaps()):
...     print(fmap.index)
0
3
Cartesian2DFieldmap.zones

List of zones used by this fieldmap.

Type:generator of Zones

Example usage:

>>> for zone in fieldmap.zones:
...     print(zone.name)
Zone 1
Zone 2
Cartesian2DFieldmap.show

Display this fieldmap on the plot.

Type:bool

Example usage for turning on all fieldmaps:

>>> for fmap in plot.fieldmaps():
...     fmap.show = True
Cartesian2DFieldmap.points

FieldmapPoints object to control which points to draw.

Type:FieldmapPoints
Cartesian2DFieldmap.surfaces

FieldmapSurfaces object to control which surfaces to draw.

Type:FieldmapSurfaces
Cartesian2DFieldmap.contour

FieldmapContour style including flooding, lines and line coloring.

Type:FieldmapContour
Cartesian2DFieldmap.edge

FieldmapEdge style control for boundary lines.

Type:FieldmapEdge
Cartesian2DFieldmap.effects

FieldmapEffects style control for clipping and blanking effects.

Type:FieldmapEffects
Cartesian2DFieldmap.mesh

FieldmapMesh style lines connecting neighboring data points.

Type:FieldmapMesh
Cartesian2DFieldmap.scatter

FieldmapScatter style for scatter plots.

Type:FieldmapScatter
Cartesian2DFieldmap.shade

FieldmapShade style control for surface shading.

Type:FieldmapShade
Cartesian2DFieldmap.vector

FieldmapVector style for vector field plots using arrows.

Type:FieldmapVector
Cartesian2DFieldmap.show_iso_surfaces

(bool) Enable drawing of Iso-surfaces.

Type:boolean
Cartesian2DFieldmap.show_slices

(bool) Enable drawing of slice surfaces.

Type:boolean
Cartesian2DFieldmap.show_streamtraces

(bool) Enable drawing of streamtraces.

Type:boolean

Cartesian3DFieldmap

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

Attributes

contour FieldmapContour style including flooding, lines and line coloring.
edge FieldmapEdge style control for boundary lines.
effects FieldmapEffects3D style control for blanking and lighting effects.
group Zero-based group number for this Fieldmaps.
mesh FieldmapMesh style lines connecting neighboring data points.
points FieldmapPoints object to control which points to draw.
scatter FieldmapScatter style for scatter plots.
shade FieldmapShade3D style control for surface shading.
show Display this fieldmap on the plot.
show_iso_surfaces (bool) Enable drawing of Iso-surfaces.
show_slices (bool) Enable drawing of slice surfaces.
show_streamtraces (bool) Enable drawing of streamtraces.
surfaces FieldmapSurfaces object to control which surfaces to draw.
vector FieldmapVector style for vector field plots using arrows.
zones List of zones used by this fieldmap.
Cartesian3DFieldmap.group

Zero-based group number for this Fieldmaps.

Type:integer

This is a piece of auxiliary data and can be useful for identifying a subset of fieldmaps. For example, to loop over all fieldmaps that have group set to 4:

>>> plot.fieldmap(0).group = 4
>>> plot.fieldmap(3).group = 4
>>> for fmap in filter(lambda f: f.group == 4, plot.fieldmaps()):
...     print(fmap.index)
0
3
Cartesian3DFieldmap.zones

List of zones used by this fieldmap.

Type:generator of Zones

Example usage:

>>> for zone in fieldmap.zones:
...     print(zone.name)
Zone 1
Zone 2
Cartesian3DFieldmap.show

Display this fieldmap on the plot.

Type:bool

Example usage for turning on all fieldmaps:

>>> for fmap in plot.fieldmaps():
...     fmap.show = True
Cartesian3DFieldmap.points

FieldmapPoints object to control which points to draw.

Type:FieldmapPoints
Cartesian3DFieldmap.surfaces

FieldmapSurfaces object to control which surfaces to draw.

Type:FieldmapSurfaces
Cartesian3DFieldmap.contour

FieldmapContour style including flooding, lines and line coloring.

Type:FieldmapContour
Cartesian3DFieldmap.edge

FieldmapEdge style control for boundary lines.

Type:FieldmapEdge
Cartesian3DFieldmap.effects

FieldmapEffects3D style control for blanking and lighting effects.

Type:FieldmapEffects3D
Cartesian3DFieldmap.mesh

FieldmapMesh style lines connecting neighboring data points.

Type:FieldmapMesh
Cartesian3DFieldmap.scatter

FieldmapScatter style for scatter plots.

Type:FieldmapScatter
Cartesian3DFieldmap.shade

FieldmapShade3D style control for surface shading.

Type:FieldmapShade3D
Cartesian3DFieldmap.vector

FieldmapVector style for vector field plots using arrows.

Type:FieldmapVector
Cartesian3DFieldmap.show_iso_surfaces

(bool) Enable drawing of Iso-surfaces.

Type:boolean
Cartesian3DFieldmap.show_slices

(bool) Enable drawing of slice surfaces.

Type:boolean
Cartesian3DFieldmap.show_streamtraces

(bool) Enable drawing of streamtraces.

Type:boolean

FieldmapContour

class tecplot.plot.FieldmapContour(fieldmap)[source]

Style control for flooding and contour lines.

This object controls which contour groups are associated with flooding, line placement and line coloring. Three different contour groups may be used though there are eight total groups that can be configured in a single plot. In this example, we flood by the first contour group (index: 0), place contour lines by the second contour group (index: 1) and color the lines by the third contour group (index: 2):

import numpy as np

import tecplot as tp
from tecplot.constant import *
from tecplot.data.operate import execute_equation

# Get the active frame, setup a grid (30x30x30)
# where each dimension ranges from 0 to 30.
# Add variables P,Q,R to the dataset and give
# values to the data.
frame = tp.active_frame()
dataset = frame.dataset
for v in ['X','Y','Z','P','Q','R']:
    dataset.add_variable(v)
zone = dataset.add_ordered_zone('Zone', (30,30,30))
xx = np.linspace(0,30,30)
for v,arr in zip(['X','Y','Z'],np.meshgrid(xx,xx,xx)):
    zone.variable(v)[:] = arr.ravel()
execute_equation('{P} = -10 * {X}    +      {Y}**2 + {Z}**2')
execute_equation('{Q} =       {X}    - 10 * {Y}    - {Z}**2')
execute_equation('{R} =       {X}**2 +      {Y}**2 - {Z}   ')

# Enable 3D field plot and turn on contouring
# with boundary faces
frame.plot_type = PlotType.Cartesian3D
plot = frame.plot()
srf = plot.fieldmap(0).surfaces
srf.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
plot.show_contour = True

# get the contour group associated with the
# newly created zone
contour = plot.fieldmap(dataset.zone('Zone')).contour

# turn on flooding and lines, increase line thickness
contour.contour_type = ContourType.Overlay
contour.line_thickness = 0.7

# assign flooding to the first contour group
contour.flood_group = plot.contour(0)
contour.flood_group.variable = dataset.variable('P')
contour.flood_group.colormap_name = 'Sequential - Yellow/Green/Blue'
contour.flood_group.legend.show = False

# assign line placement to the second contour group
contour.line_group = plot.contour(1)
contour.line_group.legend.show = False
contour.line_group.variable = dataset.variable('Q')
contour.line_group.default_num_levels = 4

# add labels to the lines based on placement
contour.line_group.labels.show = True
contour.line_group.labels.font.size = 3.5
contour.line_group.labels.font.bold = True

# assign line coloring to the third contour group
contour.line_color = plot.contour(2)
contour.line_color.legend.show = False
contour.line_color.variable = dataset.variable('R')

# save image to PNG file
tp.export_image('fieldmap_contour.png')
../_images/fieldmap_contour.png

Attributes

contour_type ContourType to plot.
flood_group The ContourGroup to use for flooding.
flood_group_index The Index of the ContourGroup to use for flooding.
lighting_effect Enable lighting effect on this contour.
line_color The Color or ContourGroup to use when coloring the lines.
line_group The ContourGroup to use for line placement and style.
line_group_index The Index of the ContourGroup to use for contour lines.
line_pattern LinePattern type to use for contour lines.
line_thickness Thickness (float) of the drawn lines.
pattern_length Length (float) of the pattern segment for non-solid lines.
show Enable drawing the contours.
FieldmapContour.show

Enable drawing the contours.

Type:bool

Example usage:

>>> contour = plot.fieldmap(0).contour
>>> contour.show = True
FieldmapContour.contour_type

ContourType to plot.

Type:ContourType

Possible values are:

ContourType.Flood (default)
Filled color between the contour levels.
ContourType.Lines
Lines only.
ContourType.Overlay
Lines overlayed on flood.
ContourType.AverageCell
Filled color by the average value within cells.
ContourType.PrimaryValue
Filled color by the value at the primary corner of the cells.

In this example, we enable both flooding and contour lines:

>>> from tecplot.constant import ContourType
>>> contour = plot.fieldmap(0).contour
>>> contour.contour_type = ContourType.Overlay
FieldmapContour.flood_group

The ContourGroup to use for flooding.

Type:ContourGroup

This property sets and gets the ContourGroup used for flooding. Changing style on this ContourGroup will affect all other fieldmaps on the same Frame that use it. Example usage:

>>> cmap_name = 'Sequential - Yellow/Green/Blue'
>>> contour = plot.fieldmap(0).contour
>>> contour.flood_group = plot.contour(1)
>>> contour.flood_group.variable = dataset.variable('P')
>>> contour.flood_group.colormap_name = cmap_name
FieldmapContour.flood_group_index

The Index of the ContourGroup to use for flooding.

Type:integer (zero-based index)

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

>>> contour = plot.fieldmap(0).contour
>>> contour.flood_group_index = 1
>>> contour.flood_group.variable = dataset.variable('P')
FieldmapContour.line_group

The ContourGroup to use for line placement and style.

Type:ContourGroup

This property sets and gets the ContourGroup used for line placement and though all properties of the ContourGroup can be manipulated through this object, many of them such as color will not effect 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.fieldmap(0).contour
>>> contour.line_group = plot.contour(2)
>>> contour.line_group.variable = dataset.variable('Z')
FieldmapContour.line_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 and though all properties of the ContourGroup can be manipulated through this object, many of them such as color will not effect 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.fieldmap(0).contour
>>> contour.line_group_index = 2
>>> contour.line_group.variable = dataset.variable('Z')
FieldmapContour.line_color

The Color or ContourGroup to use when coloring the lines.

Type:Color or ContourGroup

FieldmapContour lines can be a solid color or be colored by a ContourGroup as obtained through the plot.contour property. Note that changing style on this ContourGroup will affect all other fieldmaps on the same Frame that use it. Example usage:

>>> from tecplot.constant import Color
>>> contour = plot.fieldmap(1).contour
>>> contour.line_color = Color.Blue

Example of setting the color from a ContourGroup:

>>> contour = plot.fieldmap(0).contour
>>> contour.line_color = plot.contour(1)
>>> contour.line_color.variable = dataset.variable('P')
FieldmapContour.line_thickness

Thickness (float) of the drawn lines.

Type:float in percentage of the Frame‘s height.

Example usage:

>>> contour = plot.fieldmap(0).contour
>>> contour.line_thickness = 0.7
FieldmapContour.line_pattern

LinePattern type to use for contour lines.

Type:LinePattern

Possible values: Solid, Dashed, DashDot, Dotted, LongDash, DashDotDot.

Example usage:

>>> from tecplot.constant import LinePattern
>>> contour = plot.fieldmap(0).contour
>>> contour.line_pattern = LinePattern.DashDotDot
FieldmapContour.pattern_length

Length (float) of the pattern segment for non-solid lines.

Type:float in percentage of the Frame‘s height.

Example usage:

>>> contour = plot.fieldmap(0).contour
>>> contour.pattern_length = 3.5
FieldmapContour.lighting_effect

Enable lighting effect on this contour.

Type:bool

Example usage:

>>> contour = plot.fieldmap(0).contour
>>> contour.lighting_effect = False

FieldmapEdge

class tecplot.plot.FieldmapEdge(fieldmap)[source]

Volume boundary lines.

An edge plot layer displays the connections of the outer lines (IJ-ordered zones), finite element surface zones, or planes (IJK-ordered zones). The FieldmapEdge layer allows you to display the edges (creases and borders) of your data. Zone edges exist only for ordered zones or 2D finite element zones. Three-dimensional finite element zones do not have boundaries.

import os

import tecplot as tp
from tecplot.constant import Color, EdgeType, PlotType, SurfacesToPlot

examples_dir = tp.session.tecplot_examples_directory()
datafile = os.path.join(examples_dir, '3D', 'jet_surface.plt')
dataset = tp.data.load_tecplot(datafile)
frame = dataset.frame

# Enable 3D field plot, turn on contouring and translucency
frame.plot_type = PlotType.Cartesian3D
plot = frame.plot()
plot.show_contour = True
plot.show_edge = True

plot.contour(0).colormap_name = 'Sequential - Blue'

# adjust effects for every fieldmap in this dataset
for zone in dataset.zones():
    fmap = plot.fieldmap(zone)
    fmap.contour.flood_group.variable = dataset.variable('S')
    fmap.surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces

    edge = fmap.edge
    edge.edge_type = EdgeType.Creases
    edge.color = Color.Blue
    edge.line_thickness = 0.7

# save image to file
tp.export_image('fieldmap_edge.png')
../_images/fieldmap_edge.png

Attributes

color Line Color.
edge_type Where to draw edge lines.
i_border Which border lines to draw in the I-dimension.
j_border Which border lines to draw in the J-dimension.
k_border Which border lines to draw in the K-dimension.
line_thickness Thickness of the edge lines drawn.
show Draw the mesh for this fieldmap.
FieldmapEdge.show

Draw the mesh for this fieldmap.

Type:boolean

Example usage:

>>> plot.show_edge = True
>>> plot.fieldmap(0).edge.show = True
FieldmapEdge.edge_type

Where to draw edge lines.

Type:EdgeType

Possible values: Borders, Creases, BordersAndCreases.

Example usage:

>>> from tecplot.constant import EdgeType
>>> plot.show_edge = True
>>> plot.fieldmap(0).edge.edge_type = EdgeType.Creases
FieldmapEdge.i_border

Which border lines to draw in the I-dimension.

Type:BorderLocation

Possible values: None, Min, Max, Both.

Example usage:

>>> from tecplot.constant import BorderLocation
>>> plot.show_edge = True
>>> plot.fieldmap(0).edge.i_border = BorderLocation.Min
FieldmapEdge.j_border

Which border lines to draw in the J-dimension.

Type:BorderLocation

Possible values: None, Min, Max, Both.

Example usage:

>>> from tecplot.constant import BorderLocation
>>> plot.show_edge = True
>>> plot.fieldmap(0).edge.j_border = BorderLocation.Both
FieldmapEdge.k_border

Which border lines to draw in the K-dimension.

Type:BorderLocation

Possible values: None, Min, Max, Both.

Example usage:

>>> from tecplot.constant import BorderLocation
>>> plot.show_edge = True
>>> plot.fieldmap(0).edge.k_border = None
FieldmapEdge.color

Line Color.

Type:Color
FieldmapEdge.line_thickness

Thickness of the edge lines drawn.

Type:float in percentage of Frame height.

Example usage:

>>> plot.fieldmap(0).edge.line_thickness = 0.4

FieldmapEffects

class tecplot.plot.FieldmapEffects(fieldmap)[source]

Clipping and blanking style control.

This object controls value blanking and clipping from plane slices for this fieldmap.

Attributes

clip_planes Clip planes to use when drawing this fieldmap.
value_blanking Enable value blanking effect for this fieldmap.
FieldmapEffects.value_blanking

Enable value blanking effect for this fieldmap.

Type:boolean

Example usage:

>>> plot.fieldmap(0).effects.value_blanking = True
FieldmapEffects.clip_planes

Clip planes to use when drawing this fieldmap.

Type:list of integers [0-5] or None

Example usage:

>>> plot.fieldmap(0).effects.clip_planes = [0,1,2]
class tecplot.plot.FieldmapEffects3D(fieldmap)[source]

Clipping, blanking, lighting and translucency style control.

import os

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

examples_dir = tp.session.tecplot_examples_directory()
datafile = os.path.join(examples_dir, '3D', 'jet_surface.plt')
dataset = tp.data.load_tecplot(datafile)
frame = dataset.frame

# Enable 3D field plot, turn on contouring and translucency
frame.plot_type = PlotType.Cartesian3D
plot = frame.plot()
plot.show_contour = True
plot.show_translucency = True

# adjust effects for every fieldmap in this dataset
for zone in dataset.zones():
    fmap = plot.fieldmap(zone)
    fmap.contour.flood_group.variable = dataset.variable('S')
    fmap.surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces

    eff = fmap.effects
    eff.lighting_effect = LightingEffect.Paneled
    eff.surface_translucency = 30

# save image to file
tp.export_image('fieldmap_effects3d.png')
../_images/fieldmap_effects3d.png

Attributes

clip_planes Clip planes to use when drawing this fieldmap.
lighting_effect The type of lighting effect to render.
surface_translucency Translucency of all drawn surfaces for this fieldmap.
value_blanking Enable value blanking effect for this fieldmap.
FieldmapEffects3D.lighting_effect

The type of lighting effect to render.

Type:LightingEffect

Possible values:

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 plot type offers smoother, more continuous shading than Paneled shading, but it results in slower plotting and larger vector images. Gouraud shading is not continuous across zone boundaries unless face neighbors are specified in the data and is not available for finite element volume zones when blanking is active in which case, the zone’s lighting effect reverts to Paneled shading in this case.

If IJK-ordered data with FieldmapSurfaces.surfaces_to_plot is set to SurfacesToPlot.ExposedCellFaces, faces exposed by blanking will revert to Paneled shading.

Example usage:

>>> from tecplot.constant import LightingEffect
>>> effects = plot.fieldmap(0).effects
>>> effects.lighting_effect = LightingEffect.Paneled
FieldmapEffects3D.surface_translucency

Translucency of all drawn surfaces for this fieldmap.

Type:integer in percent or None

Example usage:

>>> effects = plot.fieldmap(0).effects
>>> effects.surface_translucency = 50
FieldmapEffects3D.value_blanking

Enable value blanking effect for this fieldmap.

Type:boolean

Example usage:

>>> plot.fieldmap(0).effects.value_blanking = True
FieldmapEffects3D.clip_planes

Clip planes to use when drawing this fieldmap.

Type:list of integers [0-5] or None

Example usage:

>>> plot.fieldmap(0).effects.clip_planes = [0,1,2]

FieldmapMesh

class tecplot.plot.FieldmapMesh(fieldmap)[source]

Lines connecting neighboring data points.

The mesh plot layer displays the lines connecting neighboring data points within a Zone. For I-ordered data, the mesh is a single line connecting all of the points in order of increasing I-index. For IJ-ordered data, the mesh consists of two families of lines connecting adjacent data points of increasing I-index and increasing J-index. For IJK-ordered data, the mesh consists of three families of lines, one connecting points of increasing I-index, one connecting points of increasing J-index, and one connecting points of increasing K-index. For finite element zones, the mesh is a plot of every edge of all of the elements that are defined by the connectivity list for the node points.

from os import path
import numpy as np
import tecplot as tp
from tecplot.constant import PlotType, MeshType

examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, '3D', 'jet_surface.plt')
dataset = tp.data.load_tecplot(infile)

# Enable 3D field plot and turn on contouring
frame = tp.active_frame()
frame.plot_type = PlotType.Cartesian3D
plot = frame.plot()
plot.show_mesh = True

contour = plot.contour(0)
contour.variable = dataset.variable('S')
contour.colormap_name = 'Doppler'
contour.levels.reset_levels(np.linspace(0.02,0.12,11))

# set the mesh type and color for all zones
for zone in dataset.zones():
    mesh = plot.fieldmap(zone).mesh
    mesh.mesh_type = MeshType.HiddenLine
    mesh.color = contour

# save image to file
tp.export_image('fieldmap_mesh.png')
../_images/fieldmap_mesh.png

Attributes

color The Color or ContourGroup to use when drawing the lines.
line_thickness Thickness (float) of the drawn lines.
line_pattern LinePattern type to use for mesh lines.
mesh_type MeshType to show.
pattern_length Length (float) of the pattern segment for non-solid lines.
show Draw the mesh for this fieldmap.
FieldmapMesh.show

Draw the mesh for this fieldmap.

Type:boolean

Example usage:

>>> from tecplot.constant import SurfacesToPlot
>>> plot.show_mesh = True
>>> surfaces = plot.fieldmap(0).surfaces
>>> surfaces.surfaces_to_plot = SurfacesToPlot.IPlanes
>>> plot.fieldmap(0).mesh.show = True
FieldmapMesh.mesh_type

MeshType to show.

Type:MeshType

Possible values:

Wireframe

Wire frame meshes are drawn below any other zone layers on the same zone. In 3D Cartesian plots, no hidden lines are removed. For 3D volume zones (finite element volume or IJK-ordered), the full 3D mesh (consisting of all the connecting lines between data points) is not generally drawn because the sheer number of lines would make it confusing. The mesh drawn will depend on FieldmapSurfaces which can be obtained through the parent fieldmap with mesh.fieldmap.surfaces:

from tecplot.constant import MeshType, SurfacesToPlot
mesh = plot.fieldmap(0).mesh
mesh.mesh_type = MeshType.Wireframe
surfaces = mesh.fieldmap.surfaces
surfaces.surfaces_to_plot = SurfacesToPlot.IPlanes

By default, only the mesh on exposed cell faces is shown.

Overlay
Similar to Wire Frame, mesh lines are drawn over all other zone layers except for vectors and scatter symbols. In 3D Cartesian plots, the area behind the cells of the plot is still visible (unless another plot type such as contour flooding prevents this). As with Wire Frame, the mesh drawn will depend on FieldmapSurfaces which can be obtained through the parent fieldmap with mesh.fieldmap.surfaces.
HiddenLine

Similar to Overlay, except hidden lines are removed from behind the mesh. In effect, the cells (elements) of the mesh are opaque. FieldmapSurfaces and lines that are hidden behind another surface are removed from the plot. For 3D volume zones, using this plot type obscures everything inside the zone. If you choose this option for 3D volume zones, then choosing to plot every surface with:

from tecplot.constant import HiddenLine, SurfacesToPlot
mesh = plot.fieldmap(0).mesh
mesh.mesh_type = MeshType.HiddenLine
surfaces = mesh.fieldmap.surfaces
surfaces.surfaces_to_plot = SurfacesToPlot.All

has the same effect as plotting only exposed cell faces with:

surfaces.surfaces_to_plot = SurfacesToPlot.ExposedCellFaces

but is much slower.

FieldmapMesh.color

The Color or ContourGroup to use when drawing the lines.

Type:Color or ContourGroup

FieldmapContour lines can be a solid color or be colored by a ContourGroup as obtained through the plot.contour property. Note that changing style on this ContourGroup will affect all other fieldmaps on the same Frame that use it. Example usage:

>>> from tecplot.constant import Color
>>> plot.fieldmap(1).mesh.color = Color.Blue

Example of setting the color from a ContourGroup:

>>> plot.fieldmap(1).mesh.color = plot.contour(1)
FieldmapMesh.line_thickness

Thickness (float) of the drawn lines.

Type:float in percentage of the Frame‘s height.

Example usage:

>>> plot.fieldmap(0).mesh.line_thickness = 0.7
FieldmapMesh.line_pattern

LinePattern type to use for mesh lines.

Type:LinePattern

Possible values: Solid, Dashed, DashDot, Dotted, LongDash, DashDotDot.

Example usage:

>>> from tecplot.constant import LinePattern
>>> mesh = plot.fieldmap(0).mesh
>>> mesh.line_pattern = LinePattern.Dashed
FieldmapMesh.pattern_length

Length (float) of the pattern segment for non-solid lines.

Type:float in percentage of the Frame‘s height.

Example usage:

>>> plot.fieldmap(0).mesh.pattern_length = 3.5

FieldmapPoints

class tecplot.plot.FieldmapPoints(fieldmap)[source]

Type and density of the points used for vector and scatter plots.

This object controls the location of the points for FieldmapVector and FieldmapScatter plots relative to the cells.

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

examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, '2D', 'exchng.plt')
dataset = tp.data.load_tecplot(infile)

# Enable 3D field plot and turn on contouring
frame = tp.active_frame()
frame.plot_type = 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_vector = True

for zone in dataset.zones():
    points = plot.fieldmap(zone).points
    points.points_to_plot = PointsToPlot.SurfaceCellCenters
    points.step = (2,2)

# save image to file
tp.export_image('fieldmap_points.png')
../_images/fieldmap_points.png

Attributes

points_to_plot Location of the points to show.
step Step along the dimensions (I, J, K).
FieldmapPoints.points_to_plot

Location of the points to show.

Type:PointsToPlot

Possible values:

SurfaceNodes
Draws only the nodes that are on the surface of the Zone.
AllNodes
Draws all nodes in the Zone.
SurfaceCellCenters
Draws points at the cell centers which are on or near the surface of the Zone.
AllCellCenters
Draws points at all cell centers in the Zone.
AllConnected
Draws all the nodes that are connected by the node map. Nodes without any connectivity are not drawn.

Example usage:

>>> from tecplot.constant import PointsToPlot
>>> pts = plot.fieldmap(0).points
>>> sts.points_to_plot = PointsToPlot.SurfaceCellCenters
FieldmapPoints.step

Step along the dimensions (I, J, K).

Type:tuple of integers

This property specifies the I, J, and K-step intervals. For irregular and finite element data, only the first parameter or I-Step has an effect. This steps through the nodes in the order they are listed in the data file. In this case, a single number can be given, but note that the return type is always a 3-tuple for both ordered and irregular data.

Example for IJK ordered data:

>>> plot.fieldmap(0).points.step = (10,10,None)
>>> print(plot.fieldmap(0).points.step)
(10, 10, 1)

Example for irregular data:

>>> plot.fieldmap(0).points.step = 10
>>> print(plot.fieldmap(0).points.step)
(10, 1, 1)

FieldmapScatter

class tecplot.plot.FieldmapScatter(fieldmap)[source]

Plot of nodes using symbols.

FieldmapScatter plots display symbols at the data points in a field. The symbols may be sized according to the values of a specified variable, colored by the values of the contour variable, or may be uniformly sized or colored. Unlike contour plots, scatter plots do not require any mesh structure connecting the points, allowing scatter plots of irregular data.

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

examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, '2D', 'random.plt')
dataset = tp.data.load_tecplot(infile)

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

scatter = plot.fieldmap(0).scatter
scatter.symbol_type = SymbolType.Geometry
scatter.fill_color = plot.contour(0)

tp.export_image('fieldmap_scatter.png')
../_images/fieldmap_scatter.png

Attributes

color Line Color or ContourGroup of the drawn symbols.
fill_color Fill or background color.
line_thickness Width of the lines when drawing symbols.
show Show the scatter symbols.
size Size of the symbols to draw.
size_by_variable Use a variable to determine relative size of symbols.
symbol_type The SymbolType to use for this scatter plot.

Methods

symbol Returns a scatter symbol style object.
FieldmapScatter.show

Show the scatter symbols.

Type:boolean

Example usage:

>>> plot.show_scatter = True
>>> plot.fieldmap(2).scatter.show = True
FieldmapScatter.symbol_type

The SymbolType to use for this scatter plot.

Type:SymbolType

Possible values are: Geometry, Text.

Example usage:

>>> from tecplot.constant import SymbolType
>>> plot.fieldmap(0).scatter.symbol_type = SymbolType.Text
FieldmapScatter.symbol(symbol_type=None)[source]

Returns a scatter symbol style object.

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

Returns: TextScatterSymbol or GeometryScatterSymbol

Example usage:

>>> from tecplot.constant import SymbolType
>>> plot.fieldmap(0).scatter.symbol_type = SymbolType.Text
>>> symbol = plot.fieldmap(0).scatter.symbol()
>>> symbol.text = 'a'
FieldmapScatter.color

Line Color or ContourGroup of the drawn symbols.

Type:Color or ContourGroup

This can be a solid color or a ContourGroup as obtained through the plot.contour property. Note that changing style on the ContourGroup will affect all other fieldmaps in the same Frame that use it. Example usage:

>>> from tecplot.constant import Color
>>> plot.fieldmap(1).scatter.color = Color.Blue

Example of setting the color from a ContourGroup:

>>> plot.fieldmap(1).scatter.color = plot.contour(1)
FieldmapScatter.fill_color

Fill or background color.

Type:Color, ContourGroup, FillMode.UseLineColor, FillMode.UseBackgroundColor or FillMode.None_.

Example usage:

>>> from tecplot.constant import Color, SymbolType
>>> scatter = plot.fieldmap(0).scatter
>>> scatter.symbol_type = SymbolType.Geometry
>>> scatter.fill_color = Color.Red
FieldmapScatter.size

Size of the symbols to draw.

Type:float

Example usage:

>>> plot.fieldmap(0).scatter.size = 4
FieldmapScatter.size_by_variable

Use a variable to determine relative size of symbols.

Type:bool

Example usage:

>>> plot.scatter.variable = dataset.variable('P')
>>> plot.fieldmap(0).scatter.size_by_variable = True
FieldmapScatter.line_thickness

Width of the lines when drawing symbols.

Type:float

Example usage:

>>> from tecplot.constant import SymbolType
>>> scatter = plot.fieldmap(0).scatter
>>> scatter.symbol_type = SymbolType.Geometry
>>> scatter.line_thickness = 1
class tecplot.plot.GeometryScatterSymbol(parent)[source]

Geometric shape for scatter plots.

from os import path
import tecplot as tp
from tecplot.constant import (Color, PlotType, PointsToPlot, SymbolType,
                              GeomShape)

examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, '2D', 'exchng.plt')
dataset = tp.data.load_tecplot(infile)

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

zones = list(dataset.zones())

for i,zone in enumerate(zones):
    points = plot.fieldmap(zone).points
    points.points_to_plot = PointsToPlot.SurfaceCellCenters
    points.step = (2,2)

    scatter = plot.fieldmap(zone).scatter
    scatter.color = Color(i)
    scatter.fill_color = Color(i+len(zones))
    scatter.size = 2
    scatter.line_thickness = 0.5
    scatter.symbol_type = SymbolType.Geometry
    scatter.symbol().shape = GeomShape(i%7)

tp.export_image('fieldmap_scatter_geometry.png')
../_images/fieldmap_scatter_geometry.png

Attributes

shape Geometric shape to use when plotting scatter points.
GeometryScatterSymbol.shape

Geometric shape to use when plotting scatter points.

Type:GeomShape

Possible values: Square, Del, Grad, RTri, LTri, Diamond, Circle, Cube, Sphere, Octahedron, Point.

Example usage:

>>> from tecplot.constant import SymbolType, GeomShape
>>> scatter = plot.fieldmap(0).scatter
>>> scatter.symbol_type = SymbolType.Geometry
>>> scatter.symbol().shape = GeomShape.Diamond
class tecplot.plot.TextScatterSymbol(parent)[source]

Text character for scatter plots.

Only a single character can be used.

from os import path
import tecplot as tp
from tecplot.constant import (Color, PlotType, PointsToPlot, SymbolType,
                              GeomShape)

examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, '2D', 'exchng.plt')
dataset = tp.data.load_tecplot(infile)

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

zones = list(dataset.zones())

for i,zone in enumerate(zones):
    points = plot.fieldmap(zone).points
    points.points_to_plot = PointsToPlot.SurfaceCellCenters
    points.step = (4,4)

    scatter = plot.fieldmap(zone).scatter
    scatter.color = Color((i%4)+13)
    scatter.fill_color = Color.Yellow
    scatter.size = 3
    scatter.symbol_type = SymbolType.Text
    symbol = scatter.symbol()
    symbol.text = hex(i)[-1]

tp.export_image('fieldmap_scatter_text.png')
../_images/fieldmap_scatter_text.png

Attributes

text The ASCII character to use as the symbol to show
typeface Type face to use when rendering text-based scatter.
TextScatterSymbol.text

The ASCII character to use as the symbol to show

Note

This is limited to a single character.

Example usage:

>>> from tecplot.constant import SymbolType
>>> scatter = plot.fieldmap(0).scatter
>>> scatter.symbol_type = SymbolType.Text
>>> scatter.symbol().text = 'X'
TextScatterSymbol.typeface

Type face to use when rendering text-based scatter.

Type:Font.Greek, Font.Math, Font.UserDefined or None (default).

If None (the default), the plot’s top-level scatter settings will determine the font used.

Example usage:

>>> from tecplot.constant import SymbolType, Font
>>> scatter = plot.fieldmap(0).scatter
>>> scatter.symbol_type = SymbolType.Text
>>> scatter.symbol().typeface = Font.Greek

FieldmapShade

class tecplot.plot.FieldmapShade(fieldmap)[source]

Fill color for displayed surfaces on 2D field plots.

Although most commonly used with 3D surfaces (see FieldmapShade3D), shade plots can be used to flood 2D plots with solid colors.

import os
import random
import tecplot
from tecplot.constant import Color, PlotType

random.seed(1)

examples_dir = tecplot.session.tecplot_examples_directory()
datafile = os.path.join(examples_dir, '3D', 'jet_surface.plt')
dataset = tecplot.data.load_tecplot(datafile)
frame = dataset.frame
frame.plot_type = PlotType.Cartesian2D
plot = frame.plot()

for zone in dataset.zones():
    color = Color(random.randint(0,63))
    while color == Color.White:
        color = Color(random.randint(0,63))
    fmap = plot.fieldmap(zone)
    fmap.shade.color = color

tecplot.export_image('jet_surface_shade2d.png')
../_images/jet_surface_shade2d.png

Attributes

color Fill Color of the shade.
show FieldmapShade the drawn surfaces.
FieldmapShade.show

FieldmapShade the drawn surfaces.

Type:bool

Example usage:

>>> plot.fieldmap(0).shade.show = False
FieldmapShade.color

Fill Color of the shade.

Type:Color

Example usage:

>>> from tecplot.constant import Color
>>> plot.fieldmap(0).shade.color = Color.Blue
class tecplot.plot.FieldmapShade3D(fieldmap)[source]

Fill color for displayed surfaces on 3D field plots.

This class inherits all functionality and purpose from FieldmapShade and adds the ability to turn on or off the lighting effect. In 3D plots, fieldmap effects (translucency and lighting) cause color variation (shading) throughout the zones. Shading can can be useful in discerning the shape of the data:

import os
import random
import tecplot
from tecplot.constant import Color, PlotType, SurfacesToPlot

random.seed(1)

examples_dir = tecplot.session.tecplot_examples_directory()
datafile = os.path.join(examples_dir, '3D', 'jet_surface.plt')
dataset = tecplot.data.load_tecplot(datafile)
frame = dataset.frame
frame.plot_type = PlotType.Cartesian3D
plot = frame.plot()

for zone in dataset.zones():
    color = Color(random.randint(0,63))
    while color == Color.White:
        color = Color(random.randint(0,63))
    fmap = plot.fieldmap(zone)
    fmap.surfaces.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
    fmap.shade.color = color
    fmap.shade.lighting_effect = False

tecplot.export_image('jet_surface_shade3d.png')
../_images/jet_surface_shade3d.png

Attributes

color Fill Color of the shade.
lighting_effect Draw a lighting effect on the shaded surfaces.
show FieldmapShade the drawn surfaces.
FieldmapShade3D.show

FieldmapShade the drawn surfaces.

Type:bool

Example usage:

>>> plot.fieldmap(0).shade.show = False
FieldmapShade3D.color

Fill Color of the shade.

Type:Color

Example usage:

>>> from tecplot.constant import Color
>>> plot.fieldmap(0).shade.color = Color.Blue
FieldmapShade3D.lighting_effect

Draw a lighting effect on the shaded surfaces.

Type:bool

Example usage:

>>> plot.fieldmap(0).shade.lighting_effect = False

FieldmapSurfaces

class tecplot.plot.FieldmapSurfaces(fieldmap)[source]

Plot surfaces from volume data.

This class controls viewing volume data as surfaces, either via a boundary surface or one or more planes along the I, J, K dimensions for ordered data.

import numpy as np

import tecplot as tp
from tecplot.constant import *
from tecplot.data.operate import execute_equation

# Get the active frame, setup a grid (30x30x30)
# where each dimension ranges from 0 to 30.
# Add variable P to the dataset and give
# values to the data.
frame = tp.active_frame()
dataset = frame.dataset
for v in ['X','Y','Z','P']:
    dataset.add_variable(v)
zone = dataset.add_ordered_zone('Zone', (30,30,30))
xx = np.linspace(0,30,30)
for v,arr in zip(['X','Y','Z'],np.meshgrid(xx,xx,xx)):
    zone.variable(v)[:] = arr.ravel()
execute_equation('{P} = -10*{X} + {Y}**2 + {Z}**2')

# Enable 3D field plot and turn on contouring
frame.plot_type = PlotType.Cartesian3D
plot = frame.plot()
plot.show_contour = True

# get a handle of the fieldmap for this zone
fmap = plot.fieldmap(dataset.zone('Zone'))

# set the active contour group to flood by variable P
fmap.contour.flood_group.variable = dataset.variable('P')

# show I and J-planes through the surface
fmap.surfaces.surfaces_to_plot = SurfacesToPlot.IJPlanes

# show only the first and last I-planes
# min defaults to 0, max defaults to -1
# we set step to -1 which is equivalent
# to the I-dimensions's max
fmap.surfaces.i_range = None,None,-1

# show J-planes at indices: [5, 15, 25]
fmap.surfaces.j_range = 5,25,10

# save image to file
tp.export_image('fieldmap_surfaces_ij.png')
../_images/fieldmap_surfaces_ij.png

Attributes

i_range IndexRange for the I dimension of ordered data.
j_range IndexRange for the J dimension of ordered data.
k_range IndexRange for the K dimension of ordered data.
surfaces_to_plot The surfaces to show.
FieldmapSurfaces.surfaces_to_plot

The surfaces to show.

Type:SurfacesToPlot

Possible values: BoundaryFaces, ExposedCellFaces, IPlanes, JPlanes, KPlanes, IJPlanes, JKPlanes, IKPlanes, IJKPlanes, All, the python built-in None.

Options such as IJKPlanes show planes from multiple dimensions. For example, the IJPlanes value shows both the I-planes and the J-planes. The following example shows a 3D field plot using faces on the boundary:

>>> from tecplot.constant import SurfacesToPlot
>>> frame.plot_type = PlotType.Cartesian3D
>>> srf = frame.plot().fieldmap(0).surfaces
>>> srf.surfaces_to_plot = SurfacesToPlot.BoundaryFaces
FieldmapSurfaces.i_range

IndexRange for the I dimension of ordered data.

Type:tuple of integers (min, max, step)

This example shows I-planes at i = [0, 2, 4, 6, 8, 10]:

>>> from tecplot.constant import SurfacesToPlot
>>> srf = frame.plot().fieldmap(0).surfaces
>>> srf.surfaces_to_plot = SurfacesToPlot.IPlanes
>>> srf.i_range = 0, 10, 2
FieldmapSurfaces.j_range

IndexRange for the J dimension of ordered data.

Type:tuple of integers (min, max, step)

This example shows all J-planes starting with j = 10 up to the maximum J-plane of the associated Zone:

>>> from tecplot.constant import SurfacesToPlot
>>> srf = frame.plot().fieldmap(0).surfaces
>>> srf.surfaces_to_plot = SurfacesToPlot.JPlanes
>>> srf.j_range = 10, None, 1
FieldmapSurfaces.k_range

IndexRange for the K dimension of ordered data.

Type:tuple of integers (min, max, step)

This example shows all K-planes starting with the first up to 5 from the last K-plane of the associated Zone:

>>> from tecplot.constant import SurfacesToPlot
>>> srf = frame.plot().fieldmap(0).surfaces
>>> srf.surfaces_to_plot = SurfacesToPlot.KPlanes
>>> srf.k_range = None, -5

FieldmapVector

class tecplot.plot.FieldmapVector(fieldmap)[source]

Field plot of arrows.

Before doing anything with vector plots, one must set the variables to be used for the (U, V, W) coordinates. This is done through the plot object. Once set, the vectors can be displayed and manipulated using this class:

import numpy as np
import tecplot as tp
from tecplot.data.operate import execute_equation
from tecplot.constant import (PlotType, PointsToPlot, VectorType,
                              ArrowheadStyle)

frame = tp.active_frame()
dataset = frame.dataset
for v in ['X','Y','Z','P','Q','R']:
    dataset.add_variable(v)
zone = dataset.add_ordered_zone('Zone', (30,30,30))
xx = np.linspace(0,30,30)
for v,arr in zip(['X','Y','Z'],np.meshgrid(xx,xx,xx)):
    zone.variable(v)[:] = arr.ravel()
execute_equation('{P} = -10 * {X}    +      {Y}**2 + {Z}**2')
execute_equation('{Q} =       {X}    - 10 * {Y}    - {Z}**2')
execute_equation('{R} =       {X}**2 +      {Y}**2 - {Z}   ')

frame.plot_type = PlotType.Cartesian3D
plot = frame.plot()
plot.contour(0).variable = dataset.variable('P')
plot.contour(0).colormap_name = 'Two Color'
plot.vector.u_variable = dataset.variable('P')
plot.vector.v_variable = dataset.variable('Q')
plot.vector.w_variable = dataset.variable('R')
plot.show_vector = True

points = plot.fieldmap(0).points
points.points_to_plot = PointsToPlot.AllNodes
points.step = (5,3,2)

vector = plot.fieldmap(0).vector
vector.show = True
vector.vector_type = VectorType.MidAtPoint
vector.arrowhead_style = ArrowheadStyle.Filled
vector.color = plot.contour(0)
vector.line_thickness = 0.4

# save image to file
tp.export_image('fieldmap_vector.png')
../_images/fieldmap_vector.png

Attributes

arrowhead_style The ArrowheadStyle drawn.
color The Color or ContourGroup to use when drawing vectors.
line_pattern The LinePattern used to draw the arrow line.
line_thickness The width of the arrow line.
pattern_length Length of the pattern used when drawing vector lines.
show Enable drawing vectors on the plot.
tangent_only Show only tangent vectors.
vector_type Anchor point of the drawn vectors.
FieldmapVector.show

Enable drawing vectors on the plot.

Type:bool

Example usage:

>>> plot.show_vector = True
>>> plot.fieldmap(0).vector.show = True
FieldmapVector.vector_type

Anchor point of the drawn vectors.

Type:VectorType

Possible values: TailAtPoint, HeadAtPoint, MidAtPoint, HeadOnly.

Example usage:

>>> from tecplot.constant import VectorType
>>> plot.fieldmap(0).vector.vector_type = VectorType.MidAtPoint
FieldmapVector.tangent_only

Show only tangent vectors.

Set to True to display only the tangent component of vectors. Tangent vectors are drawn on 3D surfaces only where it is possible to determine a vector normal to the surface. A plot where multiple surfaces intersect each other using common nodes is a case where tangent vectors are not drawn because there is more than one normal to choose from. An example of this would be a volume IJK-ordered zone where both the I and J-planes are shown. If tangent vectors cannot be drawn, then regular vectors are plotted instead.

Type:bool

Example usage:

>>> plot.fieldmap(0).vector.tangent_only = True
FieldmapVector.color

The Color or ContourGroup to use when drawing vectors.

Type:Color or ContourGroup

FieldmapVectors can be a solid color or be colored by a ContourGroup as obtained through the plot.contour property. Note that changing style on this ContourGroup will affect all other fieldmaps on the same Frame that use it. Example usage:

>>> from tecplot.constant import Color
>>> plot.fieldmap(1).vector.color = Color.Blue

Example of setting the color from a ContourGroup:

>>> plot.fieldmap(1).vector.color = plot.contour(1)
FieldmapVector.arrowhead_style

The ArrowheadStyle drawn.

Type:ArrowheadStyle

Possible values: Plain, Filled, Hollow.

Example usage:

>>> from tecplot.constant import ArrowheadStyle
>>> plot.fieldmap(0).vector.arrowhead_style = ArrowheadStyle.Filled
FieldmapVector.line_thickness

The width of the arrow line.

Type:float (percentage of Frame height)

Example usage:

>>> from tecplot.constant import LinePattern
>>> vector = plot.fieldmap(0).vector.line_thickness = 0.7
FieldmapVector.line_pattern

The LinePattern used to draw the arrow line.

Type:LinePattern

Possible values: Solid, Dashed, DashDot, Dotted, LongDash, DashDotDot.

Example usage:

>>> from tecplot.constant import LinePattern
>>> vector = plot.fieldmap(0).vector
>>> vector.line_pattern = LinePattern.DashDot
FieldmapVector.pattern_length

Length of the pattern used when drawing vector lines.

Type:float (percentage of Frame height)

Example usage:

>>> from tecplot.constant import LinePattern
>>> vector = plot.fieldmap(0).vector
>>> vector.line_pattern = LinePattern.Dashed
>>> vector.pattern_length = 3.5

Line Plots

PolarLinePlot

class tecplot.plot.PolarLinePlot(frame)[source]

Polar plot with line data and associated style through linemaps.

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.variable('R')[:] = r
zone.variable('Theta')[:] = theta

plot = frame.plot(PlotType.PolarLine)
plot.activate()
plot.axes.r_axis.max = r.max()
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.fit()

tp.export_image('plot_polar.png')
../_images/plot_polar.png

Attributes

active_linemaps Yields all active linemaps.
active_linemap_indices set of all active linemaps by index.
axes Axes style control for this plot.
legend Line legend style and placement control.
linemaps Yields linemaps matching the given pattern
num_linemaps Number of linemaps held by this plot.
show_lines Enable lines for this plot.
show_symbols Enable symbols at line vertices for this plot.
view View control of the plot relative to the frame.

Methods

activate Make this the active plot type on the parent frame.
add_linemap Add a linemap using the specified zone and variables.
delete_linemaps Clear all linemaps within this plot.
linemap Returns a specific linemap within this plot.
PolarLinePlot.activate()[source]

Make this the active plot type on the parent frame.

Example usage:

>>> from tecplot.constant import PlotType
>>> plot = frame.plot(PlotType.PolarLine)
>>> plot.activate()
PolarLinePlot.num_linemaps

Number of linemaps held by this plot.

Type:integer

Example usage:

>>> print(plot.num_linemaps)
3
PolarLinePlot.linemap(pattern)[source]

Returns a specific linemap within this plot.

Parameter:
pattern (integer or string): This is either a
zero-based index or a glob-like pattern which is matched to the linemap names. If more than one linemap shares the same name, the lowest indexed linemap will be returned.
Returns:PolarLinemap

Example usage:

>>> plot.linemap(0).error_bar.show = True
PolarLinePlot.linemaps = <function LinePlot.linemaps>
PolarLinePlot.active_linemaps

Yields all active linemaps.

Yields: XYLinemap or PolarLinemap

Example usage:

>>> from tecplot.constant import Color
>>> for lmap in plot.active_linemaps:
...     lmap.line.color = Color.Blue
PolarLinePlot.active_linemap_indices

set of all active linemaps by index.

Type:set of integers

Numbers are zero-based indices to the linemaps:

>>> active_indices = plot.active_linemap_indices
>>> active_lmaps = [plot.linemap(i) for i in active_indices]
PolarLinePlot.add_linemap(name, zone, r, theta, show=True)[source]

Add a linemap using the specified zone and variables.

Parameters:
  • name (string) – Name of the linemap which can be used for retrieving with PolarLinePlot.linemap.
  • zone (Zone) – The data to be used when drawing this linemap.
  • r (Variable) – The r variable which must be from the same Dataset as theta and zone.
  • theta (Variable) – The theta variable which must be from the same Dataset as r and zone.
  • show (boolean, optional) – Enable this linemap as soon as it’s added. (default: True)
Returns:

PolarLinemap

Example usage:

>>> lmap = plot.add_linemap('Line 1', dataset.zone('Zone'),
...                         dataset.variable('R'),
...                         dataset.variable('Theta'))
>>> lmap.line.line_thickness = 0.8
PolarLinePlot.delete_linemaps(*linemaps)

Clear all linemaps within this plot.

Parameter:
*linemaps (Linemaps, integer or string): One or
more of the following: Linemaps objects, linemap indices (zero-based) or linemap names. If none are given, all linemaps will be deleted.

Example usage:

>>> plot.delete_linemaps()
>>> print(plot.num_linemaps)
0
PolarLinePlot.show_lines

Enable lines for this plot.

Type:boolean

Example usage:

>>> plot.show_lines = True
PolarLinePlot.show_symbols

Enable symbols at line vertices for this plot.

Type:boolean

Example usage:

>>> plot.show_symbols = True
PolarLinePlot.axes

Axes style control for this plot.

Type:PolarLineAxes

Example usage:

>>> from tecplot.constant import PlotType, ThetaMode
>>> frame.plot_type = PlotType.PolarLine
>>> axes = frame.plot().axes
>>> axes.theta_mode = ThetaMode.Radians
PolarLinePlot.legend

Line legend style and placement control.

Type:LineLegend

Example usage:

>>> plot.legend.show = True
PolarLinePlot.view

View control of the plot relative to the frame.

Type:PolarView

Example usage:

>>> plot.view.fit()

XYLinePlot

class tecplot.plot.XYLinePlot(frame)[source]

Cartesian plot with line data and associated style through linemaps.

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

examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, '2D', 'random.plt')
dataset = tp.data.load_tecplot(infile)

frame = tp.active_frame()
plot = frame.plot(PlotType.XYLine)
plot.activate()
plot.show_symbols = True
plot.linemap(0).line.show = False
plot.linemap(0).symbols.fill_color = FillMode.UseLineColor

# save image to file
tp.export_image('plot_xyline.png')
../_images/plot_xyline.png

Attributes

active_linemaps Yields all active linemaps.
active_linemap_indices set of all active linemaps by index.
axes Axes style control for this plot.
legend Line legend style and placement control.
linemaps Yields linemaps matching the given pattern
num_linemaps Number of linemaps held by this plot.
show_bars Enable bar chart drawing mode for this plot.
show_error_bars Enable error bars for this plot.
show_lines Enable lines for this plot.
show_symbols Enable symbols at line vertices for this plot.
view View control of the plot relative to the frame.

Methods

activate Make this the active plot type on the parent frame.
add_linemap Add a linemap using the specified zone and variables.
delete_linemaps Clear all linemaps within this plot.
linemap Returns a specific linemap within this plot.
XYLinePlot.activate()[source]

Make this the active plot type on the parent frame.

Example usage:

>>> from tecplot.constant import PlotType
>>> plot = frame.plot(PlotType.XYLine)
>>> plot.activate()
XYLinePlot.num_linemaps

Number of linemaps held by this plot.

Type:integer

Example usage:

>>> print(plot.num_linemaps)
3
XYLinePlot.linemap(pattern)[source]

Returns a specific linemap within this plot.

Parameter:
pattern (integer or string): This is either a
zero-based index or a glob-like pattern which is matched to the linemap names. If more than one linemap shares the same name, the lowest indexed linemap will be returned.
Returns:XYLinemap

Example usage:

>>> plot.linemap(0).error_bar.show = True
XYLinePlot.linemaps = <function LinePlot.linemaps>
XYLinePlot.active_linemaps

Yields all active linemaps.

Yields: XYLinemap or PolarLinemap

Example usage:

>>> from tecplot.constant import Color
>>> for lmap in plot.active_linemaps:
...     lmap.line.color = Color.Blue
XYLinePlot.active_linemap_indices

set of all active linemaps by index.

Type:set of integers

Numbers are zero-based indices to the linemaps:

>>> active_indices = plot.active_linemap_indices
>>> active_lmaps = [plot.linemap(i) for i in active_indices]
XYLinePlot.add_linemap(name, zone, x, y, show=True)[source]

Add a linemap using the specified zone and variables.

Parameters:
  • name (string) – Name of the linemap which can be used for retrieving with XYLinePlot.linemap.
  • zone (Zone) – The data to be used when drawing this linemap.
  • x (Variable) – The x variable which must be from the same Dataset as y and zone.
  • y (Variable) – The y variable which must be from the same Dataset as x and zone.
  • show (boolean, optional) – Enable this linemap as soon as it’s added. (default: True)
Returns:

XYLinemap

Example usage:

>>> lmap = plot.add_linemap('Line 1', dataset.zone('Zone'),
...                         dataset.variable('X'),
...                         dataset.variable('Y'))
>>> lmap.line.line_thickness = 0.8
XYLinePlot.delete_linemaps(*linemaps)

Clear all linemaps within this plot.

Parameter:
*linemaps (Linemaps, integer or string): One or
more of the following: Linemaps objects, linemap indices (zero-based) or linemap names. If none are given, all linemaps will be deleted.

Example usage:

>>> plot.delete_linemaps()
>>> print(plot.num_linemaps)
0
XYLinePlot.show_bars

Enable bar chart drawing mode for this plot.

Type:boolean

Example usage:

>>> plot.show_bars = True
XYLinePlot.show_error_bars

Enable error bars for this plot.

Type:boolean

The variable to be used for error bars must be set first on at least one linemap within this plot:

>>> plot.linemap(0).error_bars.variable = dataset.variable('E')
>>> plot.show_error_bars = True
XYLinePlot.show_lines

Enable lines for this plot.

Type:boolean

Example usage:

>>> plot.show_lines = True
XYLinePlot.show_symbols

Enable symbols at line vertices for this plot.

Type:boolean

Example usage:

>>> plot.show_symbols = True
XYLinePlot.axes

Axes style control for this plot.

Type:XYLineAxes

Example usage:

>>> from tecplot.constant import PlotType, AxisMode
>>> frame.plot_type = PlotType.XYLine
>>> axes = frame.plot().axes
>>> axes.axis_mode = AxisMode.XYDependent
>>> axes.xy_ratio = 2
XYLinePlot.legend

Line legend style and placement control.

Type:LineLegend

Example usage:

>>> plot.legend.show = True
XYLinePlot.view

View control of the plot relative to the frame.

Type:LineView

Example usage:

>>> plot.view.fit()

Linemaps

PolarLinemap

class tecplot.plot.PolarLinemap(uid, plot)[source]
curve

LinemapCurve style and fitting-method control for lines.

Type:LinemapCurve
index

Zero-based integer identifier for this Linemaps.

Type:integer

Example:

>>> lmap = plot.linemap(1)
>>> print(lmap.index)
1
indices

LinemapIndices object controlling which lines are shown.

Type:LinemapIndices
line

LinemapLine style for lines to be drawn.

Type:LinemapLine
name

Name identifier of this Linemaps.

Type:string

Names are automatically assigned to each mapping. The nature of the name depends on the type of data used to create the mapping. If your data has only one dependent variable, the default is to use the zone name for the mapping. If your data has multiple dependent variables, then the default is to use the dependent variable name for the mapping. In either case each mapping is assigned a special name (&ZN& or &DN&) that is replaced with the zone or variable name when the name is displayed.

Selecting variables in a 3D finite element zone may require significant time, since the variable must be loaded over the entire zone. XY and Polar line plots are best used with linear or ordered data, or with two-dimensional finite element data.

Certain placeholder text will be replaced with values based on elements within the plot. By combining static text with these placeholders, you can construct a name in any format you like:

>>> plot.linemap(2).name = 'Zone: &ZN&'

The placeholders available are:

Zone name (&ZN&)
This will be replaced with the actual name of the zone assigned to that mapping.
Zone number (&Z#&)
This will be replaced with the actual number of the zone assigned to the mapping.
Independent variable name (&IV&)
This will be replaced with the actual name of the independent variable assigned to that mapping.
Independent variable number (&I#&)
This will be replaced with the actual number of the independent variable assigned to the mapping.
Dependent variable name (&DV&)
This will be replaced with the actual name of the dependent variable assigned to that mapping.
Dependent variable number (&D#&)
This will be replaced with the actual number of the dependent variable assigned to the mapping.
Map number (&M#&)
This will be replaced with the actual number of the mapping.
X-Axis number (&X#&)
This will be replaced with the actual number of the X-axis assigned to that mapping for XY Line plots. This option is not available for Polar Line plots.
Y-Axis number (&Y#&)
This will be replaced with the actual number of the Y-axis assigned to that mapping for XY Line plots. This option is not available for Polar Line plots.
show

Display this linemap on the plot.

Type:bool

Example usage for turning on all linemaps:

>>> for lmap in plot.linemaps():
...     lmap.show = True
show_in_legend

Show this Linemaps in the legend.

Type:LegendShow

Possible values:

LegendShow.Yes
The mapping appears in the legend even if the mapping is turned off (deactivated) or its entry in the table looks exactly like another mapping’s entry.
LegendShow.No
The mapping never appears in the legend.
LegendShow.Auto (default)
The mapping appears in the legend only when the mapping is turned on. If two mappings would result in the same entry in the legend, only one entry is shown.
sort_by

Variable be used when listing lines shown.

Type:Variable or LineMapSort.

Possible values: a Variable that is part of the associated Dataset, LineMapSort.IndependentVar, LineMapSort.DependentVar, or LineMapSort.None_.

A specific variable may be used:

>>> plot.linemap(0).sort_by = dataset.variable('P')

or the LineMapSort enumeration:

>>> from tecplot.constant import LineMapSort
>>> plot.linemap(0).sort_by = LineMapSort.DependentVar
symbols

LinemapSymbols style for markers at points along the lines.

Type:LinemapSymbols
zone

Zone this Linemaps will draw.

Type:Zone

Example usage:

>>> plot.linemap(0).zone = dataset.zone('Zone 1')
zone_index

Zero-based index of the Zone this Linemaps will draw.

Type:integer

Example usage:

>>> plot.linemap(0).zone_index = 2
r_axis

Radial axis used by this linemap.

Type:RadialLineAxis
theta_axis

Angular axis used by this linemap.

Type:PolarAngleLineAxis
function_dependency

The independent variable for function evalulation.

Type:FunctionDependency

Possible values: RIndependent, ThetaIndependent.

XYLinemap

class tecplot.plot.XYLinemap(uid, plot)[source]

Data mapping for 2D Cartesian line plots.

Linemaps connect a specific Zone/Variable combination to a line or set of lines, depending on the dimension of the data if ordered. Linemaps can share any of the axes available in the plot and orientation can be verical or horizontal by setting the independent variable with XYLinemap.function_dependency:

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

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

frame = tp.active_frame()
frame.plot_type = PlotType.XYLine
plot = frame.plot()

lmap = plot.linemap(0)
lmap.line.line_thickness = 0.8
lmap.line.color = Color.DeepRed
lmap.y_axis.title.color = Color.DeepRed

lmap = plot.linemap(1)
lmap.show = True
lmap.y_axis_index = 1
lmap.line.line_thickness = 0.8
lmap.line.color = Color.Blue
lmap.y_axis.title.color = Color.Blue

tp.export_image('linemap_xy.png')
../_images/linemap_xy.png

Attributes

bars LinemapBars style for bar charts.
curve LinemapCurve style and fitting-method control for lines.
error_bars LinemapErrorBars style for error bars.
function_dependency The independent variable for function evalulation.
index Zero-based integer identifier for this Linemaps.
indices LinemapIndices object controlling which lines are shown.
line LinemapLine style for lines to be drawn.
name Name identifier of this Linemaps.
show Display this linemap on the plot.
sort_by Variable be used when listing lines shown.
symbols LinemapSymbols style for markers at points along the lines.
x_axis X-axis used by this linemap.
x_axis_index Zero-based index of the x-axis used by this linemap.
x_variable Variable used for x-positions of this linemap.
x_variable_index Zero-based index of the Variable used for x-positions.
y_axis Y-axis used by this linemap.
y_axis_index Zero-based index of the y-axis used by this linemap.
y_variable Variable used for y-positions of this linemap.
y_variable_index Zero-based index of the Variable used for y-positions.
zone Zone this Linemaps will draw.
XYLinemap.index

Zero-based integer identifier for this Linemaps.

Type:integer

Example:

>>> lmap = plot.linemap(1)
>>> print(lmap.index)
1
XYLinemap.name

Name identifier of this Linemaps.

Type:string

Names are automatically assigned to each mapping. The nature of the name depends on the type of data used to create the mapping. If your data has only one dependent variable, the default is to use the zone name for the mapping. If your data has multiple dependent variables, then the default is to use the dependent variable name for the mapping. In either case each mapping is assigned a special name (&ZN& or &DN&) that is replaced with the zone or variable name when the name is displayed.

Selecting variables in a 3D finite element zone may require significant time, since the variable must be loaded over the entire zone. XY and Polar line plots are best used with linear or ordered data, or with two-dimensional finite element data.

Certain placeholder text will be replaced with values based on elements within the plot. By combining static text with these placeholders, you can construct a name in any format you like:

>>> plot.linemap(2).name = 'Zone: &ZN&'

The placeholders available are:

Zone name (&ZN&)
This will be replaced with the actual name of the zone assigned to that mapping.
Zone number (&Z#&)
This will be replaced with the actual number of the zone assigned to the mapping.
Independent variable name (&IV&)
This will be replaced with the actual name of the independent variable assigned to that mapping.
Independent variable number (&I#&)
This will be replaced with the actual number of the independent variable assigned to the mapping.
Dependent variable name (&DV&)
This will be replaced with the actual name of the dependent variable assigned to that mapping.
Dependent variable number (&D#&)
This will be replaced with the actual number of the dependent variable assigned to the mapping.
Map number (&M#&)
This will be replaced with the actual number of the mapping.
X-Axis number (&X#&)
This will be replaced with the actual number of the X-axis assigned to that mapping for XY Line plots. This option is not available for Polar Line plots.
Y-Axis number (&Y#&)
This will be replaced with the actual number of the Y-axis assigned to that mapping for XY Line plots. This option is not available for Polar Line plots.
XYLinemap.show

Display this linemap on the plot.

Type:bool

Example usage for turning on all linemaps:

>>> for lmap in plot.linemaps():
...     lmap.show = True
XYLinemap.zone

Zone this Linemaps will draw.

Type:Zone

Example usage:

>>> plot.linemap(0).zone = dataset.zone('Zone 1')
XYLinemap.sort_by

Variable be used when listing lines shown.

Type:Variable or LineMapSort.

Possible values: a Variable that is part of the associated Dataset, LineMapSort.IndependentVar, LineMapSort.DependentVar, or LineMapSort.None_.

A specific variable may be used:

>>> plot.linemap(0).sort_by = dataset.variable('P')

or the LineMapSort enumeration:

>>> from tecplot.constant import LineMapSort
>>> plot.linemap(0).sort_by = LineMapSort.DependentVar
XYLinemap.curve

LinemapCurve style and fitting-method control for lines.

Type:LinemapCurve
XYLinemap.indices

LinemapIndices object controlling which lines are shown.

Type:LinemapIndices
XYLinemap.line

LinemapLine style for lines to be drawn.

Type:LinemapLine
XYLinemap.symbols

LinemapSymbols style for markers at points along the lines.

Type:LinemapSymbols
XYLinemap.bars

LinemapBars style for bar charts.

Type:LinemapBars
XYLinemap.error_bars

LinemapErrorBars style for error bars.

Type:LinemapErrorBars
XYLinemap.function_dependency

The independent variable for function evalulation.

Type:FunctionDependency

Possible values: XIndependent, YIndependent.

Example usage:

>>> from tecplot.constant import FunctionDependency
>>> lmap = plot.linemap(0)
>>> lmap.function_dependency = FunctionDependency.YIndependent
XYLinemap.x_axis

X-axis used by this linemap.

Type:Line Axis

Example usage:

>>> plot.linemap(0).x_axis = plot.axes.x_axis(2)
XYLinemap.x_axis_index

Zero-based index of the x-axis used by this linemap.

Type:integer

Example usage:

>>> plot.linemap(0).x_axis_index = 2
XYLinemap.x_variable

Variable used for x-positions of this linemap.

Type:Variable

Example usage:

>>> plot.linemap(0).x_variable = dataset.variable('P')
XYLinemap.x_variable_index

Zero-based index of the Variable used for x-positions.

Type:integer

Example usage:

>>> plot.linemap(0).x_variable_index = 2
XYLinemap.y_axis

Y-axis used by this linemap.

Type:Line Axis

Example usage:

>>> plot.linemap(0).x_axis = plot.axes.y_axis(2)
XYLinemap.y_axis_index

Zero-based index of the y-axis used by this linemap.

Type:integer

Example usage:

>>> plot.linemap(0).y_axis_index = 2
XYLinemap.y_variable

Variable used for y-positions of this linemap.

Type:Variable

Example usage:

>>> plot.linemap(0).y_variable = dataset.variable('Q')
XYLinemap.y_variable_index

Zero-based index of the Variable used for y-positions.

Type:integer

Example usage:

>>> plot.linemap(0).y_variable_index = 2

LinemapLine

class tecplot.plot.LinemapLine(linemap)[source]

Style control for the line to be drawn.

This controls the style of the lines plotted for a given XYLinemap.

from os import path
import tecplot as tp
from tecplot.constant import PlotType, Color, LinePattern

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

frame = tp.active_frame()
frame.plot_type = PlotType.XYLine
plot = frame.plot()

lmap = plot.linemap(0)

line = lmap.line
line.color = Color.Blue
line.line_thickness = 1
line.line_pattern = LinePattern.LongDash
line.pattern_length = 2

# save image to file
tp.export_image('linemap_line.png')
../_images/linemap_line.png

Attributes

color Color of the line to be drawn.
line_pattern Pattern style of the line to be drawn.
line_thickness Width of the line to be drawn.
pattern_length Segment length of the repeated line pattern.
show Display this point-to-point line on the plot.
LinemapLine.show

Display this point-to-point line on the plot.

Type:bool

Example usage:

>>> plot.linemap(0).line.show = True
LinemapLine.color

Color of the line to be drawn.

Type:Color

Example usage:

>>> from tecplot.constant import Color
>>> plot.linemap(0).line.color = Color.Blue
LinemapLine.line_thickness

Width of the line to be drawn.

Type:float

Example usage:

>>> plot.linemap(0).line.line_thickness = 0.5
LinemapLine.line_pattern

Pattern style of the line to be drawn.

Type:LinePattern

Possible values: Solid, Dashed, DashDot, Dotted, LongDash, DashDotDot.

Example usage:

>>> from tecplot.constant import LinePattern
>>> lmap = plot.linemap(0)
>>> lmap.line.line_pattern = LinePattern.LongDash
LinemapLine.pattern_length

Segment length of the repeated line pattern.

Type:float

Example usage:

>>> from tecplot.constant import LinePattern
>>> lmap = plot.linemap(0)
>>> lmap.line.line_pattern = LinePattern.LongDash
>>> lmap.line.pattern_length = 3.5

LinemapCurve

class tecplot.plot.LinemapCurve(linemap)[source]

Curve-fitting of the line.

This class controls how the line is to be drawn between data points. By default, the CurveType.LineSeg option is used and straight lines are used. Setting curve_type to a fit type or spline type will replace the line segments with a smooth curve:

import numpy as np
from os import path
import tecplot as tp
from tecplot.constant import PlotType, CurveType

examples_dir = tp.session.tecplot_examples_directory()
infile = path.join(examples_dir, 'XY', 'rainfall.plt')
dataset = tp.data.load_tecplot(infile)
dataset.add_variable('Weight')

# convert error to weighting to be used for fitting below
# This converts the error to  (1 / error)
# and normalizes to the range [1,100]
zone = dataset.zone('ZONE 1')
err1 = zone.variable('Error 1')
wvar = zone.variable('Weight')
err = err1.as_numpy_array()
sigma = 1. / err
dsigma = sigma.max() - sigma.min()
sigma = (99 * (sigma - sigma.min()) / dsigma) + 1
wvar[:] = sigma

frame = tp.active_frame()
frame.plot_type = PlotType.XYLine
plot = frame.plot()

xvar = dataset.variable(0)
for lmap,var in zip(plot.linemaps(),list(dataset.variables())[1:4]):
    lmap.x_variable = xvar
    lmap.y_variable = var
    lmap.show = True

curves = [lmap.curve for lmap in plot.linemaps()]

curves[0].curve_type = CurveType.PolynomialFit
curves[0].num_points = 1000
curves[0].polynomial_order = 10

curves[1].curve_type = CurveType.PowerFit
curves[1].fit_range = 4,8
curves[1].weight_variable = dataset.variable('Weight')

curves[2].curve_type = CurveType.Spline
curves[2].spline_derivative_at_ends = 0,0

# save image to file
tp.export_image('linemap_curve.png')
../_images/linemap_curve.png

Attributes

curve_type Type of curve to draw or fit.
fit_range The range to fit and display a fitted curve.
num_points Number of points to use when drawing a fitted curve.
polynomial_order Order of the fit when set to polynomial.
spline_derivative_at_ends Clamp the derivative of the spline fit at the edges of the range.
weight_variable Variable to use for curve-fit weighting.
weight_variable_index Zero-based index of the variable to use for curve-fit weighting.
LinemapCurve.curve_type

Type of curve to draw or fit.

Type:CurveType

Possible values: LineSeg, PolynomialFit, EToRFit, PowerFit, Spline, ParaSpline.

CurveType.LineSeg (line segment, no curve-fit)
A series of linear segments connect adjacent data points. In XY Line plots, these will be line segments.
CurveType.PolynomialFit
A polynomial of order LinemapCurve.polynomial_order is fit to the data points where \(1 <= N <= 10\). \(N = 1\) is a straight-line fit.
CurveType.EToRFit (exponential curve-fit)
An exponential curve-fit that finds the best curve of the form \(Y = e^{b\cdot X+c}\) which is equivalent to \(Y = a\cdot e^{b\cdot X}\), where \(a = e^c\). To use this curve type, Y-values for this variable must be all positive or all negative. If the function dependency is set to \(X = f(Y)\) all X-values must be all positive or all negative.
CurveType.PowerFit
A power curve fit that finds the best curve of the form \(Y = e^{b \cdot \ln X + c}\) which is equivalent to \(Y = a\cdot X^b\) , where \(a = e^c\). To use this curve type, Y-values for this variable must be all positive or all negative; X-values must be all positive. If the function dependency is set to \(X = f(Y)\), X-values must be all positive or all negative, and the Y-values must all be positive.
CurveType.Spline
A smooth curve is generated that goes through every point. The spline is drawn through the data points after sorting the points into increasing values of the independent variable, resulting in a single-valued function of the independent variable. The spline may be clamped or free. With a clamped spline, you supply the derivative of the function at each end point; with a non-clamped (natural or free) spline, these derivatives are determined for you. In xy-line plots, specifying the derivative gives you control over the initial and final slopes of the curve.
CurveType.ParaSpline (parametric spline)
Creates a smooth curve as with a spline, except the assumption is that both variables are functions of the index of the data points. For example in xy-line plot, ParaSpline fits \(x = f(i)\) and \(y=g(i)\) where \(f()\) and \(g()\) are both smooth. No additional sorting of the points is performed. This spline may result in a multi-valued function of either or both axis variables.

Example usage:

>>> from tecplot.constant import CurveType
>>> plot.linemap(0).curve.curve_type = CurveType.PolynomialFit
LinemapCurve.fit_range

The range to fit and display a fitted curve.

Type:2-tuple of floats or None

Example showing how to set the limits of a polynomial fit to [5,10]:

>>> from tecplot.constant import CurveType
>>> curve = plot.linemap(0).curve
>>> curve.curve_type = CurveType.PolynomialFit
>>> curve.fit_range = 5, 10

Use None to use the whole range of independent variable:

>>> curve.fit_range = None
LinemapCurve.num_points

Number of points to use when drawing a fitted curve.

Type:integer

Example usage:

>>> from tecplot.constant import CurveType
>>> curve = plot.linemap(0).curve
>>> curve.curve_type = CurveType.PolynomialFit
>>> curve.num_points = 100
LinemapCurve.polynomial_order

Order of the fit when set to polynomial.

Type:integer (1 to 10)

A value of 1 will fit the data to a straight line. Example usage:

>>> from tecplot.constant import CurveType
>>> curve = plot.linemap(0).curve
>>> curve.curve_type = CurveType.PolynomialFit
>>> curve.polynomial_order = 4
LinemapCurve.spline_derivative_at_ends

Clamp the derivative of the spline fit at the edges of the range.

Type:2-tuple of floats or None

Example showing how to set the derivative at the limits of a spline curve to zero:

>>> from tecplot.constant import CurveType
>>> curve = plot.linemap(0).curve
>>> curve.curve_type = CurveType.Spline
>>> curve.spline_derivative_at_ends = 0, 0

Use None to allow the derivatives to float with fitting:

>>> curve.spline_derivative_at_ends = None
LinemapCurve.weight_variable

Variable to use for curve-fit weighting.

Type:Variable or None

Example usage:

>>> from tecplot.constant import CurveType
>>> curve = plot.linemap(0).curve
>>> curve.curve_type = CurveType.PolynomialFit
>>> curve.weight_variable = dataset.variable('P')

Use None to disable weighting by a variable when fitting:

>>> curve.weight_variable = None
LinemapCurve.weight_variable_index

Zero-based index of the variable to use for curve-fit weighting.

Type:integer or None

Example usage:

>>> from tecplot.constant import CurveType
>>> curve = plot.linemap(0).curve
>>> curve.curve_type = CurveType.PolynomialFit
>>> curve.weight_variable_index = 3

Use None to disable weighting by a variable when fitting:

>>> curve.weight_variable_index = None

LinemapBars

class tecplot.plot.LinemapBars(linemap)[source]

Bar chart style control.

A bar chart is an XY Line plot that uses vertical or horizontal bars placed along an axis to represent data points. Changing the function dependency of the linemap with XYLinemap.function_dependency controls the direction of the bars. By default, all mappings use \(y = f(x)\) and appear as vertical bar charts. Setting y to be the independent variable will cause the bars to be horizontal.

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

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

frame = tp.active_frame()
frame.plot_type = PlotType.XYLine
plot = frame.plot()
plot.show_bars = True

lmap = plot.linemap(0)

bars = lmap.bars
bars.show = True
bars.size = 0.6*(100 / dataset.zone(0).shape[0])
bars.fill_color = Color.Red
bars.line_color = Color.Red
bars.line_thickness = 0.01

tp.export_image('linemap_bars.png')
../_images/linemap_bars.png

Attributes

fill_color Fill color of the bars.
line_color Edge line color of the bars.
line_thickness Edge line thickness of the bars.
show Display bars on the plot for this Linemaps.
size Width of the bars.
LinemapBars.show

Display bars on the plot for this Linemaps.

Type:bool

The parent plot object must have bars enabled as well:

>>> plot.show_bars = True
>>> plot.linemap(0).bars.show = True
LinemapBars.size

Width of the bars.

Type:float (percentange of Frame width)

Example usage:

>>> plot.linemap(0).bars.size = 0.10
LinemapBars.fill_color

Fill color of the bars.

Type:Color, FillMode.UseLineColor, FillMode.UseBackgroundColor, or FillMode.None_.

Example usage:

>>> from tecplot.constant import Color, SymbolType
>>> bars = plot.linemap(0).bars
>>> bars.fill_color = Color.Red
LinemapBars.line_color

Edge line color of the bars.

Type:Color

Example usage:

>>> from tecplot.constant import Color
>>> plot.linemap(0).bars.line_color = Color.Red
LinemapBars.line_thickness

Edge line thickness of the bars.

Type:float

Example usage:

>>> plot.linemap(0).bars.line_thickness = 0.1

LinemapErrorBars

class tecplot.plot.LinemapErrorBars(linemap)[source]

Error bar style and variable assignment control.

A single XYLinemap holds a single Variable assignment for error bars. Therefore, if you wish to have separate error bars for x and y, two linemaps are required:

from math import sqrt
from os import path
import tecplot as tp
from tecplot.constant import PlotType, Color, ErrorBar

# setup dataset
frame = tp.active_frame()
ds = frame.create_dataset('Dataset')
for v in ['x', 'y', 'xerr', 'yerr']:
    ds.add_variable(v)
zone = ds.add_ordered_zone('Zone', 5)

# create some data (x, y)
zone.variable('x')[:] = [0,1,2,3,4]
zone.variable('y')[:] = [1,2,4,8,10]

# error in x is a constant
zone.variable('xerr')[:] = [0.2]*5

# error in y is the square-root of the value
zone.variable('yerr')[:] = [sqrt(y) for y in zone.variable('y')[:]]

frame.plot_type = PlotType.XYLine
plot = frame.plot()

plot.delete_linemaps()
xerr_lmap = plot.add_linemap('xerr', zone, ds.variable('x'),
                             ds.variable('y'))
yerr_lmap = plot.add_linemap('yerr', zone, ds.variable('x'),
                             ds.variable('y'))

xerr_lmap.error_bars.variable = ds.variable('xerr')
xerr_lmap.error_bars.bar_type = ErrorBar.Horz
xerr_lmap.error_bars.color = Color.Blue
xerr_lmap.error_bars.line_thickness = 0.8
xerr_lmap.error_bars.show = True

yerr_lmap.error_bars.variable = ds.variable('yerr')
yerr_lmap.error_bars.bar_type = ErrorBar.Vert
yerr_lmap.error_bars.color = Color.Blue
yerr_lmap.error_bars.line_thickness = 0.8
yerr_lmap.error_bars.show = True

plot.show_lines = False
plot.show_error_bars = True

plot.view.fit()

tp.export_image('linemap_error_bars.png')
../_images/linemap_error_bars.png

Attributes

bar_type Style of the error bar to draw.
color Color of the error bars.
endcap_size Length of the endcaps of the error bars.
line_thickness Width of the error bar lines.
show Display error bars on the plot for this Linemaps.
step Space between points to show error bars.
step_mode Space the error bars by index or frame height.
variable Variable to use for error bar sizes.
variable_index Zero-based variable index to use for error bar sizes.
LinemapErrorBars.show

Display error bars on the plot for this Linemaps.

Type:bool

The parent plot object must have error bars enables as well:

>>> plot.show_error_bars = True
>>> plot.linemap(0).error_bars.show = True
LinemapErrorBars.bar_type

Style of the error bar to draw.

Type:ErrorBar

Possible values: Up, Down, Left, Right, Horz, Vert, Cross.

Example usage:

>>> from tecplot.constant import ErrorBar
>>> plot.linemap(0).bar_type = ErrorBar.Cross
LinemapErrorBars.variable

Variable to use for error bar sizes.

Type:Variable

Example usage:

>>> ebars = plot.linemap(0).error_bars
>>> ebars.variable = dataset.variable('Err')
LinemapErrorBars.variable_index

Zero-based variable index to use for error bar sizes.

Type:integer

Example usage:

>>> plot.linemap(0).error_bars.variable_index = 3
LinemapErrorBars.color

Color of the error bars.

Type:Color

Example usage:

>>> from tecplot.constant import Color
>>> plot.linemap(0).color = Color.Red
LinemapErrorBars.line_thickness

Width of the error bar lines.

Type:float

Example usage:

>>> plot.linemap(0).line_thickness = 0.8
LinemapErrorBars.endcap_size

Length of the endcaps of the error bars.

Type:float

Example usage:

>>> plot.linemap(0).endcap_size = 2.5
LinemapErrorBars.step

Space between points to show error bars.

Type:float

The step is specified either as a percentage of the frame height or as a number of indices to skip depending on the value of LinemapErrorBars.step_mode. This example will add error bars to every third point:

>>> plot.linemap(0).error_bars.step = 3
LinemapErrorBars.step_mode

Space the error bars by index or frame height.

Type:StepMode

This example will make sure all error bars are no closer than 10% of the frame height to each other:

>>> from tecplot.constant import StepMode
>>> ebars = plot.linemap(0).error_bars
>>> ebars.step_mode = StepMode.ByFrameUnits
>>> ebars.step = 10

LinemapIndices

class tecplot.plot.LinemapIndices(linemap)[source]

Ordering and spacing of points to be drawn.

Each mapping can show either I, J, or K-varying families of lines. By default, the I-varying family of lines are displayed. You can also choose which members of the family are drawn (and using which data points), by specifying index ranges for each of I, J, and K. The index range for the varying index says which points to include in each line, and the index ranges for the other indices determine which lines in the family to include.

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

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

frame = tp.active_frame()
frame.plot_type = PlotType.XYLine
plot = frame.plot()

for lmap in list(plot.linemaps())[:3]:
    lmap.show = True
    lmap.indices.varying_index = IJKLines.I
    lmap.indices.i_range = 0,0,3

# save image to file
tp.export_image('linemap_indices.png')
../_images/linemap_indices.png

Attributes

i_range IndexRange for the I dimension of ordered data.
j_range IndexRange for the J dimension of ordered data.
k_range IndexRange for the K dimension of ordered data.
varying_index Family of lines to be drawn.
LinemapIndices.varying_index

Family of lines to be drawn.

Type:IJKLines

This is the order which varies along the lines drawn. K-varying is only available if the mapping is using an IJK-ordered zone:

>>> from tecplot.constant import IJKLines
>>> plot.linemap(0).indices.varying_index = IJKLines.J
LinemapIndices.i_range

IndexRange for the I dimension of ordered data.

Type:tuple of integers (min, max, step)

This example shows I-lines at i = [0, 2, 4, 6, 8, 10]:

>>> plot.linemap(0).indices.i_range = 0, 10, 2
LinemapIndices.j_range

IndexRange for the J dimension of ordered data.

Type:tuple of integers (min, max, step)

This example shows all J-lines starting with j = 10 up to the maximum J-line of the associated Zone:

>>> plot.linemap(0).indices.j_range = 10, None, 1
LinemapIndices.k_range

IndexRange for the K dimension of ordered data.

Type:tuple of integers (min, max, step)

This example shows all K-lines starting with the first up to 5 from the last K-line of the associated Zone:

>>> plot.linemap(0).indices.k_range = None, -5

LinemapSymbols

class tecplot.plot.LinemapSymbols(linemap)[source]

Style control for markers placed along lines.

This class allows the user to set the style of the symbols to be shown including setting a geometric shape, text character, line and fill colors and spacing. The plot-level show_symbols attribute must be enabled to show symbols in any specific linemap within the plot:

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

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

frame = tp.active_frame()
frame.plot_type = PlotType.XYLine
plot = frame.plot()
plot.show_symbols = True

for lmap in list(plot.linemaps())[:3]:
    lmap.symbols.show = True
    lmap.symbols.size = 2.5
    lmap.symbols.color = Color.Blue
    lmap.symbols.line_thickness = 0.4
    lmap.symbols.fill_color = Color.Azure

# save image to file
tp.export_image('linemap_symbols.png')
../_images/linemap_symbols.png

Attributes

color Edge or text Color of the drawn symbols.
fill_color The fill or background color.
line_thickness Width of the lines when drawing geometry symbols.
show Display symbols along the lines to be drawn.
size Size of the symbols to draw.
step Space between symbols to be shown.
step_mode Space the symbols by index or frame height.
symbol_type The SymbolType to use for this linemap.

Methods

symbol Returns a linemap symbol style object.
LinemapSymbols.show

Display symbols along the lines to be drawn.

Type:bool

The parent plot object must have symbols enabled as well:

>>> plot.show_symbols = True
>>> plot.linemap(0).symbols.show = True
LinemapSymbols.symbol_type

The SymbolType to use for this linemap.

Type:SymbolType

Possible values are: SymbolType.Geometry, SymbolType.Text.

This sets the active symbol type. Use LinemapSymbols.symbol` to access the symbol:

>>> from tecplot.constant import SymbolType
>>> linemap = plot.linemap(0)
>>> linemap.symbols.symbol_type = SymbolType.Text
>>> symbol = linemap.symbols.symbol(SymbolType.Text)
>>> symbol.text = 'a'
LinemapSymbols.symbol(symbol_type=None)[source]

Returns a linemap symbol style object.

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

Returns: TextSymbol or GeometrySymbol

Example usage:

>>> from tecplot.constant import SymbolType
>>> plot.linemap(0).symbols.symbol_type = SymbolType.Text
>>> symbol = plot.linemap(0).symbols.symbol()
>>> symbol.text = 'a'
LinemapSymbols.step

Space between symbols to be shown.

Type:float

The step is specified either as a percentage of the frame height or as a number of indices to skip depending on the value of LinemapSymbols.step_mode. This example will add symbols to every third point:

>>> plot.linemap(0).symbols.step = 3
LinemapSymbols.step_mode

Space the symbols by index or frame height.

Type:StepMode

This example will make sure all symbols are no closer than 10% of the frame height to each other:

>>> from tecplot.constant import StepMode
>>> sym = plot.linemap(0).symbols
>>> sym.step_mode = StepMode.ByFrameUnits
>>> sym.step = 10
LinemapSymbols.color

Edge or text Color of the drawn symbols.

Type:Color

Example usage:

>>> from tecplot.constant import Color
>>> plot.linemap(1).symbols.color = Color.Blue
LinemapSymbols.fill_color

The fill or background color.

Type:Color, FillMode.UseLineColor, FillMode.UseBackgroundColor, or FillMode.None_.

Example usage:

>>> from tecplot.constant import Color
>>> symbols = plot.linemap(0).symbols
>>> symbols.fill_color = Color.Yellow
LinemapSymbols.size

Size of the symbols to draw.

Type:float

Example usage:

>>> plot.linemap(0).symbols.size = 3.5
LinemapSymbols.line_thickness

Width of the lines when drawing geometry symbols.

Type:float

Example usage:

>>> from tecplot.constant import SymbolType
>>> symbols = plot.linemap(0).symbols
>>> symbols.symbol_type = SymbolType.Geometry
>>> symbols.line_thickness = 0.8
class tecplot.plot.GeometrySymbol(parent)[source]

Geometric shape for linemap symbols.

from os import path
import tecplot as tp
from tecplot.constant import PlotType, Color, GeomShape, SymbolType

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

frame = tp.active_frame()
frame.plot_type = PlotType.XYLine
plot = frame.plot()
plot.show_symbols = True

cols = [Color.DeepRed, Color.Blue, Color.Fern]
shapes = [GeomShape.Square, GeomShape.Circle, GeomShape.Del]

for lmap,color,shape in zip(plot.linemaps(), cols, shapes):
    lmap.show = True
    lmap.line.color = color

    symbols = lmap.symbols
    symbols.show = True
    symbols.size = 4.5
    symbols.color = color
    symbols.fill_color = color
    symbols.symbol_type = SymbolType.Geometry
    symbols.symbol().shape = shape

plot.view.fit()

# save image to file
tp.export_image('linemap_symbols_geometry.png')
../_images/linemap_symbols_geometry.png

Attributes

shape Geometric shape to use when plotting linemap symbols.
GeometrySymbol.shape

Geometric shape to use when plotting linemap symbols.

Type:GeomShape

Possible values: Square, Del, Grad, RTri, LTri, Diamond, Circle, Cube, Sphere, Octahedron, Point.

Example usage:

>>> from tecplot.constant import SymbolType, GeomShape
>>> symbols = plot.linemap(0).symbols
>>> symbols.symbol_type = SymbolType.Geometry
>>> symbols.symbol().shape = GeomShape.Diamond
class tecplot.plot.TextSymbol(parent)[source]

Text character for linemap symbols.

Only a single character can be used.

from os import path
import tecplot as tp
from tecplot.constant import PlotType, Color, SymbolType

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

frame = tp.active_frame()
frame.plot_type = PlotType.XYLine
plot = frame.plot()
plot.show_symbols = True

cols = [Color.DeepRed, Color.Blue, Color.Fern]
chars = ['S','D','M']

for lmap,color,character in zip(plot.linemaps(), cols, chars):
    lmap.show = True
    lmap.line.color = color

    syms = lmap.symbols
    syms.show = True
    syms.symbol_type = SymbolType.Text
    syms.size = 2.5
    syms.color = Color.White
    syms.fill_color = color
    syms.symbol().text = character

plot.view.fit()

# save image to file
tp.export_image('linemap_symbols.png')
../_images/linemap_symbols_text.png

Attributes

text The ASCII character to use as the symbol to show
typeface Type face to use when rendering text-based symbols.
TextSymbol.text

The ASCII character to use as the symbol to show

Note

This is limited to a single character.

Example usage:

>>> from tecplot.constant import SymbolType
>>> symbols = plot.linemap(0).symbols
>>> symbols.symbol_type = SymbolType.Text
>>> symbols.symbol().text = 'X'
TextSymbol.typeface

Type face to use when rendering text-based symbols.

Type:Font.Greek, Font.Math, Font.UserDefined` or Python’s built-in None (default).

If None (the default), the plot’s top-level scatter settings will determine the font used.

Example usage:

>>> from tecplot.constant import SymbolType, Font
>>> symbols = plot.linemap(0).symbols
>>> symbols.symbol_type = SymbolType.Text
>>> symbols.symbol().typeface = Font.Greek

Sketch Plots

SketchPlot

class tecplot.plot.SketchPlot(frame, *svargs)[source]

A plot space with no data attached.

import tecplot as tp
from tecplot.constant import PlotType

frame = tp.active_frame()
plot = frame.plot(PlotType.Sketch)

frame.add_text('Hello, World!', (36, 50), size=34)
plot.axes.x_axis.show = True
plot.axes.y_axis.show = True

tp.export_image('plot_sketch.png')
../_images/plot_sketch.png
activate()[source]

Make this the active plot type on the parent frame.

Example usage:

>>> from tecplot.constant import PlotType
>>> plot = frame.plot(PlotType.Sketch)
>>> plot.activate()
axes

Axes (x and y) for the sketch plot.

Type:SketchAxes

Example usage:

>>> from tecplot.constant import PlotType
>>> frame.plot_type = PlotType.Sketch
>>> frame.plot().axes.x_axis.show = True

View

Viewports

class tecplot.plot.ReadOnlyViewport(axes)[source]
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
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
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
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
class tecplot.plot.Viewport(axes)[source]
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
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
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
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
class tecplot.plot.Cartesian2DViewport(axes)[source]
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
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
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
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

Cartesian2DView

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

Cartesian3DView

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

LineView

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

PolarView

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