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,516 @@
|
|
|
1
|
+
from builtins import str, super
|
|
2
|
+
|
|
3
|
+
from ..tecutil import sv
|
|
4
|
+
from .. import session, constant, tecutil, text
|
|
5
|
+
from . import legend
|
|
6
|
+
|
|
7
|
+
class LegendHeader(session.Style):
|
|
8
|
+
"""
|
|
9
|
+
"""
|
|
10
|
+
def __init__(self, legend, *svargs):
|
|
11
|
+
self.legend = legend
|
|
12
|
+
super().__init__(legend._sv, sv.HEADER, **legend._kw)
|
|
13
|
+
|
|
14
|
+
@property
|
|
15
|
+
def show(self):
|
|
16
|
+
"""`bool`: Show or hide the contour legend header.
|
|
17
|
+
|
|
18
|
+
.. note::
|
|
19
|
+
|
|
20
|
+
The header text will display the name of the variable assigned to
|
|
21
|
+
the contour group or a custom text if the `use_custom_text` is set
|
|
22
|
+
to True.
|
|
23
|
+
|
|
24
|
+
Example usage::
|
|
25
|
+
|
|
26
|
+
>>> from tecplot.constant import PlotType
|
|
27
|
+
>>> plot = frame.plot(PlotType.Cartesian3D)
|
|
28
|
+
>>> legend_header = plot.contour(0).legend.header
|
|
29
|
+
>>> legend_header.show = True
|
|
30
|
+
"""
|
|
31
|
+
return self._get_style(bool, sv.SHOW)
|
|
32
|
+
|
|
33
|
+
@show.setter
|
|
34
|
+
def show(self, value):
|
|
35
|
+
self._set_style(bool(value), sv.SHOW)
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def font(self):
|
|
39
|
+
"""`text.Font`: Font used to display the legend header.
|
|
40
|
+
|
|
41
|
+
.. note::
|
|
42
|
+
|
|
43
|
+
The font `size_units <tecplot.text.Font.size_units>` property
|
|
44
|
+
may only be set to `Units.Frame` or `Units.Point`.
|
|
45
|
+
|
|
46
|
+
Example usage::
|
|
47
|
+
|
|
48
|
+
>>> from tecplot.constant import PlotType
|
|
49
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
50
|
+
>>> legend.header.font.italic = True
|
|
51
|
+
"""
|
|
52
|
+
return text.LegendFont(self, sv.TEXTSHAPE)
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def use_custom_text(self):
|
|
56
|
+
""" `bool`: Use custom text on the contour legend header.
|
|
57
|
+
|
|
58
|
+
If set to `True`, the legend header will be set by the `custom_text`
|
|
59
|
+
property instead of the variable name assigned to the contour group.
|
|
60
|
+
|
|
61
|
+
Example usage::
|
|
62
|
+
|
|
63
|
+
>>> from tecplot.constant import PlotType
|
|
64
|
+
>>> plot = frame.plot(PlotType.Cartesian3D)
|
|
65
|
+
>>> header = plot.contour(0).legend.header
|
|
66
|
+
>>> header.use_custom_text = True
|
|
67
|
+
>>> header.custom_text = 'Solution time: &(SOLUTIONTIME) ms'
|
|
68
|
+
|
|
69
|
+
See also: `LegendHeader.custom_text`
|
|
70
|
+
|
|
71
|
+
.. versionadded:: 2021.2
|
|
72
|
+
|
|
73
|
+
The ability to specify custom contour legend header text requires
|
|
74
|
+
Tecplot 360 2021 R2 or later.
|
|
75
|
+
|
|
76
|
+
.. versionadded:: 1.4.2
|
|
77
|
+
"""
|
|
78
|
+
return self._get_style(bool, sv.USECUSTOMTEXT)
|
|
79
|
+
|
|
80
|
+
@use_custom_text.setter
|
|
81
|
+
def use_custom_text(self, value):
|
|
82
|
+
self._set_style(bool(value), sv.USECUSTOMTEXT)
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def custom_text(self):
|
|
86
|
+
""" `str`: A string to be used in the contour legend header.
|
|
87
|
+
|
|
88
|
+
If the `use_custom_text` property is set to `True`, the legend header
|
|
89
|
+
will contain this text instead of the name of the variable assigned to
|
|
90
|
+
the contour group. The text may contain Dynamic Text and formatting
|
|
91
|
+
tags (see User Manual).
|
|
92
|
+
|
|
93
|
+
Example usage::
|
|
94
|
+
|
|
95
|
+
>>> from tecplot.constant import PlotType
|
|
96
|
+
>>> plot = frame.plot(PlotType.Cartesian3D)
|
|
97
|
+
>>> header = plot.contour(0).legend.header
|
|
98
|
+
>>> header.use_custom_text = True
|
|
99
|
+
>>> header.custom_text = 'time: &(SOLUTIONTIME) <greek>ms</greek>'
|
|
100
|
+
|
|
101
|
+
See also: `LegendHeader.use_custom_text`
|
|
102
|
+
|
|
103
|
+
.. versionadded:: 2021.2
|
|
104
|
+
|
|
105
|
+
The ability to specify custom contour legend header text requires
|
|
106
|
+
Tecplot 360 2021 R2 or later.
|
|
107
|
+
|
|
108
|
+
.. versionadded:: 1.4.2
|
|
109
|
+
"""
|
|
110
|
+
return self._get_style(str, sv.CUSTOMTEXT)
|
|
111
|
+
|
|
112
|
+
@custom_text.setter
|
|
113
|
+
def custom_text(self, value):
|
|
114
|
+
self._set_style(str(value), sv.CUSTOMTEXT)
|
|
115
|
+
|
|
116
|
+
@property
|
|
117
|
+
def text_type(self):
|
|
118
|
+
"""`TextType`: Typesetter for the contour legend header.
|
|
119
|
+
|
|
120
|
+
This determines how the header text for the contour legend
|
|
121
|
+
is rendered. Options are `TextType.Regular` or `TextType.LaTeX`.
|
|
122
|
+
When using ``LaTeX``, make sure to use Python raw strings so
|
|
123
|
+
that literal back-slashes are preserved.
|
|
124
|
+
|
|
125
|
+
Example usage::
|
|
126
|
+
|
|
127
|
+
>>> from tecplot.constant import PlotType, TextType
|
|
128
|
+
>>> plot = frame.plot(PlotType.Cartesian3D)
|
|
129
|
+
>>> header = plot.contour(0).legend.header
|
|
130
|
+
>>> header.text_type = TextType.LaTeX
|
|
131
|
+
>>> header.use_custom_text = True
|
|
132
|
+
>>> header.custom_text = r'\LaTeX'
|
|
133
|
+
|
|
134
|
+
.. versionadded:: 2022.1
|
|
135
|
+
|
|
136
|
+
The ability to use LaTeX for contour legend header text requires
|
|
137
|
+
Tecplot 360 2022 R1 or later.
|
|
138
|
+
|
|
139
|
+
.. versionadded:: 1.5.0
|
|
140
|
+
"""
|
|
141
|
+
return self._get_style(constant.TextType, sv.TEXTTYPE)
|
|
142
|
+
|
|
143
|
+
@text_type.setter
|
|
144
|
+
def text_type(self, value):
|
|
145
|
+
self._set_style(constant.TextType(value), sv.TEXTTYPE)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class ContourLegend(legend.TabularLegend):
|
|
149
|
+
"""Contour legend attributes.
|
|
150
|
+
|
|
151
|
+
This class allows you to customize the appearance of the contour legend.
|
|
152
|
+
The contour legend can be positioned anywhere inside the frame using the
|
|
153
|
+
`position` attribute of this class. Example usage:
|
|
154
|
+
|
|
155
|
+
.. code-block:: python
|
|
156
|
+
:emphasize-lines: 21-36
|
|
157
|
+
|
|
158
|
+
import os
|
|
159
|
+
import numpy as np
|
|
160
|
+
|
|
161
|
+
import tecplot
|
|
162
|
+
from tecplot.constant import *
|
|
163
|
+
|
|
164
|
+
# By loading a layout many style and view properties are set up already
|
|
165
|
+
examples_dir = tecplot.session.tecplot_examples_directory()
|
|
166
|
+
datafile = os.path.join(examples_dir, 'SimpleData', 'RainierElevation.lay')
|
|
167
|
+
tecplot.load_layout(datafile)
|
|
168
|
+
|
|
169
|
+
frame = tecplot.active_frame()
|
|
170
|
+
plot = frame.plot()
|
|
171
|
+
|
|
172
|
+
# Rename the elevation variable
|
|
173
|
+
frame.dataset.variable('E').name = "Elevation (m)"
|
|
174
|
+
|
|
175
|
+
# Set the levels to nice values
|
|
176
|
+
plot.contour(0).levels.reset_levels(np.linspace(200,4400,22))
|
|
177
|
+
|
|
178
|
+
legend = plot.contour(0).legend
|
|
179
|
+
legend.show = True
|
|
180
|
+
legend.vertical = False # Horizontal
|
|
181
|
+
legend.auto_resize = False
|
|
182
|
+
legend.label_step = 5
|
|
183
|
+
|
|
184
|
+
legend.overlay_bar_grid = False
|
|
185
|
+
legend.position = (55, 94) # Frame percentages
|
|
186
|
+
|
|
187
|
+
legend.box.box_type = TextBox.None_ # Remove Text box
|
|
188
|
+
|
|
189
|
+
legend.header.font.typeface = 'Courier'
|
|
190
|
+
legend.header.font.bold = True
|
|
191
|
+
|
|
192
|
+
legend.number_font.typeface = 'Courier'
|
|
193
|
+
legend.number_font.bold = True
|
|
194
|
+
|
|
195
|
+
tecplot.export.save_png('legend_contour.png', 600, supersample=3)
|
|
196
|
+
|
|
197
|
+
.. figure:: /_static/images/legend_contour.png
|
|
198
|
+
:width: 300px
|
|
199
|
+
:figwidth: 300px
|
|
200
|
+
"""
|
|
201
|
+
def __init__(self, contour, *svargs):
|
|
202
|
+
self.contour = contour
|
|
203
|
+
super().__init__(contour._sv, sv.LEGEND, **contour._kw)
|
|
204
|
+
|
|
205
|
+
@tecutil.inherited_property(legend.Legend)
|
|
206
|
+
def show(self):
|
|
207
|
+
"""`bool`: Show or hide the legend.
|
|
208
|
+
|
|
209
|
+
Example usage::
|
|
210
|
+
|
|
211
|
+
>>> from tecplot.constant import PlotType
|
|
212
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
213
|
+
>>> legend.show = True
|
|
214
|
+
"""
|
|
215
|
+
|
|
216
|
+
@tecutil.inherited_property(legend.Legend)
|
|
217
|
+
def anchor_alignment(self):
|
|
218
|
+
"""`AnchorAlignment`: Anchor location of the legend.
|
|
219
|
+
|
|
220
|
+
Example usage::
|
|
221
|
+
|
|
222
|
+
>>> from tecplot.constant import PlotType, AnchorAlignment
|
|
223
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
224
|
+
>>> legend.anchor_alignment = AnchorAlignment.BottomCenter
|
|
225
|
+
"""
|
|
226
|
+
|
|
227
|
+
@tecutil.inherited_property(legend.Legend)
|
|
228
|
+
def text_color(self):
|
|
229
|
+
"""`Color`: Color of legend text.
|
|
230
|
+
|
|
231
|
+
Example usage::
|
|
232
|
+
|
|
233
|
+
>>> from tecplot.constant import PlotType, Color
|
|
234
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
235
|
+
>>> legend.text_color = Color.Blue
|
|
236
|
+
"""
|
|
237
|
+
|
|
238
|
+
@tecutil.inherited_property(legend.Legend)
|
|
239
|
+
def position(self):
|
|
240
|
+
"""`tuple`: Position as a percentage of frame width/height.
|
|
241
|
+
|
|
242
|
+
The legend is automatically placed for you. You may specify the
|
|
243
|
+
:math:`(x,y)` position of the legend by setting this value, where
|
|
244
|
+
:math:`x` is the percentage of frame width, and :math:`y` is a
|
|
245
|
+
percentage of frame height.
|
|
246
|
+
|
|
247
|
+
Example usage::
|
|
248
|
+
|
|
249
|
+
>>> from tecplot.constant import PlotType
|
|
250
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
251
|
+
>>> legend.position = (.1, .3)
|
|
252
|
+
>>> pos = legend.position
|
|
253
|
+
>>> pos.x # == position[0]
|
|
254
|
+
.1
|
|
255
|
+
>>> pos.y # == position[1]
|
|
256
|
+
.3
|
|
257
|
+
"""
|
|
258
|
+
|
|
259
|
+
@tecutil.inherited_property(legend.Legend)
|
|
260
|
+
def box(self):
|
|
261
|
+
"""`text.TextBox`: Legend box attributes.
|
|
262
|
+
|
|
263
|
+
Example usage::
|
|
264
|
+
|
|
265
|
+
>>> from tecplot.constant import PlotType, Color
|
|
266
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
267
|
+
>>> legend.box.color = Color.Blue
|
|
268
|
+
"""
|
|
269
|
+
|
|
270
|
+
@tecutil.inherited_property(legend.TabularLegend)
|
|
271
|
+
def row_spacing(self):
|
|
272
|
+
"""`float`: Spacing between rows in the legend.
|
|
273
|
+
|
|
274
|
+
Example usage::
|
|
275
|
+
|
|
276
|
+
>>> from tecplot.constant import PlotType
|
|
277
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
278
|
+
>>> legend.row_spacing = 1.5
|
|
279
|
+
"""
|
|
280
|
+
|
|
281
|
+
@property
|
|
282
|
+
def auto_resize(self):
|
|
283
|
+
"""`bool`: Skip levels to create a reasonably sized legend.
|
|
284
|
+
|
|
285
|
+
Example usage::
|
|
286
|
+
|
|
287
|
+
>>> from tecplot.constant import PlotType
|
|
288
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
289
|
+
>>> legend.auto_resize = True
|
|
290
|
+
"""
|
|
291
|
+
return self._get_style(bool, sv.AUTORESIZE)
|
|
292
|
+
|
|
293
|
+
@auto_resize.setter
|
|
294
|
+
def auto_resize(self, value):
|
|
295
|
+
self._set_style(bool(value), sv.AUTORESIZE)
|
|
296
|
+
|
|
297
|
+
@property
|
|
298
|
+
def header_font(self):
|
|
299
|
+
if __debug__:
|
|
300
|
+
tecutil.api_moved('ContourLegend.header_font',
|
|
301
|
+
'ContourLegend.header.font',
|
|
302
|
+
'1.4.2', '2021 R1', warning=True)
|
|
303
|
+
return text.LegendFont(self, sv.HEADERTEXTSHAPE)
|
|
304
|
+
|
|
305
|
+
@property
|
|
306
|
+
def number_font(self):
|
|
307
|
+
"""`text.Font`: Font used to display numbers in the legend.
|
|
308
|
+
|
|
309
|
+
.. note::
|
|
310
|
+
The font `size_units <tecplot.text.Font.size_units>` property
|
|
311
|
+
may only be set to `Units.Frame` or `Units.Point`.
|
|
312
|
+
|
|
313
|
+
Example usage::
|
|
314
|
+
|
|
315
|
+
>>> from tecplot.constant import PlotType
|
|
316
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
317
|
+
>>> legend.number_font.italic = True
|
|
318
|
+
"""
|
|
319
|
+
return text.LegendFont(self, sv.NUMBERTEXTSHAPE)
|
|
320
|
+
|
|
321
|
+
@property
|
|
322
|
+
def show_cutoff_levels(self):
|
|
323
|
+
"""`bool`: Show color bands for levels affected by color cutoff.
|
|
324
|
+
|
|
325
|
+
Example usage::
|
|
326
|
+
|
|
327
|
+
>>> from tecplot.constant import PlotType
|
|
328
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
329
|
+
>>> legend.show_cutoff_levels = True
|
|
330
|
+
"""
|
|
331
|
+
return self._get_style(bool, sv.INCLUDECUTOFFLEVELS)
|
|
332
|
+
|
|
333
|
+
@show_cutoff_levels.setter
|
|
334
|
+
def show_cutoff_levels(self, value):
|
|
335
|
+
self._set_style(bool(value), sv.INCLUDECUTOFFLEVELS)
|
|
336
|
+
|
|
337
|
+
@property
|
|
338
|
+
def include_cutoff_levels(self):
|
|
339
|
+
tecutil.api_moved('ContourLegend.include_cutoff_levels',
|
|
340
|
+
'ContourLegend.show_cutoff_levels',
|
|
341
|
+
'0.13', '2018 R2')
|
|
342
|
+
|
|
343
|
+
@include_cutoff_levels.setter
|
|
344
|
+
def include_cutoff_levels(self, value):
|
|
345
|
+
tecutil.api_moved('ContourLegend.include_cutoff_levels',
|
|
346
|
+
'ContourLegend.show_cutoff_levels',
|
|
347
|
+
'0.13', '2018 R2')
|
|
348
|
+
|
|
349
|
+
@property
|
|
350
|
+
def vertical(self):
|
|
351
|
+
"""`bool`: Orientation of the legend.
|
|
352
|
+
|
|
353
|
+
When set to `True`, the legend is vertical. When set to `False`, the
|
|
354
|
+
legend is horizontal.
|
|
355
|
+
|
|
356
|
+
Example usage::
|
|
357
|
+
|
|
358
|
+
>>> from tecplot.constant import PlotType
|
|
359
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
360
|
+
>>> legend.vertical = False # Show horizontal legend
|
|
361
|
+
"""
|
|
362
|
+
return self._get_style(bool, sv.ISVERTICAL)
|
|
363
|
+
|
|
364
|
+
@vertical.setter
|
|
365
|
+
def vertical(self, value):
|
|
366
|
+
self._set_style(bool(value), sv.ISVERTICAL)
|
|
367
|
+
|
|
368
|
+
@property
|
|
369
|
+
def label_increment(self):
|
|
370
|
+
"""`float`: Spacing between labels along the contour legend.
|
|
371
|
+
|
|
372
|
+
Labels will be placed on the contour variable range from min to max.
|
|
373
|
+
The smaller the increment value the more legend labels will be created.
|
|
374
|
+
If the `label_location` is `ContLegendLabelLocation.Increment`, labels
|
|
375
|
+
are incremented by this value. For example, a `label_increment` value
|
|
376
|
+
of .5 will show labels at .5, 1.0, 1.5, etc.
|
|
377
|
+
|
|
378
|
+
.. Note::
|
|
379
|
+
|
|
380
|
+
This value is only used if `label_location` is set to
|
|
381
|
+
`ContLegendLabelLocation.Increment`. Otherwise it is ignored.
|
|
382
|
+
|
|
383
|
+
Example usage::
|
|
384
|
+
|
|
385
|
+
>>> from tecplot.constant import PlotType, ContLegendLabelLocation
|
|
386
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
387
|
+
>>> legend.label_location = ContLegendLabelLocation.Increment
|
|
388
|
+
>>> legend.label_increment = .5
|
|
389
|
+
|
|
390
|
+
.. seealso:: `label_location`
|
|
391
|
+
"""
|
|
392
|
+
return self._get_style(float, sv.LABELINCREMENT)
|
|
393
|
+
|
|
394
|
+
@label_increment.setter
|
|
395
|
+
def label_increment(self, value):
|
|
396
|
+
self._set_style(float(value), sv.LABELINCREMENT)
|
|
397
|
+
|
|
398
|
+
@property
|
|
399
|
+
def label_location(self):
|
|
400
|
+
"""`ContLegendLabelLocation`: Placement of labels on the legend.
|
|
401
|
+
|
|
402
|
+
If you have selected `ColorMapDistribution.Continuous` for the contour
|
|
403
|
+
colormap filter distribution, you have three options for placement of
|
|
404
|
+
labels on the legend:
|
|
405
|
+
|
|
406
|
+
* `ContLegendLabelLocation.ContourLevels` - This option places one
|
|
407
|
+
label for each contour level. See Contour Levels and Color.
|
|
408
|
+
* `ContLegendLabelLocation.Increment` - Set `label_increment` to the
|
|
409
|
+
increment value.
|
|
410
|
+
* `ContLegendLabelLocation.ColorMapDivisions` - Places one label for
|
|
411
|
+
each control point on the color map.
|
|
412
|
+
|
|
413
|
+
Example usage::
|
|
414
|
+
|
|
415
|
+
>>> from tecplot.constant import PlotType, ContLegendLabelLocation
|
|
416
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
417
|
+
>>> legend.label_location = ContourLevelLabelLocation.Increment
|
|
418
|
+
>>> legend.label_increment = .5
|
|
419
|
+
|
|
420
|
+
.. seealso:: `label_increment`
|
|
421
|
+
"""
|
|
422
|
+
return self._get_style(constant.ContLegendLabelLocation,
|
|
423
|
+
sv.LABELLOCATION)
|
|
424
|
+
|
|
425
|
+
@label_location.setter
|
|
426
|
+
def label_location(self, value):
|
|
427
|
+
self._set_style(constant.ContLegendLabelLocation(value),
|
|
428
|
+
sv.LABELLOCATION)
|
|
429
|
+
|
|
430
|
+
@property
|
|
431
|
+
def overlay_bar_grid(self):
|
|
432
|
+
"""`bool`: Draw a line around each band in the legend color bar.
|
|
433
|
+
|
|
434
|
+
Example usage::
|
|
435
|
+
|
|
436
|
+
>>> from tecplot.constant import PlotType
|
|
437
|
+
>>> legend = frame.plot(PlotType.Cartesian3D).contour(0).legend
|
|
438
|
+
>>> legend.overlay_bar_grid = False
|
|
439
|
+
"""
|
|
440
|
+
return self._get_style(bool, sv.OVERLAYBARGRID)
|
|
441
|
+
|
|
442
|
+
@overlay_bar_grid.setter
|
|
443
|
+
def overlay_bar_grid(self, value):
|
|
444
|
+
self._set_style(bool(value), sv.OVERLAYBARGRID)
|
|
445
|
+
|
|
446
|
+
@property
|
|
447
|
+
def header(self):
|
|
448
|
+
"""`LegendHeader`: `LegendHeader` associated with a `ContourLegend`.
|
|
449
|
+
|
|
450
|
+
This object controls the attributes of the contour legend header.
|
|
451
|
+
|
|
452
|
+
.. versionadded:: 1.4.2
|
|
453
|
+
|
|
454
|
+
The contour legend header style control has been moved into a new
|
|
455
|
+
namespace `header`:
|
|
456
|
+
|
|
457
|
+
============================== ==============================
|
|
458
|
+
Old API New API
|
|
459
|
+
============================== ==============================
|
|
460
|
+
``contour.legend.show_header`` ``contour.legend.header.show``
|
|
461
|
+
``contour.legend.header_font`` ``contour.legend.header.font``
|
|
462
|
+
============================== ==============================
|
|
463
|
+
|
|
464
|
+
Example usage::
|
|
465
|
+
|
|
466
|
+
>>> plot.contour(0).legend.header.show = True
|
|
467
|
+
"""
|
|
468
|
+
return LegendHeader(self)
|
|
469
|
+
|
|
470
|
+
@property
|
|
471
|
+
def show_header(self):
|
|
472
|
+
if __debug__:
|
|
473
|
+
tecutil.api_moved('ContourLegend.show_header',
|
|
474
|
+
'ContourLegend.header.show',
|
|
475
|
+
'1.4.2', '2021 R1', warning=True)
|
|
476
|
+
return self._get_style(bool, sv.SHOWHEADER)
|
|
477
|
+
|
|
478
|
+
@show_header.setter
|
|
479
|
+
def show_header(self, value):
|
|
480
|
+
if __debug__:
|
|
481
|
+
tecutil.api_moved('ContourLegend.show_header',
|
|
482
|
+
'ContourLegend.header.show',
|
|
483
|
+
'1.4.2', '2021 R1', warning=True)
|
|
484
|
+
self._set_style(bool(value), sv.SHOWHEADER)
|
|
485
|
+
|
|
486
|
+
@property
|
|
487
|
+
def label_step(self):
|
|
488
|
+
"""`int`: Step size between labels along the legend.
|
|
489
|
+
|
|
490
|
+
This is an alias for `ContourLegend.contour.labels.step
|
|
491
|
+
<ContourLabels.step>`::
|
|
492
|
+
|
|
493
|
+
>>> contour = frame.plot().contour(0)
|
|
494
|
+
>>> contour.legend.label_step = 3
|
|
495
|
+
>>> print(contour.labels.step)
|
|
496
|
+
3
|
|
497
|
+
"""
|
|
498
|
+
return self.contour.labels.step
|
|
499
|
+
|
|
500
|
+
@label_step.setter
|
|
501
|
+
def label_step(self, step):
|
|
502
|
+
self.contour.labels.step = step
|
|
503
|
+
|
|
504
|
+
@property
|
|
505
|
+
def label_format(self):
|
|
506
|
+
"""`LabelFormat`: Number formatting for labels along the legend.
|
|
507
|
+
|
|
508
|
+
This is an alias for `ContourLegend.contour.labels.format
|
|
509
|
+
<ContourLabels.format>`::
|
|
510
|
+
|
|
511
|
+
>>> contour = frame.plot().contour(0)
|
|
512
|
+
>>> contour.legend.label_format.precision = 3
|
|
513
|
+
>>> print(contour.labels.format.precision)
|
|
514
|
+
3
|
|
515
|
+
"""
|
|
516
|
+
return self.contour.labels.format
|
tecplot/legend/legend.py
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
from builtins import super
|
|
2
|
+
|
|
3
|
+
from ..constant import *
|
|
4
|
+
from ..exception import *
|
|
5
|
+
from ..tecutil import sv
|
|
6
|
+
from .. import session, tecutil, text
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Legend(session.Style):
|
|
10
|
+
@property
|
|
11
|
+
def box(self):
|
|
12
|
+
"""`text.TextBox`: Legend box attributes.
|
|
13
|
+
|
|
14
|
+
Example usage::
|
|
15
|
+
|
|
16
|
+
>>> from tecplot.constant import PlotType, Color
|
|
17
|
+
>>> plot = frame.plot(PlotType.XYLine)
|
|
18
|
+
>>> plot.legend.box.color = Color.Blue
|
|
19
|
+
"""
|
|
20
|
+
return text.TextBox(self)
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def show(self):
|
|
24
|
+
"""`bool`: Show or hide the legend.
|
|
25
|
+
|
|
26
|
+
Example usage::
|
|
27
|
+
|
|
28
|
+
>>> from tecplot.constant import PlotType
|
|
29
|
+
>>> legend = frame.plot(PlotType.XYLine).legend
|
|
30
|
+
>>> legend.show = True
|
|
31
|
+
"""
|
|
32
|
+
return self._get_style(bool, sv.SHOW)
|
|
33
|
+
|
|
34
|
+
@show.setter
|
|
35
|
+
def show(self, value):
|
|
36
|
+
self._set_style(bool(value), sv.SHOW)
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def anchor_alignment(self):
|
|
40
|
+
"""`AnchorAlignment`: Anchor location of the legend.
|
|
41
|
+
|
|
42
|
+
Example usage::
|
|
43
|
+
|
|
44
|
+
>>> from tecplot.constant import AnchorAlignment, PlotType
|
|
45
|
+
>>> legend = frame.plot(PlotType.XYLine).legend
|
|
46
|
+
>>> legend.anchor_alignment = AnchorAlignment.BottomCenter
|
|
47
|
+
"""
|
|
48
|
+
return self._get_style(AnchorAlignment, sv.ANCHORALIGNMENT)
|
|
49
|
+
|
|
50
|
+
@anchor_alignment.setter
|
|
51
|
+
def anchor_alignment(self, value):
|
|
52
|
+
self._set_style(AnchorAlignment(value), sv.ANCHORALIGNMENT)
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def text_color(self):
|
|
56
|
+
"""`Color`: Color of legend text.
|
|
57
|
+
|
|
58
|
+
Example usage::
|
|
59
|
+
|
|
60
|
+
>>> from tecplot.constant import PlotType, Color
|
|
61
|
+
>>> legend = frame.plot(PlotType.XYLine).legend
|
|
62
|
+
>>> legend.text_color = Color.Blue
|
|
63
|
+
"""
|
|
64
|
+
return self._get_style(Color, sv.TEXTCOLOR)
|
|
65
|
+
|
|
66
|
+
@text_color.setter
|
|
67
|
+
def text_color(self, value):
|
|
68
|
+
self._set_style(Color(value), sv.TEXTCOLOR)
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def position(self):
|
|
72
|
+
"""`tuple`: Position as a percentage of frame width/height.
|
|
73
|
+
|
|
74
|
+
The legend is automatically placed for you. You may specify the
|
|
75
|
+
:math:`(x,y)` position of the legend by setting this value, where
|
|
76
|
+
:math:`x` is the percentage of frame width, and :math:`y` is a
|
|
77
|
+
percentage of frame height.
|
|
78
|
+
|
|
79
|
+
Example usage::
|
|
80
|
+
|
|
81
|
+
>>> from tecplot.constant import PlotType
|
|
82
|
+
>>> legend = frame.plot(PlotType.XYLine).legend
|
|
83
|
+
>>> legend.position = (10, 30)
|
|
84
|
+
"""
|
|
85
|
+
return session.XY(self, sv.XYPOS)
|
|
86
|
+
|
|
87
|
+
@position.setter
|
|
88
|
+
def position(self, pos):
|
|
89
|
+
session.XY(self, sv.XYPOS)[:] = pos
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class TabularLegend(Legend):
|
|
93
|
+
@property
|
|
94
|
+
def row_spacing(self):
|
|
95
|
+
"""`float`: Spacing between rows in the legend.
|
|
96
|
+
|
|
97
|
+
Example usage::
|
|
98
|
+
|
|
99
|
+
>>> from tecplot.constant import PlotType
|
|
100
|
+
>>> legend = frame.plot(PlotType.XYLine).legend
|
|
101
|
+
>>> legend.row_spacing = 1.5
|
|
102
|
+
"""
|
|
103
|
+
return self._get_style(float, sv.ROWSPACING)
|
|
104
|
+
|
|
105
|
+
@row_spacing.setter
|
|
106
|
+
def row_spacing(self, value):
|
|
107
|
+
self._set_style(float(value), sv.ROWSPACING)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class CategoryLegend(TabularLegend):
|
|
111
|
+
@property
|
|
112
|
+
def show_text(self):
|
|
113
|
+
"""`bool`: Show/hide mapping names in the legend.
|
|
114
|
+
|
|
115
|
+
Example usage::
|
|
116
|
+
|
|
117
|
+
>>> from tecplot.constant import PlotType
|
|
118
|
+
>>> plot = frame.plot(PlotType.XYLine)
|
|
119
|
+
>>> plot.legend.show_text = True
|
|
120
|
+
"""
|
|
121
|
+
return self._get_style(bool, sv.SHOWTEXT)
|
|
122
|
+
|
|
123
|
+
@show_text.setter
|
|
124
|
+
def show_text(self, value):
|
|
125
|
+
self._set_style(bool(value), sv.SHOWTEXT)
|
|
126
|
+
|
|
127
|
+
@property
|
|
128
|
+
def font(self):
|
|
129
|
+
"""`text.Font`: Legend font attributes.
|
|
130
|
+
|
|
131
|
+
.. note::
|
|
132
|
+
The font `size_units <tecplot.text.Font.size_units>` property
|
|
133
|
+
may only be set to `Units.Frame` or `Units.Point`.
|
|
134
|
+
|
|
135
|
+
Example usage::
|
|
136
|
+
|
|
137
|
+
>>> from tecplot.constant import PlotType
|
|
138
|
+
>>> plot = frame.plot(PlotType.XYLine)
|
|
139
|
+
>>> plot.legend.font.italic = True
|
|
140
|
+
"""
|
|
141
|
+
return text.LegendFont(self)
|