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.
Files changed (97) hide show
  1. pytecplot-1.5.2.dist-info/LICENSE.html +77 -0
  2. pytecplot-1.5.2.dist-info/METADATA +508 -0
  3. pytecplot-1.5.2.dist-info/RECORD +97 -0
  4. pytecplot-1.5.2.dist-info/WHEEL +5 -0
  5. pytecplot-1.5.2.dist-info/top_level.txt +1 -0
  6. tecplot/__init__.py +94 -0
  7. tecplot/annotation/__init__.py +7 -0
  8. tecplot/annotation/annotation.py +223 -0
  9. tecplot/annotation/geometry.py +369 -0
  10. tecplot/annotation/georeference.py +33 -0
  11. tecplot/annotation/image.py +185 -0
  12. tecplot/annotation/iter.py +105 -0
  13. tecplot/annotation/polyline.py +381 -0
  14. tecplot/annotation/text.py +744 -0
  15. tecplot/constant.py +401 -0
  16. tecplot/data/__init__.py +34 -0
  17. tecplot/data/array.py +645 -0
  18. tecplot/data/create.py +1 -0
  19. tecplot/data/dataset.py +1809 -0
  20. tecplot/data/extract.py +544 -0
  21. tecplot/data/face_neighbors.py +494 -0
  22. tecplot/data/facemap.py +814 -0
  23. tecplot/data/load.py +2075 -0
  24. tecplot/data/nodemap.py +577 -0
  25. tecplot/data/operate.py +928 -0
  26. tecplot/data/query.py +334 -0
  27. tecplot/data/save.py +343 -0
  28. tecplot/data/variable.py +280 -0
  29. tecplot/data/zone.py +841 -0
  30. tecplot/exception.py +201 -0
  31. tecplot/export/__init__.py +13 -0
  32. tecplot/export/animation.py +521 -0
  33. tecplot/export/export_setup.py +318 -0
  34. tecplot/export/image.py +577 -0
  35. tecplot/export/print_setup.py +218 -0
  36. tecplot/export/time_animation.py +607 -0
  37. tecplot/extension/__init__.py +14 -0
  38. tecplot/extension/ipython.py +68 -0
  39. tecplot/layout/__init__.py +20 -0
  40. tecplot/layout/frame.py +1285 -0
  41. tecplot/layout/layout.py +488 -0
  42. tecplot/layout/page.py +541 -0
  43. tecplot/legend/__init__.py +4 -0
  44. tecplot/legend/contour_legend.py +516 -0
  45. tecplot/legend/legend.py +141 -0
  46. tecplot/legend/line_legend.py +66 -0
  47. tecplot/legend/rgb_coloring_legend.py +291 -0
  48. tecplot/legend/scatter_legend.py +136 -0
  49. tecplot/macro.py +339 -0
  50. tecplot/plot/__init__.py +62 -0
  51. tecplot/plot/axes.py +881 -0
  52. tecplot/plot/axis.py +1350 -0
  53. tecplot/plot/blanking.py +584 -0
  54. tecplot/plot/contour.py +1302 -0
  55. tecplot/plot/effects.py +162 -0
  56. tecplot/plot/fieldmap.py +2159 -0
  57. tecplot/plot/grid.py +758 -0
  58. tecplot/plot/isosurface.py +1167 -0
  59. tecplot/plot/labels.py +338 -0
  60. tecplot/plot/linemap.py +1905 -0
  61. tecplot/plot/linking.py +489 -0
  62. tecplot/plot/plot.py +1791 -0
  63. tecplot/plot/rgb_coloring.py +281 -0
  64. tecplot/plot/scatter.py +396 -0
  65. tecplot/plot/slice.py +1544 -0
  66. tecplot/plot/streamtrace.py +1949 -0
  67. tecplot/plot/symbol.py +567 -0
  68. tecplot/plot/ticks.py +666 -0
  69. tecplot/plot/title.py +380 -0
  70. tecplot/plot/vector.py +679 -0
  71. tecplot/plot/view.py +868 -0
  72. tecplot/session/__init__.py +112 -0
  73. tecplot/session/aux_data.py +276 -0
  74. tecplot/session/config.py +92 -0
  75. tecplot/session/session.py +425 -0
  76. tecplot/session/state_changed.py +225 -0
  77. tecplot/session/style.py +504 -0
  78. tecplot/tecutil/__init__.py +16 -0
  79. tecplot/tecutil/arglist.py +230 -0
  80. tecplot/tecutil/captured_output.py +177 -0
  81. tecplot/tecutil/constant.py +1312 -0
  82. tecplot/tecutil/index_set.py +118 -0
  83. tecplot/tecutil/lock.py +36 -0
  84. tecplot/tecutil/message_pb2.py +39 -0
  85. tecplot/tecutil/preamble.py +54 -0
  86. tecplot/tecutil/stringlist.py +114 -0
  87. tecplot/tecutil/sv.py +1662 -0
  88. tecplot/tecutil/tecutil.py +12402 -0
  89. tecplot/tecutil/tecutil_client.py +627 -0
  90. tecplot/tecutil/tecutil_connector.py +937 -0
  91. tecplot/tecutil/tecutil_rpc.py +6845 -0
  92. tecplot/tecutil/util.py +332 -0
  93. tecplot/text/__init__.py +3 -0
  94. tecplot/text/font.py +224 -0
  95. tecplot/text/label_format.py +374 -0
  96. tecplot/text/textbox.py +106 -0
  97. tecplot/version.py +41 -0
@@ -0,0 +1,281 @@
1
+ from builtins import super
2
+
3
+ from ..constant import *
4
+ from ..exception import *
5
+ from ..tecutil import _tecutil_connector, sv
6
+ from .. import legend, session, tecutil, version
7
+
8
+
9
+ class RGBColoring(session.Style):
10
+ """RGB coloring (multivariate contour) style control.
11
+
12
+ .. code-block:: python
13
+ :emphasize-lines: 39-53
14
+
15
+ import os
16
+ import numpy as np
17
+
18
+ import tecplot as tp
19
+ from tecplot.constant import *
20
+
21
+
22
+ def normalize_variable(dataset, varname, nsigma=2):
23
+ '''
24
+ Normalize a variable such that the specified number of standard deviations
25
+ are within the range [0.5, 1] and the mean is transformed to 0.5. The
26
+ new variable will append " normalized" to the original variable's name.
27
+ '''
28
+ with tp.session.suspend():
29
+ newvarname = varname + ' normalized'
30
+ dataset.add_variable(newvarname)
31
+ data = np.concatenate([z.values(varname).as_numpy_array()
32
+ for z in dataset.zones()])
33
+ vmin = data.mean() - nsigma * data.std()
34
+ vmax = data.mean() + nsigma * data.std()
35
+ for z in dataset.zones():
36
+ arr = z.values(varname).as_numpy_array()
37
+ z.values(newvarname)[:] = (arr - vmin) / (vmax - vmin)
38
+
39
+
40
+ examples_dir = tp.session.tecplot_examples_directory()
41
+ infile = os.path.join(examples_dir, 'SimpleData', 'HeatExchanger.plt')
42
+ dataset = tp.data.load_tecplot(infile)
43
+
44
+ frame = tp.active_frame()
45
+ plot = frame.plot(PlotType.Cartesian2D)
46
+ plot.show_contour = True
47
+
48
+ # Variables must be normalized relative to each other
49
+ # to make effective use of RGB coloring.
50
+ normalize_variable(dataset, 'T(K)')
51
+ normalize_variable(dataset, 'P(N)')
52
+
53
+ plot.rgb_coloring.mode = RGBMode.SpecifyGB
54
+
55
+ # all three channel variables must be set even if
56
+ # we are only contouring on two of them.
57
+ plot.rgb_coloring.red_variable = dataset.variable(0)
58
+ plot.rgb_coloring.green_variable = dataset.variable('P(N) normalized')
59
+ plot.rgb_coloring.blue_variable = dataset.variable('T(K) normalized')
60
+
61
+ plot.rgb_coloring.legend.show = True
62
+ plot.rgb_coloring.legend.use_variable_for_green_label = False
63
+ plot.rgb_coloring.legend.green_label = 'Pressure'
64
+ plot.rgb_coloring.legend.use_variable_for_blue_label = False
65
+ plot.rgb_coloring.legend.blue_label = 'Temperature'
66
+
67
+ plot.fieldmaps().contour.flood_contour_group = plot.rgb_coloring
68
+
69
+ tp.export.save_png('rgb_coloring.png')
70
+
71
+ .. figure:: /_static/images/rgb_coloring.png
72
+ :width: 300px
73
+ :figwidth: 300px
74
+ """
75
+ def __init__(self, plot):
76
+ self.plot = plot
77
+ super().__init__(sv.GLOBALRGB, **plot._kw)
78
+
79
+ def __eq__(self, other):
80
+ return self.plot == other.plot
81
+
82
+ def __ne__(self, other):
83
+ return not (self == other)
84
+
85
+ @property
86
+ def index(self):
87
+ """`Index`: Color `Index` for RGB Coloring.
88
+
89
+ This property is used internally to identify it as a contour flooding
90
+ option.
91
+ """
92
+ return tecutil.Index(Color.RGBColor.value)
93
+
94
+ @property
95
+ def legend(self):
96
+ """`RGBColoringLegend`: Legend placement and style control.
97
+
98
+ Example usage::
99
+
100
+ >>> plot.rgb_coloring.legend.show = True
101
+ """
102
+ return legend.RGBColoringLegend(self)
103
+
104
+ @property
105
+ def mode(self):
106
+ """`RGBMode`: Which channels to use for RGB coloring.
107
+
108
+ Example usage::
109
+
110
+ >>> from tecplot.constant import RGBMode
111
+ >>> plot.rgb_coloring.mode = RGBMode.SpecifyRB
112
+ """
113
+ return self._get_style(RGBMode, sv.RGBMODE)
114
+
115
+ @mode.setter
116
+ def mode(self, value):
117
+ self._set_style(RGBMode(value), sv.RGBMODE)
118
+
119
+ @property
120
+ def min_intensity(self):
121
+ """`float`: `Variable` value at minimum intensity for each channel.
122
+
123
+ This should typically be set to the minimum value of the data being
124
+ plotted::
125
+
126
+ >>> plot.rgb_coloring.min_intensity = dataset.variable('P').min()
127
+ """
128
+ return self._get_style(float, sv.RANGEMIN)
129
+
130
+ @min_intensity.setter
131
+ def min_intensity(self, value):
132
+ self._set_style(float(value), sv.RANGEMIN)
133
+
134
+ @property
135
+ def max_intensity(self):
136
+ """`float`: `Variable` value at maximum intensity for each channel.
137
+
138
+ This should typically be set to the maximum value of the data being
139
+ plotted::
140
+
141
+ >>> plot.rgb_coloring.max_intensity = dataset.variable('P').max()
142
+ """
143
+ return self._get_style(float, sv.RANGEMAX)
144
+
145
+ @max_intensity.setter
146
+ def max_intensity(self, value):
147
+ self._set_style(float(value), sv.RANGEMAX)
148
+
149
+ def _ensure_valid_rgb_variables(self, index):
150
+ """
151
+ Note: this is essentially a work-around for behavior in the Tecplot
152
+ engine where setting a single RGB channel would be reverted when
153
+ the engine goes to an on-idle state. The engine was changed to
154
+ allow setting a single channel in 2018 R3 but this function remains
155
+ so that setting RGB channel variables still work with 2018 R2.
156
+ However, it requires the suspend context which was not available
157
+ in 2018 R1.
158
+ """
159
+ if _tecutil_connector.connected:
160
+ r = self.red_variable_index
161
+ g = self.green_variable_index
162
+ b = self.blue_variable_index
163
+ if any(x < 0 for x in (r, g, b)):
164
+ r = tecutil.Index(index if r < 0 else r)
165
+ g = tecutil.Index(index if g < 0 else g)
166
+ b = tecutil.Index(index if b < 0 else b)
167
+ with session.suspend():
168
+ self._set_style(r, sv.REDCHANNELVAR)
169
+ self._set_style(g, sv.GREENCHANNELVAR)
170
+ self._set_style(b, sv.BLUECHANNELVAR)
171
+
172
+ @property
173
+ def red_variable_index(self):
174
+ """`Index`: `Variable` `Index` to use for the red channel.
175
+
176
+ Example usage::
177
+
178
+ >>> plot.rgb_coloring.red_variable_index = 5
179
+
180
+ .. note::
181
+ In connected mode, setting this property requires Tecplot 360
182
+ version 2018 R2 or later.
183
+ """
184
+ return self._get_style(tecutil.Index, sv.REDCHANNELVAR)
185
+
186
+ @red_variable_index.setter
187
+ def red_variable_index(self, value):
188
+ self._ensure_valid_rgb_variables(value)
189
+ self._set_style(tecutil.Index(value), sv.REDCHANNELVAR)
190
+
191
+ @property
192
+ def red_variable(self):
193
+ """`Variable`: `Variable` to use for the red channel.
194
+
195
+ Example usage::
196
+
197
+ >>> plot.rgb_coloring.red_variable = dataset.variable('Gas')
198
+
199
+ .. note::
200
+ In connected mode, setting this property requires Tecplot 360
201
+ version 2018 R2 or later.
202
+ """
203
+ return self.plot.frame.dataset.variable(self.red_variable_index)
204
+
205
+ @red_variable.setter
206
+ def red_variable(self, variable):
207
+ self.red_variable_index = variable.index
208
+
209
+ @property
210
+ def green_variable_index(self):
211
+ """`Index`: `Variable` `Index` to use for the green channel.
212
+
213
+ Example usage::
214
+
215
+ >>> plot.rgb_coloring.green_variable_index = 3
216
+
217
+ .. note::
218
+ In connected mode, setting this property requires Tecplot 360
219
+ version 2018 R2 or later.
220
+ """
221
+ return self._get_style(tecutil.Index, sv.GREENCHANNELVAR)
222
+
223
+ @green_variable_index.setter
224
+ def green_variable_index(self, value):
225
+ self._ensure_valid_rgb_variables(value)
226
+ self._set_style(tecutil.Index(value), sv.GREENCHANNELVAR)
227
+
228
+ @property
229
+ def green_variable(self):
230
+ """`Variable`: `Variable` to use for the green channel.
231
+
232
+ Example usage::
233
+
234
+ >>> plot.rgb_coloring.green_variable = dataset.variable('Oil')
235
+
236
+ .. note::
237
+ In connected mode, setting this property requires Tecplot 360
238
+ version 2018 R2 or later.
239
+ """
240
+ return self.plot.frame.dataset.variable(self.green_variable_index)
241
+
242
+ @green_variable.setter
243
+ def green_variable(self, variable):
244
+ self.green_variable_index = variable.index
245
+
246
+ @property
247
+ def blue_variable_index(self):
248
+ """`Index`: `Variable` `Index` to use for the blue channel.
249
+
250
+ Example usage::
251
+
252
+ >>> plot.rgb_coloring.blue_variable_index = 4
253
+
254
+ .. note::
255
+ In connected mode, setting this property requires Tecplot 360
256
+ version 2018 R2 or later.
257
+ """
258
+ return self._get_style(tecutil.Index, sv.BLUECHANNELVAR)
259
+
260
+ @blue_variable_index.setter
261
+ def blue_variable_index(self, value):
262
+ self._ensure_valid_rgb_variables(value)
263
+ self._set_style(tecutil.Index(value), sv.BLUECHANNELVAR)
264
+
265
+ @property
266
+ def blue_variable(self):
267
+ """`Variable`: `Variable` to use for the blue channel.
268
+
269
+ Example usage::
270
+
271
+ >>> plot.rgb_coloring.blue_variable = dataset.variable('Water')
272
+
273
+ .. note::
274
+ In connected mode, setting this property requires Tecplot 360
275
+ version 2018 R2 or later.
276
+ """
277
+ return self.plot.frame.dataset.variable(self.blue_variable_index)
278
+
279
+ @blue_variable.setter
280
+ def blue_variable(self, variable):
281
+ self.blue_variable_index = variable.index
@@ -0,0 +1,396 @@
1
+ from builtins import str, super
2
+
3
+ from ..constant import *
4
+ from ..exception import *
5
+ from ..tecutil import sv
6
+ from .. import legend, session, tecutil, text
7
+ from . import labels, symbol
8
+
9
+
10
+ class PieChartsWedge(session.Style):
11
+ """Individual wedge style control for pie charts.
12
+
13
+ .. seealso:: `PieCharts`
14
+ """
15
+ def __init__(self, pie_charts, index):
16
+ self.pie_charts = pie_charts
17
+ self.index = tecutil.Index(index)
18
+ self.plot = pie_charts.scatter.plot
19
+ super().__init__(pie_charts._sv, sv.WEDGE, offset1=self.index,
20
+ **pie_charts._kw)
21
+
22
+ @property
23
+ def show(self):
24
+ """`bool`
25
+
26
+ .. note::
27
+
28
+ At least one fieldmap must have scatter symbol shape set
29
+ to `GeomShape.PieChart` before setting the show property
30
+ of the wedges to `True`::
31
+
32
+ from tecplot.constant import GeomShape
33
+ plot.fieldmap(0).scatter.symbol().shape = GeomShape.PieChart
34
+ plot.scatter.pie_charts.wedge(0).show = True
35
+ """
36
+ return self._get_style(bool, sv.INCLUDE)
37
+
38
+ @show.setter
39
+ def show(self, value):
40
+ self._set_style(bool(value), sv.INCLUDE)
41
+
42
+ @property
43
+ def show_label(self):
44
+ """`bool`"""
45
+ return self._get_style(bool, sv.SHOWLABEL)
46
+
47
+ @show_label.setter
48
+ def show_label(self, value):
49
+ self._set_style(bool(value), sv.SHOWLABEL)
50
+
51
+ @property
52
+ def label_text(self):
53
+ """`str`"""
54
+ return self._get_style(str, sv.LABELTEXT)
55
+
56
+ @label_text.setter
57
+ def label_text(self, value):
58
+ self._set_style(str(value), sv.LABELTEXT)
59
+
60
+ @property
61
+ def color(self):
62
+ """`Color`"""
63
+ return self._get_style(Color, sv.COLOR)
64
+
65
+ @color.setter
66
+ def color(self, value):
67
+ self._set_style(Color(value), sv.COLOR)
68
+
69
+ @property
70
+ def variable_index(self):
71
+ """`Index`"""
72
+ return self._get_style(tecutil.Index, sv.VAR)
73
+
74
+ @variable_index.setter
75
+ def variable_index(self, value):
76
+ self._set_style(tecutil.Index(value), sv.VAR)
77
+
78
+ @property
79
+ def variable(self):
80
+ """`Variable`"""
81
+ return self.plot.frame.dataset.variable(self.variable_index)
82
+
83
+ @variable.setter
84
+ def variable(self, variable):
85
+ self.variable_index = variable.index
86
+
87
+
88
+ class PieCharts(session.Style):
89
+ """Pie charts displayed at each scatter point.
90
+
91
+ .. code-block:: python
92
+ :emphasize-lines: 46-59
93
+
94
+ import os
95
+ import numpy as np
96
+
97
+ import tecplot as tp
98
+ from tecplot.constant import *
99
+
100
+
101
+ def normalize_variable(dataset, varname, nsigma=2):
102
+ '''
103
+ Normalize a variable such that the specified number of standard deviations
104
+ are within the range [0.5, 1] and the mean is transformed to 0.5. The
105
+ new variable will append " normalized" to the original variable's name.
106
+ '''
107
+ with tp.session.suspend():
108
+ newvarname = varname + ' normalized'
109
+ dataset.add_variable(newvarname)
110
+ data = np.concatenate([z.values(varname).as_numpy_array()
111
+ for z in dataset.zones()])
112
+ vmin = data.mean() - nsigma * data.std()
113
+ vmax = data.mean() + nsigma * data.std()
114
+ for z in dataset.zones():
115
+ arr = z.values(varname).as_numpy_array()
116
+ z.values(newvarname)[:] = (arr - vmin) / (vmax - vmin)
117
+
118
+
119
+ examples_dir = tp.session.tecplot_examples_directory()
120
+ infile = os.path.join(examples_dir, 'SimpleData', 'HeatExchanger.plt')
121
+ dataset = tp.data.load_tecplot(infile)
122
+
123
+ frame = tp.active_frame()
124
+ plot = frame.plot(PlotType.Cartesian2D)
125
+ plot.show_scatter = True
126
+
127
+ plot.axes.x_axis.min = 6
128
+ plot.axes.x_axis.max = 8
129
+ plot.axes.y_axis.min = 1.5
130
+ plot.axes.y_axis.max = 3.0
131
+
132
+ # Normalize variables to the range [0, 1]
133
+ normalize_variable(dataset, 'T(K)')
134
+ normalize_variable(dataset, 'P(N)')
135
+
136
+ frame.add_text(r'Normalized Temperature in Red', (50, 95), color=Color.Red)
137
+ frame.add_text(r'Normalized Pressure in Blue', (50, 92), color=Color.Blue)
138
+
139
+ fmaps = plot.fieldmaps()
140
+ fmaps.scatter.symbol().shape = GeomShape.PieChart
141
+ fmaps.scatter.size = 4.0
142
+
143
+ pie_charts = plot.scatter.pie_charts
144
+ pie_charts.wedge(0).show = True
145
+ pie_charts.wedge(0).show_label = False
146
+ pie_charts.wedge(0).variable = dataset.variable('T(K) normalized')
147
+ pie_charts.wedge(0).color = Color.Red
148
+
149
+ pie_charts.wedge(1).show = True
150
+ pie_charts.wedge(1).show_label = False
151
+ pie_charts.wedge(1).variable = dataset.variable('P(N) normalized')
152
+ pie_charts.wedge(1).color = Color.Blue
153
+
154
+ tp.export.save_png('pie_charts.png')
155
+
156
+ .. figure:: /_static/images/pie_charts.png
157
+ :width: 300px
158
+ :figwidth: 300px
159
+ """
160
+ def __init__(self, scatter):
161
+ self.scatter = scatter
162
+ super().__init__(scatter._sv, sv.PIECHARTS, **scatter._kw)
163
+
164
+ @property
165
+ def label_offset(self):
166
+ """`float`"""
167
+ return self._get_style(float, sv.LABELOFFSET)
168
+
169
+ @label_offset.setter
170
+ def label_offset(self, value):
171
+ self._set_style(float(value), sv.LABELOFFSET)
172
+
173
+ @property
174
+ def label_text(self):
175
+ """`str`"""
176
+ return self._get_style(str, sv.LABELTEXT)
177
+
178
+ @label_text.setter
179
+ def label_text(self, value):
180
+ self._set_style(str(value), sv.LABELTEXT)
181
+
182
+ @property
183
+ def label_color(self):
184
+ """`Color`"""
185
+ return self._get_style(Color, sv.LABELTEXTCOLOR)
186
+
187
+ @label_color.setter
188
+ def label_color(self, value):
189
+ self._set_style(Color(value), sv.LABELTEXTCOLOR)
190
+
191
+ @property
192
+ def label_font(self):
193
+ """`text.Font`"""
194
+ return text.Font(self, sv.LABELTEXTSHAPE)
195
+
196
+ @property
197
+ def show_zero_value_wedge_labels(self):
198
+ """`bool`"""
199
+ return self._get_style(bool, sv.SHOWLABELFORZEROVALUEWEDGES)
200
+
201
+ @show_zero_value_wedge_labels.setter
202
+ def show_zero_value_wedge_labels(self, value):
203
+ self._set_style(bool(value), sv.SHOWLABELFORZEROVALUEWEDGES)
204
+
205
+ @property
206
+ def start_angle(self):
207
+ """`float`"""
208
+ return self._get_style(float, sv.STARTANGLE)
209
+
210
+ @start_angle.setter
211
+ def start_angle(self, value):
212
+ self._set_style(float(value), sv.STARTANGLE)
213
+
214
+ def wedge(self, index):
215
+ """`PieChartsWedge`"""
216
+ return PieChartsWedge(self, index)
217
+
218
+
219
+ class Scatter(session.Style):
220
+ """Plot-local scatter style settings.
221
+
222
+ This class controls the style of drawn scatter points on a specific plot.
223
+
224
+ .. code-block:: python
225
+ :emphasize-lines: 15
226
+
227
+ from os import path
228
+ import tecplot as tp
229
+ from tecplot.constant import *
230
+
231
+ examples_dir = tp.session.tecplot_examples_directory()
232
+ infile = path.join(examples_dir, 'SimpleData', 'HeatExchanger.plt')
233
+ dataset = tp.data.load_tecplot(infile)
234
+
235
+ frame = tp.active_frame()
236
+ frame.plot_type = PlotType.Cartesian2D
237
+ plot = frame.plot()
238
+ plot.contour(0).variable = dataset.variable('T(K)')
239
+ plot.show_scatter = True
240
+
241
+ plot.scatter.variable = dataset.variable('P(N)')
242
+
243
+ for z in dataset.zones():
244
+ scatter = plot.fieldmap(z).scatter
245
+ scatter.symbol_type = SymbolType.Geometry
246
+ scatter.symbol().shape = GeomShape.Circle
247
+ scatter.fill_mode = FillMode.UseSpecificColor
248
+ scatter.fill_color = plot.contour(0)
249
+ scatter.color = plot.contour(0)
250
+ scatter.size_by_variable = True
251
+
252
+ frame.add_text('Size of dots indicate relative pressure', (20, 80))
253
+
254
+ # ensure consistent output between interactive (connected) and batch
255
+ plot.contour(0).levels.reset_to_nice()
256
+
257
+ tp.export.save_png('scatter.png')
258
+
259
+ .. figure:: /_static/images/scatter.png
260
+ :width: 300px
261
+ :figwidth: 300px
262
+ """
263
+ def __init__(self, plot):
264
+ self.plot = plot
265
+ super().__init__(sv.GLOBALSCATTER, uniqueid=self.plot.frame.uid)
266
+
267
+ @property
268
+ def base_font(self):
269
+ """`BaseFont`: Default typeface to use for text scatter symbols.
270
+
271
+ Example usage::
272
+
273
+ >>> plot.scatter.base_font.typeface = 'Times'
274
+ """
275
+ return text.BaseFont(*self._sv, **self._kw)
276
+
277
+ @property
278
+ def legend(self):
279
+ """`ScatterLegend`: Scatter symbol legend.
280
+
281
+ Example usage::
282
+
283
+ >>> plot.scatter.legend.show = True
284
+ """
285
+ return legend.ScatterLegend(self)
286
+
287
+ @property
288
+ def pie_charts(self):
289
+ return PieCharts(self)
290
+
291
+ @property
292
+ def reference_symbol(self):
293
+ """`ScatterReferenceSymbol`: Reference symbol for scatter plots.
294
+
295
+ The reference scatter symbol is only shown when the scatter symbols are
296
+ sized by a `Variable` in the `Dataset <data.Dataset>`. Example::
297
+
298
+ >>> plot.fieldmap(0).scatter.size_by_variable = True
299
+ >>> plot.scatter.variable = dataset.variable('s')
300
+ >>> plot.scatter.reference_symbol.show = True
301
+ """
302
+ return symbol.ScatterReferenceSymbol(self)
303
+
304
+ @property
305
+ def relative_size(self):
306
+ """`float`: Relative size of the reference symbol.
307
+
308
+ Relative size will be in ``cm`` when units are set to
309
+ `RelativeSizeUnits.Page`. Example usage::
310
+
311
+ >>> plot.scatter.relative_size = 20
312
+ """
313
+ return self._get_style(float, sv.RELATIVESIZE)
314
+
315
+ @relative_size.setter
316
+ def relative_size(self, value):
317
+ self._set_style(float(value), sv.RELATIVESIZE)
318
+
319
+ @property
320
+ def relative_size_units(self):
321
+ """`RelativeSizeUnits`: Use grid or page units for relative size.
322
+
323
+ Relative size will be in ``cm`` when units are set to
324
+ `RelativeSizeUnits.Page`. Example usage::
325
+
326
+ >>> from tecplot.constant import RelativeSizeUnits
327
+ >>> plot.scatter.relative_size_units = RelativeSizeUnits.Grid
328
+ >>> plot.scatter.relative_size = 2.0
329
+ """
330
+ if self._get_style(bool, sv.RELATIVESIZEINGRIDUNITS):
331
+ return RelativeSizeUnits.Grid
332
+ else:
333
+ return RelativeSizeUnits.Page
334
+
335
+ @relative_size_units.setter
336
+ def relative_size_units(self, value):
337
+ value = RelativeSizeUnits(value) == RelativeSizeUnits.Grid
338
+ self._set_style(value, sv.RELATIVESIZEINGRIDUNITS)
339
+
340
+ @property
341
+ def sphere_render_quality(self):
342
+ """`SphereScatterRenderQuality`: render quality of spheres
343
+
344
+ Example usage::
345
+
346
+ >>> from tecplot.constant import *
347
+ >>> plot.fieldmap(0).scatter.symbol().shape = GeomShape.Sphere
348
+ >>> scatter = plot.scatter
349
+ >>> scatter.sphere_render_quality = SphereScatterRenderQuality.Low
350
+ """
351
+ return self._get_style(SphereScatterRenderQuality,
352
+ sv.SPHERESCATTERRENDERQUALITY)
353
+
354
+ @sphere_render_quality.setter
355
+ def sphere_render_quality(self, value):
356
+ self._set_style(SphereScatterRenderQuality(value),
357
+ sv.SPHERESCATTERRENDERQUALITY)
358
+
359
+ @property
360
+ def variable_index(self):
361
+ """Zero-based index of the `Variable` used for size of scatter symbols.
362
+
363
+ .. code-block:: python
364
+
365
+ >>> plot.scatter.variable_index = dataset.variable('P').index
366
+ >>> plot.fieldmap(0).scatter.size_by_variable = True
367
+
368
+ The `Dataset <data.Dataset>` attached to this contour group's `Frame <layout.Frame>` is used, and
369
+ the variable itself can be obtained through it::
370
+
371
+ >>> scatter = plot.scatter
372
+ >>> scatter_var = dataset.variable(scatter.variable_index)
373
+ >>> scatter_var.index == scatter.variable_index
374
+ True
375
+ """
376
+ return self._get_style(tecutil.Index, sv.VAR)
377
+
378
+ @variable_index.setter
379
+ def variable_index(self, index):
380
+ self._set_style(tecutil.Index(index), sv.VAR)
381
+
382
+ @property
383
+ def variable(self):
384
+ """The `Variable` to be used when sizing scatter symbols.
385
+
386
+ The variable must belong to the `Dataset <data.Dataset>` attached to the `Frame <layout.Frame>`
387
+ that holds this `ContourGroup`. Example usage::
388
+
389
+ >>> plot.scatter.variable = dataset.variable('P')
390
+ >>> plot.fieldmap(0).scatter.size_by_variable = True
391
+ """
392
+ return self.plot.frame.dataset.variable(self.variable_index)
393
+
394
+ @variable.setter
395
+ def variable(self, variable):
396
+ self.variable_index = variable.index