pytecplot 1.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pytecplot-1.5.2.dist-info/LICENSE.html +77 -0
- pytecplot-1.5.2.dist-info/METADATA +508 -0
- pytecplot-1.5.2.dist-info/RECORD +97 -0
- pytecplot-1.5.2.dist-info/WHEEL +5 -0
- pytecplot-1.5.2.dist-info/top_level.txt +1 -0
- tecplot/__init__.py +94 -0
- tecplot/annotation/__init__.py +7 -0
- tecplot/annotation/annotation.py +223 -0
- tecplot/annotation/geometry.py +369 -0
- tecplot/annotation/georeference.py +33 -0
- tecplot/annotation/image.py +185 -0
- tecplot/annotation/iter.py +105 -0
- tecplot/annotation/polyline.py +381 -0
- tecplot/annotation/text.py +744 -0
- tecplot/constant.py +401 -0
- tecplot/data/__init__.py +34 -0
- tecplot/data/array.py +645 -0
- tecplot/data/create.py +1 -0
- tecplot/data/dataset.py +1809 -0
- tecplot/data/extract.py +544 -0
- tecplot/data/face_neighbors.py +494 -0
- tecplot/data/facemap.py +814 -0
- tecplot/data/load.py +2075 -0
- tecplot/data/nodemap.py +577 -0
- tecplot/data/operate.py +928 -0
- tecplot/data/query.py +334 -0
- tecplot/data/save.py +343 -0
- tecplot/data/variable.py +280 -0
- tecplot/data/zone.py +841 -0
- tecplot/exception.py +201 -0
- tecplot/export/__init__.py +13 -0
- tecplot/export/animation.py +521 -0
- tecplot/export/export_setup.py +318 -0
- tecplot/export/image.py +577 -0
- tecplot/export/print_setup.py +218 -0
- tecplot/export/time_animation.py +607 -0
- tecplot/extension/__init__.py +14 -0
- tecplot/extension/ipython.py +68 -0
- tecplot/layout/__init__.py +20 -0
- tecplot/layout/frame.py +1285 -0
- tecplot/layout/layout.py +488 -0
- tecplot/layout/page.py +541 -0
- tecplot/legend/__init__.py +4 -0
- tecplot/legend/contour_legend.py +516 -0
- tecplot/legend/legend.py +141 -0
- tecplot/legend/line_legend.py +66 -0
- tecplot/legend/rgb_coloring_legend.py +291 -0
- tecplot/legend/scatter_legend.py +136 -0
- tecplot/macro.py +339 -0
- tecplot/plot/__init__.py +62 -0
- tecplot/plot/axes.py +881 -0
- tecplot/plot/axis.py +1350 -0
- tecplot/plot/blanking.py +584 -0
- tecplot/plot/contour.py +1302 -0
- tecplot/plot/effects.py +162 -0
- tecplot/plot/fieldmap.py +2159 -0
- tecplot/plot/grid.py +758 -0
- tecplot/plot/isosurface.py +1167 -0
- tecplot/plot/labels.py +338 -0
- tecplot/plot/linemap.py +1905 -0
- tecplot/plot/linking.py +489 -0
- tecplot/plot/plot.py +1791 -0
- tecplot/plot/rgb_coloring.py +281 -0
- tecplot/plot/scatter.py +396 -0
- tecplot/plot/slice.py +1544 -0
- tecplot/plot/streamtrace.py +1949 -0
- tecplot/plot/symbol.py +567 -0
- tecplot/plot/ticks.py +666 -0
- tecplot/plot/title.py +380 -0
- tecplot/plot/vector.py +679 -0
- tecplot/plot/view.py +868 -0
- tecplot/session/__init__.py +112 -0
- tecplot/session/aux_data.py +276 -0
- tecplot/session/config.py +92 -0
- tecplot/session/session.py +425 -0
- tecplot/session/state_changed.py +225 -0
- tecplot/session/style.py +504 -0
- tecplot/tecutil/__init__.py +16 -0
- tecplot/tecutil/arglist.py +230 -0
- tecplot/tecutil/captured_output.py +177 -0
- tecplot/tecutil/constant.py +1312 -0
- tecplot/tecutil/index_set.py +118 -0
- tecplot/tecutil/lock.py +36 -0
- tecplot/tecutil/message_pb2.py +39 -0
- tecplot/tecutil/preamble.py +54 -0
- tecplot/tecutil/stringlist.py +114 -0
- tecplot/tecutil/sv.py +1662 -0
- tecplot/tecutil/tecutil.py +12402 -0
- tecplot/tecutil/tecutil_client.py +627 -0
- tecplot/tecutil/tecutil_connector.py +937 -0
- tecplot/tecutil/tecutil_rpc.py +6845 -0
- tecplot/tecutil/util.py +332 -0
- tecplot/text/__init__.py +3 -0
- tecplot/text/font.py +224 -0
- tecplot/text/label_format.py +374 -0
- tecplot/text/textbox.py +106 -0
- tecplot/version.py +41 -0
tecplot/plot/symbol.py
ADDED
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
from builtins import str, super
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterable
|
|
4
|
+
|
|
5
|
+
from ..constant import *
|
|
6
|
+
from ..exception import *
|
|
7
|
+
from .. import session, tecutil
|
|
8
|
+
from ..tecutil import sv
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@tecutil.lock_attributes
|
|
12
|
+
class Symbol(object):
|
|
13
|
+
def __init__(self, parent, svarg=sv.SYMBOLSHAPE):
|
|
14
|
+
self.parent = parent
|
|
15
|
+
self._sv = [svarg]
|
|
16
|
+
|
|
17
|
+
def _get_style(self, rettype, *svargs):
|
|
18
|
+
return self.parent._get_style(rettype, *(self._sv + list(svargs)))
|
|
19
|
+
|
|
20
|
+
def _set_style(self, value, *svargs):
|
|
21
|
+
self.parent._set_style(value, *(self._sv + list(svargs)))
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def _symbol_type(self):
|
|
25
|
+
_stype = {
|
|
26
|
+
True: SymbolType.Text,
|
|
27
|
+
False: SymbolType.Geometry}
|
|
28
|
+
isascii = self._get_style(bool, sv.ISASCII)
|
|
29
|
+
if isinstance(isascii, Iterable):
|
|
30
|
+
return tuple([_stype[i] for i in isascii])
|
|
31
|
+
else:
|
|
32
|
+
return _stype[isascii]
|
|
33
|
+
|
|
34
|
+
@_symbol_type.setter
|
|
35
|
+
def _symbol_type(self, value):
|
|
36
|
+
value = SymbolType(value)
|
|
37
|
+
if value is SymbolType.Text:
|
|
38
|
+
self._set_style(True, sv.ISASCII)
|
|
39
|
+
else:
|
|
40
|
+
self._set_style(False, sv.ISASCII)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class TextSymbol(Symbol):
|
|
44
|
+
"""Text character for linemap symbols.
|
|
45
|
+
|
|
46
|
+
Only a single character can be used.
|
|
47
|
+
|
|
48
|
+
.. code-block:: python
|
|
49
|
+
:emphasize-lines: 23,28
|
|
50
|
+
|
|
51
|
+
from os import path
|
|
52
|
+
import tecplot as tp
|
|
53
|
+
from tecplot.constant import PlotType, Color, SymbolType, FillMode
|
|
54
|
+
|
|
55
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
56
|
+
infile = path.join(examples_dir, 'SimpleData', 'Rainfall.dat')
|
|
57
|
+
dataset = tp.data.load_tecplot(infile)
|
|
58
|
+
|
|
59
|
+
frame = tp.active_frame()
|
|
60
|
+
frame.plot_type = PlotType.XYLine
|
|
61
|
+
plot = frame.plot()
|
|
62
|
+
plot.show_symbols = True
|
|
63
|
+
|
|
64
|
+
cols = [Color.DeepRed, Color.Blue, Color.Fern]
|
|
65
|
+
chars = ['S','D','M']
|
|
66
|
+
|
|
67
|
+
lmaps = plot.linemaps()
|
|
68
|
+
lmaps.show = True
|
|
69
|
+
lmaps.symbols.show = True
|
|
70
|
+
lmaps.symbols.size = 2.5
|
|
71
|
+
lmaps.symbols.color = Color.White
|
|
72
|
+
lmaps.symbols.fill_mode = FillMode.UseSpecificColor
|
|
73
|
+
lmaps.symbols.symbol_type = SymbolType.Text
|
|
74
|
+
|
|
75
|
+
for lmap, color, character in zip(lmaps, cols, chars):
|
|
76
|
+
lmap.line.color = color
|
|
77
|
+
lmap.symbols.fill_color = color
|
|
78
|
+
lmap.symbols.symbol().text = character
|
|
79
|
+
|
|
80
|
+
plot.view.fit()
|
|
81
|
+
|
|
82
|
+
# save image to file
|
|
83
|
+
tp.export.save_png('linemap_symbols_text.png', 600, supersample=3)
|
|
84
|
+
|
|
85
|
+
.. figure:: /_static/images/linemap_symbols_text.png
|
|
86
|
+
:width: 300px
|
|
87
|
+
:figwidth: 300px
|
|
88
|
+
"""
|
|
89
|
+
def __init__(self, parent, svarg=sv.SYMBOLSHAPE):
|
|
90
|
+
super().__init__(parent, svarg)
|
|
91
|
+
self._sv += [sv.ASCIISHAPE]
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def text(self):
|
|
95
|
+
"""The ASCII character to use as the symbol to show
|
|
96
|
+
|
|
97
|
+
.. note:: This is limited to a single character.
|
|
98
|
+
|
|
99
|
+
Example usage::
|
|
100
|
+
|
|
101
|
+
>>> from tecplot.constant import SymbolType
|
|
102
|
+
>>> symbols = plot.linemap(0).symbols
|
|
103
|
+
>>> symbols.symbol_type = SymbolType.Text
|
|
104
|
+
>>> symbols.symbol().text = 'X'
|
|
105
|
+
"""
|
|
106
|
+
return self._get_style(str, sv.ASCIICHAR)
|
|
107
|
+
|
|
108
|
+
@text.setter
|
|
109
|
+
def text(self, value):
|
|
110
|
+
self._set_style(str(value)[0], sv.ASCIICHAR)
|
|
111
|
+
|
|
112
|
+
@property
|
|
113
|
+
def use_base_font(self):
|
|
114
|
+
"""`bool`: Use the base typeface when rendering text-based symbols.
|
|
115
|
+
|
|
116
|
+
When `False`, the ``font_override`` attribute takes effect::
|
|
117
|
+
|
|
118
|
+
>>> from tecplot.constant import SymbolType, Font
|
|
119
|
+
>>> symbols = plot.linemap(0).symbols
|
|
120
|
+
>>> symbols.symbol_type = SymbolType.Text
|
|
121
|
+
>>> symbols.symbol().use_base_font = False
|
|
122
|
+
>>> symbols.symbol().font_override = Font.Greek
|
|
123
|
+
"""
|
|
124
|
+
return self._get_style(bool, sv.USEBASEFONT)
|
|
125
|
+
|
|
126
|
+
@use_base_font.setter
|
|
127
|
+
def use_base_font(self, value):
|
|
128
|
+
self._set_style(bool(value), sv.USEBASEFONT)
|
|
129
|
+
|
|
130
|
+
@property
|
|
131
|
+
def font_override(self):
|
|
132
|
+
"""`constant.Font`: Typeface to use when rendering text-based symbols.
|
|
133
|
+
|
|
134
|
+
Possible values: `constant.Font.Greek`, `constant.Font.Math` or
|
|
135
|
+
`constant.Font.UserDefined`.
|
|
136
|
+
|
|
137
|
+
The ``use_base_font`` attribute must be set to `False`::
|
|
138
|
+
|
|
139
|
+
>>> from tecplot.constant import SymbolType, Font
|
|
140
|
+
>>> symbols = plot.linemap(0).symbols
|
|
141
|
+
>>> symbols.symbol_type = SymbolType.Text
|
|
142
|
+
>>> symbols.symbol().use_base_font = False
|
|
143
|
+
>>> symbols.symbol().font_override = Font.Greek
|
|
144
|
+
"""
|
|
145
|
+
return self._get_style(Font, sv.FONTOVERRIDE)
|
|
146
|
+
|
|
147
|
+
@font_override.setter
|
|
148
|
+
def font_override(self, value):
|
|
149
|
+
if __debug__:
|
|
150
|
+
valid_typefaces = [Font.Greek, Font.Math, Font.UserDefined]
|
|
151
|
+
if value not in valid_typefaces:
|
|
152
|
+
msg = 'font_override must be one of: '
|
|
153
|
+
msg += ' '.join(str(x) for x in valid_typefaces)
|
|
154
|
+
raise TecplotLogicError(msg)
|
|
155
|
+
self._set_style(Font(value), sv.FONTOVERRIDE)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class TextScatterSymbol(TextSymbol):
|
|
159
|
+
"""Text character for scatter plots.
|
|
160
|
+
|
|
161
|
+
Only a single character can be used.
|
|
162
|
+
|
|
163
|
+
.. code-block:: python
|
|
164
|
+
:emphasize-lines: 14,23-26,29-30
|
|
165
|
+
|
|
166
|
+
from os import path
|
|
167
|
+
import tecplot as tp
|
|
168
|
+
from tecplot.constant import (Color, PlotType, PointsToPlot, SymbolType,
|
|
169
|
+
GeomShape, FillMode)
|
|
170
|
+
|
|
171
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
172
|
+
infile = path.join(examples_dir, 'SimpleData', 'HeatExchanger.plt')
|
|
173
|
+
dataset = tp.data.load_tecplot(infile)
|
|
174
|
+
|
|
175
|
+
frame = tp.active_frame()
|
|
176
|
+
frame.plot_type = PlotType.Cartesian2D
|
|
177
|
+
plot = frame.plot()
|
|
178
|
+
plot.show_shade = True
|
|
179
|
+
plot.show_scatter = True
|
|
180
|
+
|
|
181
|
+
# get handle to a collection of all fieldmaps
|
|
182
|
+
fmaps = plot.fieldmaps()
|
|
183
|
+
|
|
184
|
+
fmaps.points.points_to_plot = PointsToPlot.SurfaceCellCenters
|
|
185
|
+
fmaps.points.step = (4,4)
|
|
186
|
+
fmaps.shade.color = Color.LightBlue
|
|
187
|
+
|
|
188
|
+
fmaps.scatter.fill_mode = FillMode.UseSpecificColor
|
|
189
|
+
fmaps.scatter.fill_color = Color.Yellow
|
|
190
|
+
fmaps.scatter.size = 3
|
|
191
|
+
fmaps.scatter.symbol_type = SymbolType.Text
|
|
192
|
+
|
|
193
|
+
for i, fmap in enumerate(fmaps):
|
|
194
|
+
fmap.scatter.color = Color((i % 4) + 13)
|
|
195
|
+
fmap.scatter.symbol().text = hex(i)[-1]
|
|
196
|
+
|
|
197
|
+
tp.export.save_png('fieldmap_scatter_text.png', 600, supersample=3)
|
|
198
|
+
|
|
199
|
+
.. figure:: /_static/images/fieldmap_scatter_text.png
|
|
200
|
+
:width: 300px
|
|
201
|
+
:figwidth: 300px
|
|
202
|
+
"""
|
|
203
|
+
|
|
204
|
+
@tecutil.inherited_property(TextSymbol)
|
|
205
|
+
def text(self):
|
|
206
|
+
"""The ASCII character to use as the symbol to show
|
|
207
|
+
|
|
208
|
+
.. note:: This is limited to a single character.
|
|
209
|
+
|
|
210
|
+
Example usage::
|
|
211
|
+
|
|
212
|
+
>>> from tecplot.constant import SymbolType
|
|
213
|
+
>>> scatter = plot.fieldmap(0).scatter
|
|
214
|
+
>>> scatter.symbol_type = SymbolType.Text
|
|
215
|
+
>>> scatter.symbol().text = 'X'
|
|
216
|
+
"""
|
|
217
|
+
|
|
218
|
+
@tecutil.inherited_property(TextSymbol)
|
|
219
|
+
def use_base_font(self):
|
|
220
|
+
"""`bool`: Use the base typeface when rendering text-based scatter.
|
|
221
|
+
|
|
222
|
+
When `False`, the ``font_override`` attribute takes effect::
|
|
223
|
+
|
|
224
|
+
>>> from tecplot.constant import SymbolType, Font
|
|
225
|
+
>>> scatter = plot.fieldmap(0).scatter
|
|
226
|
+
>>> scatter.symbol_type = SymbolType.Text
|
|
227
|
+
>>> scatter.symbol().use_base_font = False
|
|
228
|
+
>>> scatter.symbol().font_override = Font.Greek
|
|
229
|
+
"""
|
|
230
|
+
|
|
231
|
+
@tecutil.inherited_property(TextSymbol)
|
|
232
|
+
def font_override(self):
|
|
233
|
+
"""`constant.Font`: Typeface to use when rendering text-based scatter.
|
|
234
|
+
|
|
235
|
+
Possible values: `constant.Font.Greek`, `constant.Font.Math` or
|
|
236
|
+
`constant.Font.UserDefined`.
|
|
237
|
+
|
|
238
|
+
The ``use_base_font`` attribute must be set to `False`::
|
|
239
|
+
|
|
240
|
+
>>> from tecplot.constant import SymbolType, Font
|
|
241
|
+
>>> scatter = plot.fieldmap(0).scatter
|
|
242
|
+
>>> scatter.symbol_type = SymbolType.Text
|
|
243
|
+
>>> scatter.symbol().use_base_font = False
|
|
244
|
+
>>> scatter.symbol().font_override = Font.Math
|
|
245
|
+
"""
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
class GeometrySymbol(Symbol):
|
|
249
|
+
"""Geometric shape for linemap symbols.
|
|
250
|
+
|
|
251
|
+
.. code-block:: python
|
|
252
|
+
:emphasize-lines: 24,30
|
|
253
|
+
|
|
254
|
+
from os import path
|
|
255
|
+
import tecplot as tp
|
|
256
|
+
from tecplot.constant import (PlotType, Color, GeomShape, SymbolType,
|
|
257
|
+
FillMode)
|
|
258
|
+
|
|
259
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
260
|
+
infile = path.join(examples_dir, 'SimpleData', 'Rainfall.dat')
|
|
261
|
+
dataset = tp.data.load_tecplot(infile)
|
|
262
|
+
|
|
263
|
+
frame = tp.active_frame()
|
|
264
|
+
frame.plot_type = PlotType.XYLine
|
|
265
|
+
plot = frame.plot()
|
|
266
|
+
plot.show_symbols = True
|
|
267
|
+
|
|
268
|
+
cols = [Color.DeepRed, Color.Blue, Color.Fern]
|
|
269
|
+
shapes = [GeomShape.Square, GeomShape.Circle, GeomShape.Del]
|
|
270
|
+
|
|
271
|
+
lmaps = plot.linemaps()
|
|
272
|
+
|
|
273
|
+
lmaps.show = True
|
|
274
|
+
lmaps.symbols.show = True
|
|
275
|
+
lmaps.symbols.size = 4.5
|
|
276
|
+
lmaps.symbols.fill_mode = FillMode.UseSpecificColor
|
|
277
|
+
lmaps.symbols.symbol_type = SymbolType.Geometry
|
|
278
|
+
|
|
279
|
+
for lmap, color, shape in zip(lmaps, cols, shapes):
|
|
280
|
+
lmap.line.color = color
|
|
281
|
+
lmap.symbols.color = color
|
|
282
|
+
lmap.symbols.fill_color = color
|
|
283
|
+
lmap.symbols.symbol().shape = shape
|
|
284
|
+
|
|
285
|
+
plot.view.fit()
|
|
286
|
+
|
|
287
|
+
# save image to file
|
|
288
|
+
tp.export.save_png('linemap_symbols_geometry.png', 600, supersample=3)
|
|
289
|
+
|
|
290
|
+
.. figure:: /_static/images/linemap_symbols_geometry.png
|
|
291
|
+
:width: 300px
|
|
292
|
+
:figwidth: 300px
|
|
293
|
+
"""
|
|
294
|
+
|
|
295
|
+
@property
|
|
296
|
+
def shape(self):
|
|
297
|
+
"""`GeomShape`: Geometric shape to use when plotting linemap symbols.
|
|
298
|
+
|
|
299
|
+
Possible values: `Square <GeomShape.Square>`, `Del`, `Grad`, `RTri`,
|
|
300
|
+
`LTri`, `Diamond`, `Circle <GeomShape.Circle>`, `Cube`, `Sphere`,
|
|
301
|
+
`Octahedron`, `Point <GeomShape.Point>`.
|
|
302
|
+
|
|
303
|
+
Example usage::
|
|
304
|
+
|
|
305
|
+
>>> from tecplot.constant import SymbolType, GeomShape
|
|
306
|
+
>>> symbols = plot.linemap(0).symbols
|
|
307
|
+
>>> symbols.symbol_type = SymbolType.Geometry
|
|
308
|
+
>>> symbols.symbol().shape = GeomShape.Diamond
|
|
309
|
+
"""
|
|
310
|
+
return self._get_style(GeomShape, sv.GEOMSHAPE)
|
|
311
|
+
|
|
312
|
+
@shape.setter
|
|
313
|
+
def shape(self, value):
|
|
314
|
+
self._set_style(GeomShape(value), sv.GEOMSHAPE)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
class GeometryScatterSymbol(GeometrySymbol):
|
|
318
|
+
"""Geometric shape for scatter plots.
|
|
319
|
+
|
|
320
|
+
.. code-block:: python
|
|
321
|
+
:emphasize-lines: 13,22-26,29-31
|
|
322
|
+
|
|
323
|
+
from os import path
|
|
324
|
+
import tecplot as tp
|
|
325
|
+
from tecplot.constant import (Color, PlotType, PointsToPlot, SymbolType,
|
|
326
|
+
GeomShape, FillMode)
|
|
327
|
+
|
|
328
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
329
|
+
infile = path.join(examples_dir, 'SimpleData', 'HeatExchanger.plt')
|
|
330
|
+
dataset = tp.data.load_tecplot(infile)
|
|
331
|
+
|
|
332
|
+
frame = tp.active_frame()
|
|
333
|
+
frame.plot_type = PlotType.Cartesian2D
|
|
334
|
+
plot = frame.plot()
|
|
335
|
+
plot.show_scatter = True
|
|
336
|
+
|
|
337
|
+
# get handle to a collection of all fieldmaps
|
|
338
|
+
fmaps = plot.fieldmaps()
|
|
339
|
+
|
|
340
|
+
points = fmaps.points
|
|
341
|
+
points.points_to_plot = PointsToPlot.SurfaceCellCenters
|
|
342
|
+
points.step = (2,2)
|
|
343
|
+
|
|
344
|
+
scatter = fmaps.scatter
|
|
345
|
+
scatter.fill_mode = FillMode.UseSpecificColor
|
|
346
|
+
scatter.size = 2
|
|
347
|
+
scatter.line_thickness = 0.5
|
|
348
|
+
scatter.symbol_type = SymbolType.Geometry
|
|
349
|
+
|
|
350
|
+
for i, fmap in enumerate(fmaps):
|
|
351
|
+
fmap.scatter.symbol().shape = GeomShape(i%7)
|
|
352
|
+
fmap.scatter.color = Color(i)
|
|
353
|
+
fmap.scatter.fill_color = Color(i + plot.num_fieldmaps)
|
|
354
|
+
|
|
355
|
+
tp.export.save_png('fieldmap_scatter_geometry.png', 600, supersample=3)
|
|
356
|
+
|
|
357
|
+
.. figure:: /_static/images/fieldmap_scatter_geometry.png
|
|
358
|
+
:width: 300px
|
|
359
|
+
:figwidth: 300px
|
|
360
|
+
"""
|
|
361
|
+
|
|
362
|
+
@tecutil.inherited_property(GeometrySymbol)
|
|
363
|
+
def shape(self):
|
|
364
|
+
"""`GeomShape`: Geometric shape to use when plotting scatter points.
|
|
365
|
+
|
|
366
|
+
Possible values: `Square <GeomShape.Square>`, `Del`, `Grad`, `RTri`,
|
|
367
|
+
`LTri`, `Diamond`, `Circle <GeomShape.Circle>`, `Cube`, `Sphere`,
|
|
368
|
+
`Octahedron`, `Point <GeomShape.Point>`.
|
|
369
|
+
|
|
370
|
+
Example usage::
|
|
371
|
+
|
|
372
|
+
>>> from tecplot.constant import SymbolType, GeomShape
|
|
373
|
+
>>> scatter = plot.fieldmap(0).scatter
|
|
374
|
+
>>> scatter.symbol_type = SymbolType.Geometry
|
|
375
|
+
>>> scatter.symbol().shape = GeomShape.Diamond
|
|
376
|
+
"""
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
class ScatterReferenceSymbol(session.Style):
|
|
380
|
+
"""Reference symbol for scatter plots.
|
|
381
|
+
|
|
382
|
+
.. note::
|
|
383
|
+
The reference scatter symbol is only shown when the scatter symbols are
|
|
384
|
+
sized by a `Variable` in the `Dataset <data.Dataset>`.
|
|
385
|
+
|
|
386
|
+
.. code-block:: python
|
|
387
|
+
:emphasize-lines: 17-22
|
|
388
|
+
|
|
389
|
+
from os import path
|
|
390
|
+
import tecplot as tp
|
|
391
|
+
from tecplot.constant import *
|
|
392
|
+
|
|
393
|
+
examples_dir = tp.session.tecplot_examples_directory()
|
|
394
|
+
infile = path.join(examples_dir, 'SimpleData', 'HeatExchanger.plt')
|
|
395
|
+
dataset = tp.data.load_tecplot(infile)
|
|
396
|
+
|
|
397
|
+
frame = tp.active_frame()
|
|
398
|
+
frame.plot_type = PlotType.Cartesian2D
|
|
399
|
+
plot = frame.plot()
|
|
400
|
+
plot.contour(0).variable = dataset.variable('T(K)')
|
|
401
|
+
plot.show_scatter = True
|
|
402
|
+
|
|
403
|
+
plot.scatter.variable = dataset.variable('P(N)')
|
|
404
|
+
|
|
405
|
+
plot.scatter.reference_symbol.show = True
|
|
406
|
+
plot.scatter.reference_symbol.symbol().shape = GeomShape.Circle
|
|
407
|
+
plot.scatter.reference_symbol.magnitude = plot.scatter.variable.max()
|
|
408
|
+
plot.scatter.reference_symbol.color = Color.Green
|
|
409
|
+
plot.scatter.reference_symbol.fill_color = Color.Green
|
|
410
|
+
plot.scatter.reference_symbol.position = (20, 81)
|
|
411
|
+
|
|
412
|
+
frame.add_text('Size of dots indicate relative pressure', (23, 80))
|
|
413
|
+
|
|
414
|
+
for z in dataset.zones():
|
|
415
|
+
scatter = plot.fieldmap(z).scatter
|
|
416
|
+
scatter.symbol_type = SymbolType.Geometry
|
|
417
|
+
scatter.symbol().shape = GeomShape.Circle
|
|
418
|
+
scatter.fill_mode = FillMode.UseSpecificColor
|
|
419
|
+
scatter.fill_color = plot.contour(0)
|
|
420
|
+
scatter.color = plot.contour(0)
|
|
421
|
+
scatter.size_by_variable = True
|
|
422
|
+
|
|
423
|
+
# ensure consistent output between interactive (connected) and batch
|
|
424
|
+
plot.contour(0).levels.reset_to_nice()
|
|
425
|
+
|
|
426
|
+
tp.export.save_png('scatter_reference_symbol.png')
|
|
427
|
+
|
|
428
|
+
.. figure:: /_static/images/scatter_reference_symbol.png
|
|
429
|
+
:width: 300px
|
|
430
|
+
:figwidth: 300px
|
|
431
|
+
"""
|
|
432
|
+
def __init__(self, scatter):
|
|
433
|
+
self.scatter = scatter
|
|
434
|
+
super().__init__(scatter._sv, sv.REFSCATSYMBOL, **scatter._kw)
|
|
435
|
+
|
|
436
|
+
@property
|
|
437
|
+
def show(self):
|
|
438
|
+
"""`bool`: Display a reference scatter symbol on the plot.
|
|
439
|
+
|
|
440
|
+
Example usage::
|
|
441
|
+
|
|
442
|
+
>>> plot.fieldmap(0).scatter.size_by_variable = True
|
|
443
|
+
>>> plot.scatter.variable = dataset.variable('s')
|
|
444
|
+
>>> plot.scatter.reference_symbol.show = True
|
|
445
|
+
"""
|
|
446
|
+
return self._get_style(bool, sv.SHOW)
|
|
447
|
+
|
|
448
|
+
@show.setter
|
|
449
|
+
def show(self, value):
|
|
450
|
+
self._set_style(bool(value), sv.SHOW)
|
|
451
|
+
|
|
452
|
+
@property
|
|
453
|
+
def color(self):
|
|
454
|
+
"""`Color`: The `Color` of the reference symbol.
|
|
455
|
+
|
|
456
|
+
Example usage::
|
|
457
|
+
|
|
458
|
+
>>> from tecplot.constant import Color
|
|
459
|
+
>>> plot.scatter.reference_symbol.color = Color.Blue
|
|
460
|
+
"""
|
|
461
|
+
return self._get_style(Color, sv.COLOR)
|
|
462
|
+
|
|
463
|
+
@color.setter
|
|
464
|
+
def color(self, value):
|
|
465
|
+
self._set_style(Color(value), sv.COLOR)
|
|
466
|
+
|
|
467
|
+
@property
|
|
468
|
+
def filled(self):
|
|
469
|
+
"""`bool`: Fill the background area behind the reference symbol.
|
|
470
|
+
|
|
471
|
+
The background can be filled with a color or disabled (made
|
|
472
|
+
transparent) by setting this property to `False`::
|
|
473
|
+
|
|
474
|
+
>>> plot.scatter.reference_symbol.filled = True
|
|
475
|
+
"""
|
|
476
|
+
return self._get_style(bool, sv.ISFILLED)
|
|
477
|
+
|
|
478
|
+
@filled.setter
|
|
479
|
+
def filled(self, value):
|
|
480
|
+
self._set_style(bool(value), sv.ISFILLED)
|
|
481
|
+
|
|
482
|
+
@property
|
|
483
|
+
def fill_color(self):
|
|
484
|
+
"""`Color`: The fill `Color` of the reference symbol.
|
|
485
|
+
|
|
486
|
+
Example usage::
|
|
487
|
+
|
|
488
|
+
>>> from tecplot.constant import Color
|
|
489
|
+
>>> plot.scatter.reference_symbol.fill_color = Color.Blue
|
|
490
|
+
"""
|
|
491
|
+
return self._get_style(Color, sv.FILLCOLOR)
|
|
492
|
+
|
|
493
|
+
@fill_color.setter
|
|
494
|
+
def fill_color(self, value):
|
|
495
|
+
self._set_style(Color(value), sv.FILLCOLOR)
|
|
496
|
+
|
|
497
|
+
@property
|
|
498
|
+
def position(self):
|
|
499
|
+
"""`tuple`: The :math:`(x, y)` position of the reference symbol.
|
|
500
|
+
|
|
501
|
+
This position is in `Frame <layout.Frame>` percentage units::
|
|
502
|
+
|
|
503
|
+
>>> plot.scatter.reference_symbol.position = (50, 50)
|
|
504
|
+
"""
|
|
505
|
+
return session.XY(self, sv.XYPOS)
|
|
506
|
+
|
|
507
|
+
@position.setter
|
|
508
|
+
def position(self, values):
|
|
509
|
+
session.XY(self, sv.XYPOS)[:] = values
|
|
510
|
+
|
|
511
|
+
@property
|
|
512
|
+
def magnitude(self):
|
|
513
|
+
"""`float`: Symbol size relative to data variable ranges.
|
|
514
|
+
|
|
515
|
+
Example usage::
|
|
516
|
+
|
|
517
|
+
>>> plot.scatter.reference_symbol.magnitude = 10.0
|
|
518
|
+
"""
|
|
519
|
+
return self._get_style(float, sv.MAGNITUDE)
|
|
520
|
+
|
|
521
|
+
@magnitude.setter
|
|
522
|
+
def magnitude(self, value):
|
|
523
|
+
self._set_style(float(value), sv.MAGNITUDE)
|
|
524
|
+
|
|
525
|
+
@property
|
|
526
|
+
def line_thickness(self):
|
|
527
|
+
"""`float`: Edge line thickness for geometry reference symbols.
|
|
528
|
+
|
|
529
|
+
Example usage::
|
|
530
|
+
|
|
531
|
+
>>> plot.scatter.reference_symbol.line_thickness = 2.5
|
|
532
|
+
"""
|
|
533
|
+
return self._get_style(float, sv.LINETHICKNESS)
|
|
534
|
+
|
|
535
|
+
@line_thickness.setter
|
|
536
|
+
def line_thickness(self, value):
|
|
537
|
+
self._set_style(float(value), sv.LINETHICKNESS)
|
|
538
|
+
|
|
539
|
+
@property
|
|
540
|
+
def symbol_type(self):
|
|
541
|
+
"""`SymbolType`: The type of symbol to display.
|
|
542
|
+
|
|
543
|
+
Example usage::
|
|
544
|
+
|
|
545
|
+
>>> from tecplot.constant import SymbolType
|
|
546
|
+
>>> reference_symbol = plot.scatter.reference_symbol
|
|
547
|
+
>>> reference_symbol.symbol_type = SymbolType.Text
|
|
548
|
+
"""
|
|
549
|
+
return Symbol(self)._symbol_type
|
|
550
|
+
|
|
551
|
+
@symbol_type.setter
|
|
552
|
+
def symbol_type(self, value):
|
|
553
|
+
Symbol(self)._symbol_type = value
|
|
554
|
+
|
|
555
|
+
def symbol(self, symbol_type=None):
|
|
556
|
+
"""`TextSymbol` or `GeometrySymbol`: Style control the displayed symbol.
|
|
557
|
+
|
|
558
|
+
Example usage::
|
|
559
|
+
|
|
560
|
+
>>> from tecplot.constant import GeomShape
|
|
561
|
+
>>> reference_symbol = plot.scatter.reference_symbol
|
|
562
|
+
>>> reference_symbol.symbol = GeomShape.Sphere
|
|
563
|
+
"""
|
|
564
|
+
_dispatch = {
|
|
565
|
+
SymbolType.Text: TextSymbol,
|
|
566
|
+
SymbolType.Geometry: GeometrySymbol}
|
|
567
|
+
return _dispatch[symbol_type or self.symbol_type](self)
|