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
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
from builtins import int, str, super
|
|
2
|
+
|
|
3
|
+
from ..tecutil import _tecutil
|
|
4
|
+
from ..constant import *
|
|
5
|
+
from ..exception import *
|
|
6
|
+
from ..tecutil import Index, StringList, flatten_args, lock, sv
|
|
7
|
+
from .. import session
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class LabelFormat(session.Style):
|
|
11
|
+
"""Formatting of numbers shown along in axes and in legends.
|
|
12
|
+
|
|
13
|
+
This example shows how to format tick label along an axis:
|
|
14
|
+
|
|
15
|
+
.. code-block:: python
|
|
16
|
+
:emphasize-lines: 31-36
|
|
17
|
+
|
|
18
|
+
from datetime import datetime
|
|
19
|
+
import tecplot as tp
|
|
20
|
+
from tecplot.constant import PlotType, AxisMode, AxisAlignment, NumberFormat
|
|
21
|
+
|
|
22
|
+
tp.new_layout()
|
|
23
|
+
plot = tp.active_frame().plot(tp.constant.PlotType.Sketch)
|
|
24
|
+
plot.activate()
|
|
25
|
+
|
|
26
|
+
# setup the plot area margins
|
|
27
|
+
plot.axes.viewport.left = 10
|
|
28
|
+
plot.axes.viewport.right = 90
|
|
29
|
+
|
|
30
|
+
# show the x-axis, set the title, and alignment with the viewport
|
|
31
|
+
xaxis = plot.axes.x_axis
|
|
32
|
+
xaxis.show = True
|
|
33
|
+
xaxis.title.text = 'Negative numbers in parentheses'
|
|
34
|
+
xaxis.title.offset = 20
|
|
35
|
+
xaxis.line.alignment = AxisAlignment.WithViewport
|
|
36
|
+
xaxis.line.position = 50
|
|
37
|
+
|
|
38
|
+
# set limits, tick placement and tick label properties
|
|
39
|
+
xaxis.ticks.auto_spacing = False
|
|
40
|
+
xaxis.min, xaxis.max = -5.123e-5, 5.234e-5
|
|
41
|
+
xaxis.ticks.spacing = (xaxis.max - xaxis.min) / 6
|
|
42
|
+
xaxis.ticks.spacing_anchor = 0
|
|
43
|
+
xaxis.tick_labels.angle = 45
|
|
44
|
+
xaxis.tick_labels.offset = 3
|
|
45
|
+
|
|
46
|
+
# format the tick labels in superscript form. example: 1.234x10^5
|
|
47
|
+
# format negative numbers to use parentheses instead of a negative sign
|
|
48
|
+
xformat = xaxis.tick_labels.format
|
|
49
|
+
xformat.format_type = NumberFormat.SuperScript
|
|
50
|
+
xformat.precision = 3
|
|
51
|
+
xformat.show_negative_sign = False
|
|
52
|
+
xformat.negative_prefix = '('
|
|
53
|
+
xformat.negative_suffix = ')'
|
|
54
|
+
|
|
55
|
+
tp.export.save_png('label_format.png', 600, supersample=3)
|
|
56
|
+
|
|
57
|
+
.. figure:: /_static/images/label_format.png
|
|
58
|
+
:width: 300px
|
|
59
|
+
:figwidth: 300px
|
|
60
|
+
"""
|
|
61
|
+
def __init__(self, labels):
|
|
62
|
+
self.labels = labels
|
|
63
|
+
super().__init__(labels._sv, sv.NUMFORMAT, **labels._kw)
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def format_type(self):
|
|
67
|
+
"""`NumberFormat`: Type of number formatting to use.
|
|
68
|
+
|
|
69
|
+
Possible values: `Integer`, `FixedFloat`, `Exponential`, `BestFloat`,
|
|
70
|
+
`SuperScript`, `CustomLabel`, `LogSuperScript`, `RangeBestFloat`,
|
|
71
|
+
`DynamicLabel`, `TimeDate`.
|
|
72
|
+
|
|
73
|
+
Example usage::
|
|
74
|
+
|
|
75
|
+
>>> from tecplot.constant import NumberFormat
|
|
76
|
+
>>> axis.tick_labels.format.format_type = NumberFormat.BestFloat
|
|
77
|
+
"""
|
|
78
|
+
return self._get_style(NumberFormat, sv.FORMATTING)
|
|
79
|
+
|
|
80
|
+
@format_type.setter
|
|
81
|
+
def format_type(self, value):
|
|
82
|
+
self._set_style(NumberFormat(value), sv.FORMATTING)
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def custom_labels_index(self):
|
|
86
|
+
"""`Index` (zero-based): Index of the custom label to use.
|
|
87
|
+
|
|
88
|
+
Example usage::
|
|
89
|
+
|
|
90
|
+
>>> axis.tick_labels.format.custom_labels_index = 0
|
|
91
|
+
"""
|
|
92
|
+
return self._get_style(Index, sv.CUSTOMLABEL)
|
|
93
|
+
|
|
94
|
+
@custom_labels_index.setter
|
|
95
|
+
def custom_labels_index(self, index):
|
|
96
|
+
index = (self.num_custom_labels + index) if index < 0 else index
|
|
97
|
+
self._set_style(Index(index), sv.CUSTOMLABEL)
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def num_custom_labels(self):
|
|
101
|
+
"""`int`: Number of custom label sets available to use.
|
|
102
|
+
|
|
103
|
+
Example usage::
|
|
104
|
+
|
|
105
|
+
>>> print(axis.tick_labels.format.num_custom_labels)
|
|
106
|
+
1
|
|
107
|
+
"""
|
|
108
|
+
return _tecutil.CustomLabelsGetNumSets()
|
|
109
|
+
|
|
110
|
+
def custom_labels(self, index):
|
|
111
|
+
"""List of labels for custom labels for set specified by index.
|
|
112
|
+
|
|
113
|
+
Example usage::
|
|
114
|
+
|
|
115
|
+
>>> axis.tick_labels.format.custom_labels(0)
|
|
116
|
+
['apples', 'bananas', 'carrots']
|
|
117
|
+
"""
|
|
118
|
+
index = (self.num_custom_labels + index) if index < 0 else index
|
|
119
|
+
sl = _tecutil.CustomLabelsGet(index + 1)
|
|
120
|
+
ret = list(sl)
|
|
121
|
+
sl.dealloc()
|
|
122
|
+
return ret
|
|
123
|
+
|
|
124
|
+
@lock()
|
|
125
|
+
def add_custom_labels(self, *labels):
|
|
126
|
+
"""Append a list of custom labels as a new set.
|
|
127
|
+
|
|
128
|
+
Example usage::
|
|
129
|
+
|
|
130
|
+
>>> labels = ['apples', 'bananas', 'carrots']
|
|
131
|
+
>>> axis.tick_labels.format.add_custom_labels(*labels)
|
|
132
|
+
>>> print(axis.tick_labels.format.custom_labels(-1))
|
|
133
|
+
['apples', 'bananas', 'carrots']
|
|
134
|
+
"""
|
|
135
|
+
with StringList(*flatten_args(labels)) as sl:
|
|
136
|
+
if not _tecutil.CustomLabelsAppend(sl):
|
|
137
|
+
raise TecplotSystemError()
|
|
138
|
+
|
|
139
|
+
@property
|
|
140
|
+
def precision(self):
|
|
141
|
+
"""`int`: Number digits after decimal for fixed floating point format.
|
|
142
|
+
|
|
143
|
+
Example usage::
|
|
144
|
+
|
|
145
|
+
>>> from tecplot.constant import NumberFormat
|
|
146
|
+
>>> axis.tick_labels.format.format_type = NumberFormat.FixedFloat
|
|
147
|
+
>>> axis.tick_labels.format.precision = 3
|
|
148
|
+
"""
|
|
149
|
+
return self._get_style(int, sv.PRECISION)
|
|
150
|
+
|
|
151
|
+
@precision.setter
|
|
152
|
+
def precision(self, value):
|
|
153
|
+
self._set_style(int(value), sv.PRECISION)
|
|
154
|
+
|
|
155
|
+
@property
|
|
156
|
+
def remove_leading_zeros(self):
|
|
157
|
+
"""`bool`: Strip leading zeros in the formatted number.
|
|
158
|
+
|
|
159
|
+
Example usage::
|
|
160
|
+
|
|
161
|
+
>>> axis.tick_labels.format.remove_leading_zeros = True
|
|
162
|
+
"""
|
|
163
|
+
return self._get_style(bool, sv.REMOVELEADINGZEROS)
|
|
164
|
+
|
|
165
|
+
@remove_leading_zeros.setter
|
|
166
|
+
def remove_leading_zeros(self, value):
|
|
167
|
+
self._set_style(bool(value), sv.REMOVELEADINGZEROS)
|
|
168
|
+
|
|
169
|
+
@property
|
|
170
|
+
def show_decimals_on_whole_numbers(self):
|
|
171
|
+
"""`bool`: Include trailing decimal character with whole numbers.
|
|
172
|
+
|
|
173
|
+
Example usage::
|
|
174
|
+
|
|
175
|
+
>>> axis.tick_labels.format.show_decimals_on_whole_numbers = True
|
|
176
|
+
"""
|
|
177
|
+
return self._get_style(bool, sv.SHOWDECIMALSONWHOLENUMBERS)
|
|
178
|
+
|
|
179
|
+
@show_decimals_on_whole_numbers.setter
|
|
180
|
+
def show_decimals_on_whole_numbers(self, value):
|
|
181
|
+
self._set_style(bool(value), sv.SHOWDECIMALSONWHOLENUMBERS)
|
|
182
|
+
|
|
183
|
+
@property
|
|
184
|
+
def show_negative_sign(self):
|
|
185
|
+
"""`bool`: Include negative sign for negative values.
|
|
186
|
+
|
|
187
|
+
Example usage::
|
|
188
|
+
|
|
189
|
+
>>> axis.tick_labels.format.show_negative_sign = True
|
|
190
|
+
"""
|
|
191
|
+
return self._get_style(bool, sv.SHOWNEGATIVESIGN)
|
|
192
|
+
|
|
193
|
+
@show_negative_sign.setter
|
|
194
|
+
def show_negative_sign(self, value):
|
|
195
|
+
self._set_style(bool(value), sv.SHOWNEGATIVESIGN)
|
|
196
|
+
|
|
197
|
+
@property
|
|
198
|
+
def negative_prefix(self):
|
|
199
|
+
"""`str`: Prefix string to use for negative valued tick labels.
|
|
200
|
+
|
|
201
|
+
This example shows how to use parentheses instead of a negative sign::
|
|
202
|
+
|
|
203
|
+
>>> axis.tick_labels.format.show_negative_sign = False
|
|
204
|
+
>>> axis.tick_labels.format.negative_prefix = '('
|
|
205
|
+
>>> axis.tick_labels.format.negative_suffix = ')'
|
|
206
|
+
"""
|
|
207
|
+
return self._get_style(str, sv.NEGATIVEPREFIX)
|
|
208
|
+
|
|
209
|
+
@negative_prefix.setter
|
|
210
|
+
def negative_prefix(self, value):
|
|
211
|
+
self._set_style(str(value), sv.NEGATIVEPREFIX)
|
|
212
|
+
|
|
213
|
+
@property
|
|
214
|
+
def negative_suffix(self):
|
|
215
|
+
"""`str`: Suffix string to use for negative valued tick labels.
|
|
216
|
+
|
|
217
|
+
This example shows how to use parentheses instead of a negative sign::
|
|
218
|
+
|
|
219
|
+
>>> axis.tick_labels.format.show_negative_sign = False
|
|
220
|
+
>>> axis.tick_labels.format.negative_prefix = '('
|
|
221
|
+
>>> axis.tick_labels.format.negative_suffix = ')'
|
|
222
|
+
"""
|
|
223
|
+
return self._get_style(str, sv.NEGATIVESUFFIX)
|
|
224
|
+
|
|
225
|
+
@negative_suffix.setter
|
|
226
|
+
def negative_suffix(self, value):
|
|
227
|
+
self._set_style(str(value), sv.NEGATIVESUFFIX)
|
|
228
|
+
|
|
229
|
+
@property
|
|
230
|
+
def positive_prefix(self):
|
|
231
|
+
"""`str`: Prefix string to use for positive valued tick labels.
|
|
232
|
+
|
|
233
|
+
Example usage::
|
|
234
|
+
|
|
235
|
+
>>> axis.tick_labels.format.positive_prefix = 'increase: '
|
|
236
|
+
"""
|
|
237
|
+
return self._get_style(str, sv.POSITIVEPREFIX)
|
|
238
|
+
|
|
239
|
+
@positive_prefix.setter
|
|
240
|
+
def positive_prefix(self, value):
|
|
241
|
+
self._set_style(str(value), sv.POSITIVEPREFIX)
|
|
242
|
+
|
|
243
|
+
@property
|
|
244
|
+
def positive_suffix(self):
|
|
245
|
+
"""`str`: Suffix string to use for positive valued tick labels.
|
|
246
|
+
|
|
247
|
+
Example usage::
|
|
248
|
+
|
|
249
|
+
>>> axis.tick_labels.format.positive_suffix = ' (m)'
|
|
250
|
+
"""
|
|
251
|
+
return self._get_style(str, sv.POSITIVESUFFIX)
|
|
252
|
+
|
|
253
|
+
@positive_suffix.setter
|
|
254
|
+
def positive_suffix(self, value):
|
|
255
|
+
self._set_style(str(value), sv.POSITIVESUFFIX)
|
|
256
|
+
|
|
257
|
+
@property
|
|
258
|
+
def zero_prefix(self):
|
|
259
|
+
"""`str`: Prefix string to use for zero valued tick labels.
|
|
260
|
+
|
|
261
|
+
Example usage::
|
|
262
|
+
|
|
263
|
+
>>> axis.tick_labels.format.zero_prefix = 'origin: '
|
|
264
|
+
"""
|
|
265
|
+
return self._get_style(str, sv.ZEROPREFIX)
|
|
266
|
+
|
|
267
|
+
@zero_prefix.setter
|
|
268
|
+
def zero_prefix(self, value):
|
|
269
|
+
self._set_style(str(value), sv.ZEROPREFIX)
|
|
270
|
+
|
|
271
|
+
@property
|
|
272
|
+
def zero_suffix(self):
|
|
273
|
+
"""`str`: Suffix string to use for zero valued tick labels.
|
|
274
|
+
|
|
275
|
+
Example usage::
|
|
276
|
+
|
|
277
|
+
>>> axis.tick_labels.format.zero_suffix = ' (origin)'
|
|
278
|
+
"""
|
|
279
|
+
return self._get_style(str, sv.ZEROSUFFIX)
|
|
280
|
+
|
|
281
|
+
@zero_suffix.setter
|
|
282
|
+
def zero_suffix(self, value):
|
|
283
|
+
self._set_style(str(value), sv.ZEROSUFFIX)
|
|
284
|
+
|
|
285
|
+
@property
|
|
286
|
+
def datetime_format(self):
|
|
287
|
+
r"""`str`: The date/time format to be used.
|
|
288
|
+
|
|
289
|
+
Example usage::
|
|
290
|
+
|
|
291
|
+
>>> from tecplot.constant import NumberFormat
|
|
292
|
+
>>> axis.tick_labels.format.format_type = NumberFormat.TimeDate
|
|
293
|
+
>>> axis.tick_labels.format.datetime_format = 'mmm d, yyyy'
|
|
294
|
+
|
|
295
|
+
The format can be any combination of the following codes. Placing a
|
|
296
|
+
backslash in front of a y, m, d, or s in the Time/Date formula will
|
|
297
|
+
keep it from being processed as part of the formula. All characters not
|
|
298
|
+
part of the Time/Date formula will appear as entered. For example,
|
|
299
|
+
"\\year yyyy" will appear as "year 2008", as the backslash keeps the
|
|
300
|
+
first y from being processed as part of the formula. If you use "m"
|
|
301
|
+
immediately after the "h" or "hh" code or immediately before the "ss"
|
|
302
|
+
code, the minutes instead of the month will be displayed.
|
|
303
|
+
|
|
304
|
+
=============== =========================
|
|
305
|
+
Years:
|
|
306
|
+
-----------------------------------------
|
|
307
|
+
``yy`` 00-99
|
|
308
|
+
``yyyy`` 1800-9999
|
|
309
|
+
--------------- -------------------------
|
|
310
|
+
Months:
|
|
311
|
+
-----------------------------------------
|
|
312
|
+
``m`` 1-12
|
|
313
|
+
``mm`` 01-12
|
|
314
|
+
``mmm`` Jan-Dec
|
|
315
|
+
``mmmm`` January-December
|
|
316
|
+
``mmmmm`` first letter of the month
|
|
317
|
+
--------------- -------------------------
|
|
318
|
+
Days:
|
|
319
|
+
-----------------------------------------
|
|
320
|
+
``[d]`` elapsed days
|
|
321
|
+
``d`` 1-31
|
|
322
|
+
``dd`` 01-31
|
|
323
|
+
``ddd`` Sun-Sat
|
|
324
|
+
``dddd`` Sunday-Saturday
|
|
325
|
+
``ddddd`` S,M,T,W,T,F,S
|
|
326
|
+
--------------- -------------------------
|
|
327
|
+
Hours:
|
|
328
|
+
-----------------------------------------
|
|
329
|
+
``[h]`` elapsed hours
|
|
330
|
+
``h`` 0-23 or 1-12
|
|
331
|
+
``hh`` 00-23 or 1-12
|
|
332
|
+
``AM/PM`` AM or PM
|
|
333
|
+
``A/P`` AM or PM as "A" or "P"
|
|
334
|
+
--------------- -------------------------
|
|
335
|
+
Minutes:
|
|
336
|
+
-----------------------------------------
|
|
337
|
+
``[m]`` elapsed minutes
|
|
338
|
+
``m`` 0-59
|
|
339
|
+
``mm`` 00-59
|
|
340
|
+
--------------- -------------------------
|
|
341
|
+
Seconds:
|
|
342
|
+
--------------- -------------------------
|
|
343
|
+
``s`` 0-59
|
|
344
|
+
``ss`` 00-59
|
|
345
|
+
``.0`` Tenths
|
|
346
|
+
``.00`` Hundredths
|
|
347
|
+
``.000`` Thousandths
|
|
348
|
+
=============== =========================
|
|
349
|
+
|
|
350
|
+
To display the time and date on your plot as a "Sat-Jan-05-2008", enter
|
|
351
|
+
the following code::
|
|
352
|
+
|
|
353
|
+
"ddd-mmm-dd-yyyy"
|
|
354
|
+
|
|
355
|
+
To display the time and date on your plot as a "1-3-08", enter the
|
|
356
|
+
following code::
|
|
357
|
+
|
|
358
|
+
"m-d-yy"
|
|
359
|
+
|
|
360
|
+
To display the time and date on your plot as a "9:30:05 AM", enter the
|
|
361
|
+
following code::
|
|
362
|
+
|
|
363
|
+
"h:mm:ss AM"
|
|
364
|
+
|
|
365
|
+
To display an elapsed time, such as "3:10:15", enter the following
|
|
366
|
+
code::
|
|
367
|
+
|
|
368
|
+
"[d]:hh:mm"
|
|
369
|
+
"""
|
|
370
|
+
return self._get_style(str, sv.TIMEDATEFORMAT)
|
|
371
|
+
|
|
372
|
+
@datetime_format.setter
|
|
373
|
+
def datetime_format(self, value):
|
|
374
|
+
self._set_style(str(value), sv.TIMEDATEFORMAT)
|
tecplot/text/textbox.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
from builtins import super
|
|
2
|
+
|
|
3
|
+
from ..tecutil import sv
|
|
4
|
+
from .. import constant, session
|
|
5
|
+
|
|
6
|
+
#
|
|
7
|
+
# Note: The TextBox class is similar to the annotation.TextBox class, except
|
|
8
|
+
# that annotation.TextBox is specific to text annotations and uses the
|
|
9
|
+
# TecUtilText API to get/set properties.
|
|
10
|
+
#
|
|
11
|
+
# The TextBox class below uses style to get/set properties.
|
|
12
|
+
#
|
|
13
|
+
# Therefore, this class must be separate from annotation.TextBox
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TextBox(session.Style):
|
|
18
|
+
"""Rectangular frame around a text element.
|
|
19
|
+
|
|
20
|
+
.. warning::
|
|
21
|
+
|
|
22
|
+
`text.TextBox` objects cannot be created directly. They are returned by
|
|
23
|
+
various other read-only properties.
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
def __init__(self, parent):
|
|
27
|
+
self.parent = parent
|
|
28
|
+
super().__init__(parent._sv, sv.BOX, **parent._kw)
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def box_type(self):
|
|
32
|
+
"""`constant.TextBox`: Type of box surrounding the text.
|
|
33
|
+
|
|
34
|
+
Example usage::
|
|
35
|
+
|
|
36
|
+
>>> plot = frame.plot()
|
|
37
|
+
>>> plot.legend.box.box_type = constant.TextBox.None_
|
|
38
|
+
"""
|
|
39
|
+
return self._get_style(constant.TextBox, sv.BOXTYPE)
|
|
40
|
+
|
|
41
|
+
@box_type.setter
|
|
42
|
+
def box_type(self, value):
|
|
43
|
+
self._set_style(constant.TextBox(value), sv.BOXTYPE)
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def color(self):
|
|
47
|
+
"""`Color`: Color of the box surrounding the text.
|
|
48
|
+
|
|
49
|
+
Example usage::
|
|
50
|
+
|
|
51
|
+
>>> plot = frame.plot()
|
|
52
|
+
>>> plot.legend.box.color = Color.Blue
|
|
53
|
+
"""
|
|
54
|
+
return self._get_style(constant.Color, sv.COLOR)
|
|
55
|
+
|
|
56
|
+
@color.setter
|
|
57
|
+
def color(self, value):
|
|
58
|
+
self._set_style(constant.Color(value), sv.COLOR)
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def fill_color(self):
|
|
62
|
+
"""`Color`: Fill color of the box surrounding the text.
|
|
63
|
+
|
|
64
|
+
Example usage::
|
|
65
|
+
|
|
66
|
+
>>> plot = frame.plot()
|
|
67
|
+
>>> plot.legend.box.fill_color = Color.Blue
|
|
68
|
+
"""
|
|
69
|
+
return self._get_style(constant.Color, sv.FILLCOLOR)
|
|
70
|
+
|
|
71
|
+
@fill_color.setter
|
|
72
|
+
def fill_color(self, value):
|
|
73
|
+
self._set_style(constant.Color(value), sv.FILLCOLOR)
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def line_thickness(self):
|
|
77
|
+
"""`float`: Line thickness of the box surrounding the text.
|
|
78
|
+
|
|
79
|
+
Example usage::
|
|
80
|
+
|
|
81
|
+
>>> plot = frame.plot()
|
|
82
|
+
>>> plot.legend.box.line_thickness = 0.2
|
|
83
|
+
"""
|
|
84
|
+
return self._get_style(float, sv.LINETHICKNESS)
|
|
85
|
+
|
|
86
|
+
@line_thickness.setter
|
|
87
|
+
def line_thickness(self, value):
|
|
88
|
+
self._set_style(float(value), sv.LINETHICKNESS)
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def margin(self):
|
|
92
|
+
"""`float`: Margin of the box surrounding the text.
|
|
93
|
+
|
|
94
|
+
This property is the margin between the text inside the text box
|
|
95
|
+
and the box as a percentage of frame height.
|
|
96
|
+
|
|
97
|
+
Example usage::
|
|
98
|
+
|
|
99
|
+
>>> plot = frame.plot()
|
|
100
|
+
>>> plot.legend.box.margin = 0.3
|
|
101
|
+
"""
|
|
102
|
+
return self._get_style(float, sv.MARGIN)
|
|
103
|
+
|
|
104
|
+
@margin.setter
|
|
105
|
+
def margin(self, value):
|
|
106
|
+
self._set_style(float(value), sv.MARGIN)
|
tecplot/version.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Version information of the tecplot Python module can be obtained as a `string
|
|
2
|
+
<str>` of the form "Major.Minor.Patch"::
|
|
3
|
+
|
|
4
|
+
tecplot.__version__
|
|
5
|
+
|
|
6
|
+
or as a `namedtuple <collections.namedtuple>` with attributes: "major",
|
|
7
|
+
"minor", "patch", "build" in that order::
|
|
8
|
+
|
|
9
|
+
tecplot.version_info
|
|
10
|
+
|
|
11
|
+
The underlying |Tecplot 360| installation has its own version which can be
|
|
12
|
+
obtained as a `str`::
|
|
13
|
+
|
|
14
|
+
tecplot.sdk_version
|
|
15
|
+
|
|
16
|
+
or as a `namedtuple <collections.namedtuple>`::
|
|
17
|
+
|
|
18
|
+
tecplot.sdk_version_info
|
|
19
|
+
|
|
20
|
+
PyTecplot adheres to the semantic versioning as outlined in `SemVer 2.0.0
|
|
21
|
+
<https://semver.org/spec/v2.0.0.html>`__ with regard to backwards compatibility
|
|
22
|
+
between releases. For this purpose, the public interface of PyTecplot is
|
|
23
|
+
defined as all entities (functions, properties etc.) presented in the `HTML
|
|
24
|
+
documentation <https://www.tecplot.com/docs/pytecplot/>`__ and does not include
|
|
25
|
+
methods in the code-base which do not show up in the HTML documentation, even
|
|
26
|
+
when a docstring is present. In short, we will maintain backwards compatibility
|
|
27
|
+
of the public interface between all minor releases of the same major version
|
|
28
|
+
with the exception of internal changes that fix incorrect behavior or bugs.
|
|
29
|
+
"""
|
|
30
|
+
import collections
|
|
31
|
+
|
|
32
|
+
from .tecutil import _tecutil_connector
|
|
33
|
+
|
|
34
|
+
Version = collections.namedtuple('V', ['major', 'minor', 'patch', 'build'])
|
|
35
|
+
|
|
36
|
+
version = '1.5.2'
|
|
37
|
+
build = 'ea41609'
|
|
38
|
+
version_info = Version(*[int(x) for x in version.split('.')], build=build or 0)
|
|
39
|
+
|
|
40
|
+
sdk_version_info = _tecutil_connector.sdk_version_info
|
|
41
|
+
sdk_version = _tecutil_connector.sdk_version
|