plotext-plus 1.0.9__py3-none-any.whl → 1.0.11__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.
- plotext_plus/__init__.py +20 -15
- plotext_plus/__main__.py +1 -0
- plotext_plus/_api.py +632 -371
- plotext_plus/_build.py +765 -149
- plotext_plus/_core.py +609 -164
- plotext_plus/_date.py +50 -32
- plotext_plus/_default.py +35 -28
- plotext_plus/_dict.py +807 -103
- plotext_plus/_doc.py +867 -296
- plotext_plus/_doc_utils.py +279 -245
- plotext_plus/_figure.py +1295 -303
- plotext_plus/_global.py +238 -140
- plotext_plus/_matrix.py +217 -63
- plotext_plus/_monitor.py +1036 -489
- plotext_plus/_output.py +29 -23
- plotext_plus/_shtab.py +2 -0
- plotext_plus/_themes.py +363 -247
- plotext_plus/_utility.py +581 -313
- plotext_plus/api.py +418 -332
- plotext_plus/charts.py +47 -24
- plotext_plus/core.py +570 -177
- plotext_plus/mcp_cli.py +15 -13
- plotext_plus/mcp_server.py +813 -332
- plotext_plus/plotext_cli.py +414 -275
- plotext_plus/plotting.py +86 -70
- plotext_plus/themes.py +10 -13
- plotext_plus/utilities.py +33 -33
- plotext_plus/utils.py +240 -140
- {plotext_plus-1.0.9.dist-info → plotext_plus-1.0.11.dist-info}/METADATA +32 -27
- plotext_plus-1.0.11.dist-info/RECORD +33 -0
- {plotext_plus-1.0.9.dist-info → plotext_plus-1.0.11.dist-info}/WHEEL +1 -1
- plotext_plus-1.0.9.dist-info/RECORD +0 -33
- {plotext_plus-1.0.9.dist-info → plotext_plus-1.0.11.dist-info}/entry_points.txt +0 -0
- {plotext_plus-1.0.9.dist-info → plotext_plus-1.0.11.dist-info}/licenses/LICENSE +0 -0
plotext_plus/_figure.py
CHANGED
|
@@ -1,90 +1,127 @@
|
|
|
1
|
-
from plotext_plus._default import default_figure_class
|
|
2
|
-
from plotext_plus._monitor import monitor_class
|
|
3
|
-
from plotext_plus._matrix import join_matrices
|
|
4
|
-
from plotext_plus._date import date_class
|
|
5
|
-
from plotext_plus._doc_utils import add
|
|
6
|
-
from time import time as _time
|
|
7
|
-
import plotext_plus._utility as ut
|
|
8
|
-
from time import time
|
|
9
1
|
import os
|
|
2
|
+
from time import time
|
|
3
|
+
|
|
4
|
+
import plotext_plus._utility as ut
|
|
5
|
+
from plotext_plus._date import DateClass
|
|
6
|
+
from plotext_plus._default import DefaultFigureClass
|
|
7
|
+
from plotext_plus._doc_utils import add
|
|
8
|
+
from plotext_plus._matrix import join_matrices
|
|
9
|
+
from plotext_plus._monitor import MonitorClass
|
|
10
10
|
|
|
11
11
|
# A figure is a general container of either a plot (called monitor) or another figure, when subplots are nested
|
|
12
12
|
# This creates a hierarchy of figures, where master is the main/initial global figure, and parent is the figure containing (or above) the one considered
|
|
13
|
-
# The active figure is the one that can be accessed with further plotext commands - like plot(), limitsize() etc ..
|
|
13
|
+
# The active figure is the one that can be accessed with further plotext commands - like plot(), limitsize() etc ..
|
|
14
14
|
# If a figure has no sub figures, then it is used for plotting, otherwise its sub figures are checked
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
self.
|
|
21
|
-
self.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
self.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
self.monitor
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
16
|
+
|
|
17
|
+
class _FigureClass:
|
|
18
|
+
|
|
19
|
+
def __init__(self, master=None, parent=None):
|
|
20
|
+
self._set_family(master, parent) # it sets master, parent and active figure
|
|
21
|
+
self.default = DefaultFigureClass() # default values of figure class
|
|
22
|
+
self.date = DateClass()
|
|
23
|
+
|
|
24
|
+
self._set_size(None, None) # no initial size for general figure
|
|
25
|
+
self.max_or_min = max # in a matrix of subplots the maximum height/width is considered (by default) for each row/column
|
|
26
|
+
|
|
27
|
+
self.monitor = (
|
|
28
|
+
MonitorClass() if self._is_master else self._parent.monitor.copy()
|
|
29
|
+
) # each figure has a monitor for plotting; which by default is deep copied from its parent figure monitor, so that a figure with multiple sub plots can have easily the same plot and plot settings and preferences (without rewriting code)
|
|
30
|
+
self.monitor.set_date(
|
|
31
|
+
self.date
|
|
32
|
+
) # to make sure that the date settings of a figure are the same for its subplots
|
|
33
|
+
|
|
34
|
+
(
|
|
35
|
+
self._set_master() if self._is_master else None
|
|
36
|
+
) # it sets the master figure size and other utilities
|
|
37
|
+
|
|
38
|
+
self._set_slots_max(
|
|
39
|
+
*self._master._size
|
|
40
|
+
) # sets the maximum number of sub figures in the current figure (from master figure size)
|
|
41
|
+
self.subplots(
|
|
42
|
+
0, 0
|
|
43
|
+
) # no sub figures added by default, so that the current figure is used for plotting
|
|
44
|
+
|
|
45
|
+
def _set_family(self, master=None, parent=None):
|
|
46
|
+
self._parent = (
|
|
47
|
+
self if parent is None else parent
|
|
48
|
+
) # the figure just above this one
|
|
49
|
+
self._master = self if master is None else master # the figure above all others
|
|
37
50
|
self._is_master = self is self._master
|
|
38
|
-
self._active =
|
|
51
|
+
self._active = (
|
|
52
|
+
self if self._is_master else self._master._active
|
|
53
|
+
) # the active figure, such that further plotting or settings commands refer to it
|
|
39
54
|
|
|
40
55
|
def _set_master(self):
|
|
41
|
-
self._limit_size(
|
|
42
|
-
|
|
56
|
+
self._limit_size(
|
|
57
|
+
True, True
|
|
58
|
+
) # limit size (only available for master, as sub figures are by default limited by parent figure)
|
|
59
|
+
self._set_terminal_size(*ut.terminal_size()) # get and set terminal size
|
|
43
60
|
self._set_master_size() # set master size to terminal
|
|
44
|
-
self._time = None
|
|
45
|
-
self._dummy =
|
|
61
|
+
self._time = None # computational time of show() method, only available for global figure
|
|
62
|
+
self._dummy = _FigureClass(
|
|
63
|
+
self._master, self._master
|
|
64
|
+
) # the master has a dumm container for subplots that do not actually exist (anymore due to change of size)
|
|
46
65
|
self._master.monitor.set_size(self._size)
|
|
47
66
|
self._dummy.monitor.set_size(self._size)
|
|
48
|
-
self._set_interactive()
|
|
67
|
+
self._set_interactive() # if to make the final figure interactive: every command gets directly printed
|
|
49
68
|
|
|
50
|
-
##############################################
|
|
51
|
-
########### Size Functions #############
|
|
52
|
-
##############################################
|
|
69
|
+
##############################################
|
|
70
|
+
########### Size Functions #############
|
|
71
|
+
##############################################
|
|
53
72
|
|
|
54
|
-
def _set_interactive(self, interactive
|
|
55
|
-
self._interactive =
|
|
73
|
+
def _set_interactive(self, interactive=None):
|
|
74
|
+
self._interactive = (
|
|
75
|
+
self.default.interactive if interactive is None else bool(interactive)
|
|
76
|
+
)
|
|
56
77
|
|
|
57
|
-
def _set_size(self, width
|
|
78
|
+
def _set_size(self, width=None, height=None):
|
|
58
79
|
self._width = None if width is None else int(width)
|
|
59
80
|
self._height = None if height is None else int(height)
|
|
60
81
|
self._size = [self._width, self._height]
|
|
61
82
|
|
|
62
|
-
def _limit_size(self, width
|
|
83
|
+
def _limit_size(self, width=None, height=None):
|
|
63
84
|
self._limit_width = self.default.limit_width if width is None else bool(width)
|
|
64
|
-
self._limit_height =
|
|
85
|
+
self._limit_height = (
|
|
86
|
+
self.default.limit_height if height is None else bool(height)
|
|
87
|
+
)
|
|
65
88
|
self._limit = [self._limit_width, self._limit_height]
|
|
66
89
|
|
|
67
|
-
def _set_terminal_size(self, width
|
|
90
|
+
def _set_terminal_size(self, width=None, height=None):
|
|
68
91
|
self._width_term = self.default._width_term if width is None else width
|
|
69
92
|
extra_lines = 2 if ut.is_ipython() else 1
|
|
70
|
-
self._height_term =
|
|
93
|
+
self._height_term = (
|
|
94
|
+
self.default._height_term
|
|
95
|
+
if height is None
|
|
96
|
+
else max(height - extra_lines, 0)
|
|
97
|
+
)
|
|
71
98
|
self._size_term = [self._width_term, self._height_term]
|
|
72
99
|
|
|
73
100
|
def _set_master_size(self):
|
|
74
|
-
width =
|
|
75
|
-
|
|
101
|
+
width = (
|
|
102
|
+
self._width_term
|
|
103
|
+
if self._width is None
|
|
104
|
+
or (self._width > self._width_term and self._limit_width)
|
|
105
|
+
else self._width
|
|
106
|
+
)
|
|
107
|
+
height = (
|
|
108
|
+
self._height_term
|
|
109
|
+
if self._height is None
|
|
110
|
+
or (self._height > self._height_term and self._limit_height)
|
|
111
|
+
else self._height
|
|
112
|
+
)
|
|
76
113
|
self._set_size(width, height)
|
|
77
|
-
|
|
78
|
-
##############################################
|
|
79
|
-
######### Subplots Functions ###########
|
|
80
|
-
##############################################
|
|
81
|
-
|
|
82
|
-
def _set_slots_max(self, width
|
|
83
|
-
self._rows_max = height
|
|
84
|
-
self._cols_max = width
|
|
114
|
+
|
|
115
|
+
##############################################
|
|
116
|
+
######### Subplots Functions ###########
|
|
117
|
+
##############################################
|
|
118
|
+
|
|
119
|
+
def _set_slots_max(self, width=None, height=None):
|
|
120
|
+
self._rows_max = height # (height + 1) // 3
|
|
121
|
+
self._cols_max = width # (width + 1) // 3
|
|
85
122
|
self._slots_max = [self._rows_max, self._cols_max]
|
|
86
123
|
|
|
87
|
-
def _set_slots(self, rows
|
|
124
|
+
def _set_slots(self, rows=None, cols=None):
|
|
88
125
|
rows = 1 if rows is None else int(abs(rows))
|
|
89
126
|
cols = 1 if cols is None else int(abs(cols))
|
|
90
127
|
self._rows = min(rows, self._rows_max)
|
|
@@ -92,15 +129,22 @@ class _figure_class():
|
|
|
92
129
|
self._Rows = list(range(1, self._rows + 1))
|
|
93
130
|
self._Cols = list(range(1, self._cols + 1))
|
|
94
131
|
self._slots = [self._rows, self._cols]
|
|
95
|
-
self._no_plots = 0 in self._slots
|
|
96
|
-
|
|
97
|
-
def _set_subplots(self):
|
|
98
|
-
self.subfig = [[_figure_class(self._master, self) for col in self._Cols] for row in self._Rows]
|
|
99
|
-
|
|
100
|
-
def _get_subplot(self, row = None, col = None):
|
|
101
|
-
return self.subfig[row - 1][col - 1] if row in self._Rows and col in self._Cols else self._master._dummy
|
|
132
|
+
self._no_plots = 0 in self._slots # or self._is_master
|
|
102
133
|
|
|
103
|
-
def
|
|
134
|
+
def _set_subplots(self):
|
|
135
|
+
self.subfig = [
|
|
136
|
+
[_FigureClass(self._master, self) for col in self._Cols]
|
|
137
|
+
for row in self._Rows
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
def _get_subplot(self, row=None, col=None):
|
|
141
|
+
return (
|
|
142
|
+
self.subfig[row - 1][col - 1]
|
|
143
|
+
if row in self._Rows and col in self._Cols
|
|
144
|
+
else self._master._dummy
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
def subplot(self, row=None, col=None):
|
|
104
148
|
row = 1 if row is None else int(abs(row))
|
|
105
149
|
col = 1 if col is None else int(abs(col))
|
|
106
150
|
active = self._get_subplot(row, col)
|
|
@@ -108,306 +152,1252 @@ class _figure_class():
|
|
|
108
152
|
self._master._active = active
|
|
109
153
|
return self._master._active
|
|
110
154
|
|
|
111
|
-
def subplots(self, rows
|
|
155
|
+
def subplots(self, rows=None, cols=None):
|
|
156
|
+
"""Configure the figure for multiple subplots in a grid layout.
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
rows (int, optional): Number of subplot rows. Defaults to None.
|
|
160
|
+
cols (int, optional): Number of subplot columns. Defaults to None.
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
Figure: Self for method chaining.
|
|
164
|
+
"""
|
|
112
165
|
self._set_slots(rows, cols)
|
|
113
166
|
self._set_subplots()
|
|
114
167
|
return self
|
|
115
168
|
|
|
116
|
-
##############################################
|
|
117
|
-
####### External Set Functions #########
|
|
118
|
-
##############################################
|
|
119
|
-
|
|
120
|
-
def title(self, label
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
def
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
def
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
169
|
+
##############################################
|
|
170
|
+
####### External Set Functions #########
|
|
171
|
+
##############################################
|
|
172
|
+
|
|
173
|
+
def title(self, label=None):
|
|
174
|
+
(
|
|
175
|
+
self.monitor.set_title(label)
|
|
176
|
+
if self._no_plots
|
|
177
|
+
else [
|
|
178
|
+
[self._get_subplot(row, col).title(label) for col in self._Cols]
|
|
179
|
+
for row in self._Rows
|
|
180
|
+
]
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
def xlabel(self, label=None, xside=None):
|
|
184
|
+
(
|
|
185
|
+
self.monitor.set_xlabel(label=label, xside=xside)
|
|
186
|
+
if self._no_plots
|
|
187
|
+
else [
|
|
188
|
+
[
|
|
189
|
+
self._get_subplot(row, col).xlabel(label=label, xside=xside)
|
|
190
|
+
for col in self._Cols
|
|
191
|
+
]
|
|
192
|
+
for row in self._Rows
|
|
193
|
+
]
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
def ylabel(self, label=None, yside=None):
|
|
197
|
+
(
|
|
198
|
+
self.monitor.set_ylabel(label=label, yside=yside)
|
|
199
|
+
if self._no_plots
|
|
200
|
+
else [
|
|
201
|
+
[
|
|
202
|
+
self._get_subplot(row, col).ylabel(label=label, yside=yside)
|
|
203
|
+
for col in self._Cols
|
|
204
|
+
]
|
|
205
|
+
for row in self._Rows
|
|
206
|
+
]
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
def xlim(self, left=None, right=None, xside=None):
|
|
210
|
+
(
|
|
211
|
+
self.monitor.set_xlim(left=left, right=right, xside=xside)
|
|
212
|
+
if self._no_plots
|
|
213
|
+
else [
|
|
214
|
+
[
|
|
215
|
+
self._get_subplot(row, col).xlim(
|
|
216
|
+
left=left, right=right, xside=xside
|
|
217
|
+
)
|
|
218
|
+
for col in self._Cols
|
|
219
|
+
]
|
|
220
|
+
for row in self._Rows
|
|
221
|
+
]
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
def ylim(self, lower=None, upper=None, yside=None):
|
|
225
|
+
(
|
|
226
|
+
self.monitor.set_ylim(lower=lower, upper=upper, yside=yside)
|
|
227
|
+
if self._no_plots
|
|
228
|
+
else [
|
|
229
|
+
[
|
|
230
|
+
self._get_subplot(row, col).ylim(
|
|
231
|
+
lower=lower, upper=upper, yside=yside
|
|
232
|
+
)
|
|
233
|
+
for col in self._Cols
|
|
234
|
+
]
|
|
235
|
+
for row in self._Rows
|
|
236
|
+
]
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
def xscale(self, scale=None, xside=None):
|
|
240
|
+
(
|
|
241
|
+
self.monitor.set_xscale(scale=scale, xside=xside)
|
|
242
|
+
if self._no_plots
|
|
243
|
+
else [
|
|
244
|
+
[
|
|
245
|
+
self._get_subplot(row, col).xscale(scale=scale, xside=xside)
|
|
246
|
+
for col in self._Cols
|
|
247
|
+
]
|
|
248
|
+
for row in self._Rows
|
|
249
|
+
]
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
def yscale(self, scale=None, yside=None):
|
|
253
|
+
(
|
|
254
|
+
self.monitor.set_yscale(scale=scale, yside=yside)
|
|
255
|
+
if self._no_plots
|
|
256
|
+
else [
|
|
257
|
+
[
|
|
258
|
+
self._get_subplot(row, col).yscale(scale=scale, yside=yside)
|
|
259
|
+
for col in self._Cols
|
|
260
|
+
]
|
|
261
|
+
for row in self._Rows
|
|
262
|
+
]
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
def xticks(self, ticks=None, labels=None, xside=None):
|
|
266
|
+
(
|
|
267
|
+
self.monitor.set_xticks(ticks=ticks, labels=labels, xside=xside)
|
|
268
|
+
if self._no_plots
|
|
269
|
+
else [
|
|
270
|
+
[
|
|
271
|
+
self._get_subplot(row, col).xticks(
|
|
272
|
+
ticks=ticks, labels=labels, xside=xside
|
|
273
|
+
)
|
|
274
|
+
for col in self._Cols
|
|
275
|
+
]
|
|
276
|
+
for row in self._Rows
|
|
277
|
+
]
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
def yticks(self, ticks=None, labels=None, yside=None):
|
|
281
|
+
(
|
|
282
|
+
self.monitor.set_yticks(ticks=ticks, labels=labels, yside=yside)
|
|
283
|
+
if self._no_plots
|
|
284
|
+
else [
|
|
285
|
+
[
|
|
286
|
+
self._get_subplot(row, col).yticks(
|
|
287
|
+
ticks=ticks, labels=labels, yside=yside
|
|
288
|
+
)
|
|
289
|
+
for col in self._Cols
|
|
290
|
+
]
|
|
291
|
+
for row in self._Rows
|
|
292
|
+
]
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
def xfrequency(self, frequency=None, xside=None):
|
|
296
|
+
(
|
|
297
|
+
self.monitor.set_xfrequency(frequency=frequency, xside=xside)
|
|
298
|
+
if self._no_plots
|
|
299
|
+
else [
|
|
300
|
+
[
|
|
301
|
+
self._get_subplot(row, col).xfrequency(
|
|
302
|
+
frequency=frequency, xside=xside
|
|
303
|
+
)
|
|
304
|
+
for col in self._Cols
|
|
305
|
+
]
|
|
306
|
+
for row in self._Rows
|
|
307
|
+
]
|
|
308
|
+
)
|
|
309
|
+
|
|
310
|
+
def yfrequency(self, frequency=None, yside=None):
|
|
311
|
+
(
|
|
312
|
+
self.monitor.set_yfrequency(frequency=frequency, yside=yside)
|
|
313
|
+
if self._no_plots
|
|
314
|
+
else [
|
|
315
|
+
[
|
|
316
|
+
self._get_subplot(row, col).yfrequency(
|
|
317
|
+
frequency=frequency, yside=yside
|
|
318
|
+
)
|
|
319
|
+
for col in self._Cols
|
|
320
|
+
]
|
|
321
|
+
for row in self._Rows
|
|
322
|
+
]
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
def xreverse(self, reverse=None, xside=None):
|
|
326
|
+
(
|
|
327
|
+
self.monitor.set_xreverse(reverse=reverse, xside=xside)
|
|
328
|
+
if self._no_plots
|
|
329
|
+
else [
|
|
330
|
+
[
|
|
331
|
+
self._get_subplot(row, col).xreverse(reverse=reverse, xside=xside)
|
|
332
|
+
for col in self._Cols
|
|
333
|
+
]
|
|
334
|
+
for row in self._Rows
|
|
335
|
+
]
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
def yreverse(self, reverse=None, yside=None):
|
|
339
|
+
(
|
|
340
|
+
self.monitor.set_yreverse(reverse=reverse, yside=yside)
|
|
341
|
+
if self._no_plots
|
|
342
|
+
else [
|
|
343
|
+
[
|
|
344
|
+
self._get_subplot(row, col).yreverse(reverse=reverse, yside=yside)
|
|
345
|
+
for col in self._Cols
|
|
346
|
+
]
|
|
347
|
+
for row in self._Rows
|
|
348
|
+
]
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
def xaxes(self, lower=None, upper=None):
|
|
352
|
+
(
|
|
353
|
+
self.monitor.set_xaxes(lower=lower, upper=upper)
|
|
354
|
+
if self._no_plots
|
|
355
|
+
else [
|
|
356
|
+
[
|
|
357
|
+
self._get_subplot(row, col).xaxes(lower=lower, upper=upper)
|
|
358
|
+
for col in self._Cols
|
|
359
|
+
]
|
|
360
|
+
for row in self._Rows
|
|
361
|
+
]
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
def yaxes(self, left=None, right=None):
|
|
365
|
+
(
|
|
366
|
+
self.monitor.set_yaxes(left=left, right=right)
|
|
367
|
+
if self._no_plots
|
|
368
|
+
else [
|
|
369
|
+
[
|
|
370
|
+
self._get_subplot(row, col).yaxes(left=left, right=right)
|
|
371
|
+
for col in self._Cols
|
|
372
|
+
]
|
|
373
|
+
for row in self._Rows
|
|
374
|
+
]
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
def frame(self, frame=None):
|
|
378
|
+
(
|
|
379
|
+
self.monitor.set_frame(frame=frame)
|
|
380
|
+
if self._no_plots
|
|
381
|
+
else [
|
|
382
|
+
[self._get_subplot(row, col).frame(frame=frame) for col in self._Cols]
|
|
383
|
+
for row in self._Rows
|
|
384
|
+
]
|
|
385
|
+
)
|
|
386
|
+
|
|
387
|
+
def grid(self, horizontal=None, vertical=None):
|
|
388
|
+
(
|
|
389
|
+
self.monitor.set_grid(horizontal=horizontal, vertical=vertical)
|
|
390
|
+
if self._no_plots
|
|
391
|
+
else [
|
|
392
|
+
[
|
|
393
|
+
self._get_subplot(row, col).grid(
|
|
394
|
+
horizontal=horizontal, vertical=vertical
|
|
395
|
+
)
|
|
396
|
+
for col in self._Cols
|
|
397
|
+
]
|
|
398
|
+
for row in self._Rows
|
|
399
|
+
]
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
def canvas_color(self, color=None):
|
|
403
|
+
(
|
|
404
|
+
self.monitor.set_canvas_color(color)
|
|
405
|
+
if self._no_plots
|
|
406
|
+
else [
|
|
407
|
+
[self._get_subplot(row, col).canvas_color(color) for col in self._Cols]
|
|
408
|
+
for row in self._Rows
|
|
409
|
+
]
|
|
410
|
+
)
|
|
411
|
+
|
|
412
|
+
def axes_color(self, color=None):
|
|
413
|
+
(
|
|
414
|
+
self.monitor.set_axes_color(color)
|
|
415
|
+
if self._no_plots
|
|
416
|
+
else [
|
|
417
|
+
[self._get_subplot(row, col).axes_color(color) for col in self._Cols]
|
|
418
|
+
for row in self._Rows
|
|
419
|
+
]
|
|
420
|
+
)
|
|
421
|
+
|
|
422
|
+
def ticks_color(self, color=None):
|
|
423
|
+
(
|
|
424
|
+
self.monitor.set_ticks_color(color)
|
|
425
|
+
if self._no_plots
|
|
426
|
+
else [
|
|
427
|
+
[self._get_subplot(row, col).ticks_color(color) for col in self._Cols]
|
|
428
|
+
for row in self._Rows
|
|
429
|
+
]
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
def ticks_style(self, style=None):
|
|
433
|
+
(
|
|
434
|
+
self.monitor.set_ticks_style(style)
|
|
435
|
+
if self._no_plots
|
|
436
|
+
else [
|
|
437
|
+
[self._get_subplot(row, col).ticks_style(style) for col in self._Cols]
|
|
438
|
+
for row in self._Rows
|
|
439
|
+
]
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
def theme(self, theme=None):
|
|
443
|
+
(
|
|
444
|
+
self.monitor.set_theme(theme)
|
|
445
|
+
if self._no_plots
|
|
446
|
+
else [
|
|
447
|
+
[self._get_subplot(row, col).theme(theme) for col in self._Cols]
|
|
448
|
+
for row in self._Rows
|
|
449
|
+
]
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
##############################################
|
|
453
|
+
########### Clear Functions ############
|
|
454
|
+
###########################x##################
|
|
189
455
|
|
|
190
456
|
def clear_figure(self):
|
|
191
|
-
self.__init__()# if self._no_plots else [[self._get_subplot(row, col).clear_figure() for col in self._Cols] for row in self._Rows]
|
|
457
|
+
self.__init__() # if self._no_plots else [[self._get_subplot(row, col).clear_figure() for col in self._Cols] for row in self._Rows]
|
|
458
|
+
|
|
192
459
|
clf = clear_figure
|
|
193
|
-
|
|
460
|
+
|
|
194
461
|
def clear_data(self):
|
|
195
|
-
|
|
462
|
+
(
|
|
463
|
+
self.monitor.data_init()
|
|
464
|
+
if self._no_plots
|
|
465
|
+
else [
|
|
466
|
+
[self._get_subplot(row, col).clear_data() for col in self._Cols]
|
|
467
|
+
for row in self._Rows
|
|
468
|
+
]
|
|
469
|
+
)
|
|
470
|
+
|
|
196
471
|
cld = clear_data
|
|
197
472
|
|
|
198
473
|
def clear_color(self):
|
|
199
|
-
|
|
474
|
+
(
|
|
475
|
+
self.monitor.clear_color()
|
|
476
|
+
if self._no_plots
|
|
477
|
+
else [
|
|
478
|
+
[self._get_subplot(row, col).clear_color() for col in self._Cols]
|
|
479
|
+
for row in self._Rows
|
|
480
|
+
]
|
|
481
|
+
)
|
|
482
|
+
|
|
200
483
|
clc = clear_color
|
|
201
484
|
|
|
202
|
-
def clear_terminal(self, lines
|
|
203
|
-
ut.clear_terminal(lines
|
|
485
|
+
def clear_terminal(self, lines=None):
|
|
486
|
+
ut.clear_terminal(lines=lines)
|
|
487
|
+
|
|
204
488
|
clt = clear_terminal
|
|
205
489
|
|
|
206
|
-
##############################################
|
|
207
|
-
########### Plot Functions #############
|
|
208
|
-
##############################################
|
|
490
|
+
##############################################
|
|
491
|
+
########### Plot Functions #############
|
|
492
|
+
##############################################
|
|
209
493
|
|
|
210
494
|
def _draw(self, *args, **kwargs):
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
495
|
+
(
|
|
496
|
+
self.monitor.draw(*args, **kwargs)
|
|
497
|
+
if self._no_plots
|
|
498
|
+
else [
|
|
499
|
+
[
|
|
500
|
+
self._get_subplot(row, col)._draw(*args, **kwargs)
|
|
501
|
+
for col in self._Cols
|
|
502
|
+
]
|
|
503
|
+
for row in self._Rows
|
|
504
|
+
]
|
|
505
|
+
)
|
|
506
|
+
|
|
507
|
+
def scatter(
|
|
508
|
+
self,
|
|
509
|
+
*args,
|
|
510
|
+
marker=None,
|
|
511
|
+
color=None,
|
|
512
|
+
style=None,
|
|
513
|
+
fillx=None,
|
|
514
|
+
filly=None,
|
|
515
|
+
xside=None,
|
|
516
|
+
yside=None,
|
|
517
|
+
label=None,
|
|
518
|
+
):
|
|
519
|
+
self._draw(
|
|
520
|
+
*args,
|
|
521
|
+
xside=xside,
|
|
522
|
+
yside=yside,
|
|
523
|
+
lines=False,
|
|
524
|
+
marker=marker,
|
|
525
|
+
color=color,
|
|
526
|
+
style=style,
|
|
527
|
+
fillx=fillx,
|
|
528
|
+
filly=filly,
|
|
529
|
+
label=label,
|
|
530
|
+
)
|
|
531
|
+
|
|
532
|
+
def plot(
|
|
533
|
+
self,
|
|
534
|
+
*args,
|
|
535
|
+
marker=None,
|
|
536
|
+
color=None,
|
|
537
|
+
style=None,
|
|
538
|
+
fillx=None,
|
|
539
|
+
filly=None,
|
|
540
|
+
xside=None,
|
|
541
|
+
yside=None,
|
|
542
|
+
label=None,
|
|
543
|
+
):
|
|
544
|
+
self._draw(
|
|
545
|
+
*args,
|
|
546
|
+
xside=xside,
|
|
547
|
+
yside=yside,
|
|
548
|
+
lines=True,
|
|
549
|
+
marker=marker,
|
|
550
|
+
color=color,
|
|
551
|
+
fillx=fillx,
|
|
552
|
+
filly=filly,
|
|
553
|
+
label=label,
|
|
554
|
+
)
|
|
555
|
+
|
|
556
|
+
def bar(
|
|
557
|
+
self,
|
|
558
|
+
*args,
|
|
559
|
+
marker=None,
|
|
560
|
+
color=None,
|
|
561
|
+
fill=None,
|
|
562
|
+
width=None,
|
|
563
|
+
orientation=None,
|
|
564
|
+
minimum=None,
|
|
565
|
+
reset_ticks=None,
|
|
566
|
+
xside=None,
|
|
567
|
+
yside=None,
|
|
568
|
+
label=None,
|
|
569
|
+
):
|
|
570
|
+
(
|
|
571
|
+
self.monitor.draw_bar(
|
|
572
|
+
*args,
|
|
573
|
+
xside=xside,
|
|
574
|
+
yside=yside,
|
|
575
|
+
marker=marker,
|
|
576
|
+
color=color,
|
|
577
|
+
fill=fill,
|
|
578
|
+
width=width,
|
|
579
|
+
orientation=orientation,
|
|
580
|
+
label=label,
|
|
581
|
+
minimum=minimum,
|
|
582
|
+
reset_ticks=reset_ticks,
|
|
583
|
+
)
|
|
584
|
+
if self._no_plots
|
|
585
|
+
else [
|
|
586
|
+
[
|
|
587
|
+
self._get_subplot(row, col).bar(
|
|
588
|
+
*args,
|
|
589
|
+
xside=xside,
|
|
590
|
+
yside=yside,
|
|
591
|
+
marker=marker,
|
|
592
|
+
color=color,
|
|
593
|
+
fill=fill,
|
|
594
|
+
width=width,
|
|
595
|
+
orientation=orientation,
|
|
596
|
+
label=label,
|
|
597
|
+
minimum=minimum,
|
|
598
|
+
reset_ticks=reset_ticks,
|
|
599
|
+
)
|
|
600
|
+
for col in self._Cols
|
|
601
|
+
]
|
|
602
|
+
for row in self._Rows
|
|
603
|
+
]
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
def multiple_bar(
|
|
607
|
+
self,
|
|
608
|
+
*args,
|
|
609
|
+
marker=None,
|
|
610
|
+
color=None,
|
|
611
|
+
fill=None,
|
|
612
|
+
width=None,
|
|
613
|
+
orientation=None,
|
|
614
|
+
minimum=None,
|
|
615
|
+
reset_ticks=None,
|
|
616
|
+
xside=None,
|
|
617
|
+
yside=None,
|
|
618
|
+
labels=None,
|
|
619
|
+
):
|
|
620
|
+
(
|
|
621
|
+
self.monitor.draw_multiple_bar(
|
|
622
|
+
*args,
|
|
623
|
+
xside=xside,
|
|
624
|
+
yside=yside,
|
|
625
|
+
marker=marker,
|
|
626
|
+
color=color,
|
|
627
|
+
fill=fill,
|
|
628
|
+
width=width,
|
|
629
|
+
orientation=orientation,
|
|
630
|
+
labels=labels,
|
|
631
|
+
minimum=minimum,
|
|
632
|
+
reset_ticks=reset_ticks,
|
|
633
|
+
)
|
|
634
|
+
if self._no_plots
|
|
635
|
+
else [
|
|
636
|
+
[
|
|
637
|
+
self._get_subplot(row, col).multiple_bar(
|
|
638
|
+
*args,
|
|
639
|
+
xside=xside,
|
|
640
|
+
yside=yside,
|
|
641
|
+
marker=marker,
|
|
642
|
+
color=color,
|
|
643
|
+
fill=fill,
|
|
644
|
+
width=width,
|
|
645
|
+
orientation=orientation,
|
|
646
|
+
labels=labels,
|
|
647
|
+
minimum=minimum,
|
|
648
|
+
reset_ticks=reset_ticks,
|
|
649
|
+
)
|
|
650
|
+
for col in self._Cols
|
|
651
|
+
]
|
|
652
|
+
for row in self._Rows
|
|
653
|
+
]
|
|
654
|
+
)
|
|
655
|
+
|
|
656
|
+
def stacked_bar(
|
|
657
|
+
self,
|
|
658
|
+
*args,
|
|
659
|
+
marker=None,
|
|
660
|
+
color=None,
|
|
661
|
+
fill=None,
|
|
662
|
+
width=None,
|
|
663
|
+
orientation=None,
|
|
664
|
+
minimum=None,
|
|
665
|
+
reset_ticks=None,
|
|
666
|
+
xside=None,
|
|
667
|
+
yside=None,
|
|
668
|
+
labels=None,
|
|
669
|
+
):
|
|
670
|
+
(
|
|
671
|
+
self.monitor.draw_stacked_bar(
|
|
672
|
+
*args,
|
|
673
|
+
xside=xside,
|
|
674
|
+
yside=yside,
|
|
675
|
+
marker=marker,
|
|
676
|
+
color=color,
|
|
677
|
+
fill=fill,
|
|
678
|
+
width=width,
|
|
679
|
+
orientation=orientation,
|
|
680
|
+
labels=labels,
|
|
681
|
+
minimum=minimum,
|
|
682
|
+
reset_ticks=reset_ticks,
|
|
683
|
+
)
|
|
684
|
+
if self._no_plots
|
|
685
|
+
else [
|
|
686
|
+
[
|
|
687
|
+
self._get_subplot(row, col).stacked_bar(
|
|
688
|
+
*args,
|
|
689
|
+
xside=xside,
|
|
690
|
+
yside=yside,
|
|
691
|
+
marker=marker,
|
|
692
|
+
color=color,
|
|
693
|
+
fill=fill,
|
|
694
|
+
width=width,
|
|
695
|
+
orientation=orientation,
|
|
696
|
+
labels=labels,
|
|
697
|
+
minimum=minimum,
|
|
698
|
+
reset_ticks=reset_ticks,
|
|
699
|
+
)
|
|
700
|
+
for col in self._Cols
|
|
701
|
+
]
|
|
702
|
+
for row in self._Rows
|
|
703
|
+
]
|
|
704
|
+
)
|
|
705
|
+
|
|
706
|
+
def hist(
|
|
707
|
+
self,
|
|
708
|
+
data,
|
|
709
|
+
bins=None,
|
|
710
|
+
marker=None,
|
|
711
|
+
color=None,
|
|
712
|
+
fill=None,
|
|
713
|
+
norm=None,
|
|
714
|
+
width=None,
|
|
715
|
+
orientation=None,
|
|
716
|
+
minimum=None,
|
|
717
|
+
xside=None,
|
|
718
|
+
yside=None,
|
|
719
|
+
label=None,
|
|
720
|
+
):
|
|
721
|
+
(
|
|
722
|
+
self.monitor.draw_hist(
|
|
723
|
+
data,
|
|
724
|
+
bins=bins,
|
|
725
|
+
norm=norm,
|
|
726
|
+
xside=xside,
|
|
727
|
+
yside=yside,
|
|
728
|
+
marker=marker,
|
|
729
|
+
color=color,
|
|
730
|
+
fill=fill,
|
|
731
|
+
width=width,
|
|
732
|
+
orientation=orientation,
|
|
733
|
+
label=label,
|
|
734
|
+
minimum=minimum,
|
|
735
|
+
)
|
|
736
|
+
if self._no_plots
|
|
737
|
+
else [
|
|
738
|
+
[
|
|
739
|
+
self._get_subplot(row, col).hist(
|
|
740
|
+
data,
|
|
741
|
+
bins=bins,
|
|
742
|
+
norm=norm,
|
|
743
|
+
xside=xside,
|
|
744
|
+
yside=yside,
|
|
745
|
+
marker=marker,
|
|
746
|
+
color=color,
|
|
747
|
+
fill=fill,
|
|
748
|
+
width=width,
|
|
749
|
+
orientation=orientation,
|
|
750
|
+
label=label,
|
|
751
|
+
minimum=minimum,
|
|
752
|
+
)
|
|
753
|
+
for col in self._Cols
|
|
754
|
+
]
|
|
755
|
+
for row in self._Rows
|
|
756
|
+
]
|
|
757
|
+
)
|
|
758
|
+
|
|
759
|
+
def candlestick(
|
|
760
|
+
self,
|
|
761
|
+
dates,
|
|
762
|
+
data,
|
|
763
|
+
colors=None,
|
|
764
|
+
orientation=None,
|
|
765
|
+
xside=None,
|
|
766
|
+
yside=None,
|
|
767
|
+
label=None,
|
|
768
|
+
):
|
|
769
|
+
(
|
|
770
|
+
self.monitor.draw_candlestick(
|
|
771
|
+
dates,
|
|
772
|
+
data,
|
|
773
|
+
xside=xside,
|
|
774
|
+
yside=yside,
|
|
775
|
+
orientation=orientation,
|
|
776
|
+
colors=colors,
|
|
777
|
+
label=label,
|
|
778
|
+
)
|
|
779
|
+
if self._no_plots
|
|
780
|
+
else [
|
|
781
|
+
[
|
|
782
|
+
self._get_subplot(row, col).candlestick(
|
|
783
|
+
dates, data, orientation=orientation, colors=colors, label=label
|
|
784
|
+
)
|
|
785
|
+
for col in self._Cols
|
|
786
|
+
]
|
|
787
|
+
for row in self._Rows
|
|
788
|
+
]
|
|
789
|
+
)
|
|
790
|
+
|
|
791
|
+
def box(
|
|
792
|
+
self,
|
|
793
|
+
*args,
|
|
794
|
+
quintuples=None,
|
|
795
|
+
colors=None,
|
|
796
|
+
fill=None,
|
|
797
|
+
width=None,
|
|
798
|
+
orientation=None,
|
|
799
|
+
minimum=None,
|
|
800
|
+
reset_ticks=None,
|
|
801
|
+
xside=None,
|
|
802
|
+
yside=None,
|
|
803
|
+
label=None,
|
|
804
|
+
):
|
|
805
|
+
(
|
|
806
|
+
self.monitor.draw_box(
|
|
807
|
+
*args,
|
|
808
|
+
xside=xside,
|
|
809
|
+
yside=yside,
|
|
810
|
+
orientation=orientation,
|
|
811
|
+
colors=colors,
|
|
812
|
+
label=label,
|
|
813
|
+
fill=fill,
|
|
814
|
+
width=width,
|
|
815
|
+
minimum=minimum,
|
|
816
|
+
reset_ticks=reset_ticks,
|
|
817
|
+
quintuples=quintuples,
|
|
818
|
+
)
|
|
819
|
+
if self._no_plots
|
|
820
|
+
else [
|
|
821
|
+
[
|
|
822
|
+
self._get_subplot(row, col).box(
|
|
823
|
+
*args,
|
|
824
|
+
orientation=orientation,
|
|
825
|
+
colors=colors,
|
|
826
|
+
label=label,
|
|
827
|
+
fill=fill,
|
|
828
|
+
width=width,
|
|
829
|
+
minimum=minimum,
|
|
830
|
+
reset_ticks=reset_ticks,
|
|
831
|
+
quintuples=quintuples,
|
|
832
|
+
)
|
|
833
|
+
for col in self._Cols
|
|
834
|
+
]
|
|
835
|
+
for row in self._Rows
|
|
836
|
+
]
|
|
837
|
+
)
|
|
838
|
+
|
|
839
|
+
##############################################
|
|
840
|
+
########### Plotting Tools #############
|
|
841
|
+
##############################################
|
|
842
|
+
|
|
843
|
+
def error(
|
|
844
|
+
self,
|
|
845
|
+
*args,
|
|
846
|
+
xerr=None,
|
|
847
|
+
yerr=None,
|
|
848
|
+
color=None,
|
|
849
|
+
xside=None,
|
|
850
|
+
yside=None,
|
|
851
|
+
label=None,
|
|
852
|
+
):
|
|
853
|
+
(
|
|
854
|
+
self.monitor.draw_error(
|
|
855
|
+
*args,
|
|
856
|
+
xerr=xerr,
|
|
857
|
+
yerr=yerr,
|
|
858
|
+
xside=xside,
|
|
859
|
+
yside=yside,
|
|
860
|
+
color=color,
|
|
861
|
+
label=label,
|
|
862
|
+
)
|
|
863
|
+
if self._no_plots
|
|
864
|
+
else [
|
|
865
|
+
[
|
|
866
|
+
self._get_subplot(row, col).error(
|
|
867
|
+
*args,
|
|
868
|
+
xerr=xerr,
|
|
869
|
+
yerr=yerr,
|
|
870
|
+
xside=xside,
|
|
871
|
+
yside=yside,
|
|
872
|
+
color=color,
|
|
873
|
+
label=label,
|
|
874
|
+
)
|
|
875
|
+
for col in self._Cols
|
|
876
|
+
]
|
|
877
|
+
for row in self._Rows
|
|
878
|
+
]
|
|
879
|
+
)
|
|
880
|
+
|
|
881
|
+
def event_plot(self, data, marker=None, color=None, orientation=None, side=None):
|
|
882
|
+
(
|
|
883
|
+
self.monitor.draw_event_plot(
|
|
884
|
+
data, orientation=orientation, marker=marker, color=color, side=side
|
|
885
|
+
)
|
|
886
|
+
if self._no_plots
|
|
887
|
+
else [
|
|
888
|
+
[
|
|
889
|
+
self._get_subplot(row, col).event_plot(
|
|
890
|
+
data,
|
|
891
|
+
orientation=orientation,
|
|
892
|
+
marker=marker,
|
|
893
|
+
color=color,
|
|
894
|
+
side=side,
|
|
895
|
+
)
|
|
896
|
+
for col in self._Cols
|
|
897
|
+
]
|
|
898
|
+
for row in self._Rows
|
|
899
|
+
]
|
|
900
|
+
)
|
|
230
901
|
|
|
231
|
-
def candlestick(self, dates, data, colors = None, orientation = None, xside = None, yside = None, label = None):
|
|
232
|
-
self.monitor.draw_candlestick(dates, data, xside = xside, yside = yside, orientation = orientation, colors = colors, label = label) if self._no_plots else [[self._get_subplot(row, col).candlestick(dates, data, orientation = orientation, colors = colors, label = label) for col in self._Cols] for row in self._Rows]
|
|
233
|
-
|
|
234
|
-
def box(self, *args, quintuples = None, colors = None, fill = None, width = None, orientation = None, minimum = None, reset_ticks = None, xside = None, yside = None, label = None):
|
|
235
|
-
self.monitor.draw_box(*args, xside = xside, yside = yside, orientation = orientation, colors = colors, label = label, fill = fill, width = width, minimum = minimum, reset_ticks = reset_ticks, quintuples = quintuples) if self._no_plots else [[self._get_subplot(row, col).box(*args, orientation = orientation, colors = colors, label = label, fill = fill, width = width, minimum = minimum, reset_ticks = reset_ticks, quintuples = quintuples) for col in self._Cols] for row in self._Rows]
|
|
236
|
-
|
|
237
|
-
##############################################
|
|
238
|
-
########### Plotting Tools #############
|
|
239
|
-
##############################################
|
|
240
|
-
|
|
241
|
-
def error(self, *args, xerr = None, yerr = None, color = None, xside = None, yside = None, label = None):
|
|
242
|
-
self.monitor.draw_error(*args, xerr = xerr, yerr = yerr, xside = xside, yside = yside, color = color, label = label) if self._no_plots else [[self._get_subplot(row, col).error(*args, xerr = xerr, yerr = yerr, xside = xside, yside = yside, color = color, label = label) for col in self._Cols] for row in self._Rows]
|
|
243
|
-
|
|
244
|
-
def event_plot(self, data, marker = None, color = None, orientation = None, side = None):
|
|
245
|
-
self.monitor.draw_event_plot(data, orientation = orientation, marker = marker, color = color, side = side) if self._no_plots else [[self._get_subplot(row, col).event_plot(data, orientation = orientation, marker = marker, color = color, side = side) for col in self._Cols] for row in self._Rows]
|
|
246
902
|
eventplot = event_plot
|
|
247
903
|
|
|
248
|
-
def vertical_line(self, coordinate, color
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
904
|
+
def vertical_line(self, coordinate, color=None, xside=None):
|
|
905
|
+
(
|
|
906
|
+
self.monitor.draw_vertical_line(coordinate, color=color, xside=xside)
|
|
907
|
+
if self._no_plots
|
|
908
|
+
else [
|
|
909
|
+
[
|
|
910
|
+
self._get_subplot(row, col).vertical_line(
|
|
911
|
+
coordinate, color=color, xside=xside
|
|
912
|
+
)
|
|
913
|
+
for col in self._Cols
|
|
914
|
+
]
|
|
915
|
+
for row in self._Rows
|
|
916
|
+
]
|
|
917
|
+
)
|
|
255
918
|
|
|
256
|
-
|
|
257
|
-
self.monitor.draw_text(label, x, y, xside = xside, yside = yside, color = color, background = background, style = style, orientation = orientation, alignment = alignment) if self._no_plots else [[self._get_subplot(row, col).text(label, x, y, xside = xside, yside = yside, color = color, background = background, style = style, orientation = orientation, alignment = alignment) for col in self._Cols] for row in self._Rows]
|
|
919
|
+
vline = vertical_line
|
|
258
920
|
|
|
259
|
-
def
|
|
260
|
-
|
|
921
|
+
def horizontal_line(self, coordinate, color=None, yside=None):
|
|
922
|
+
(
|
|
923
|
+
self.monitor.draw_horizontal_line(coordinate, color=color, yside=yside)
|
|
924
|
+
if self._no_plots
|
|
925
|
+
else [
|
|
926
|
+
[
|
|
927
|
+
self._get_subplot(row, col).horizontal_line(
|
|
928
|
+
coordinate, color=color, yside=yside
|
|
929
|
+
)
|
|
930
|
+
for col in self._Cols
|
|
931
|
+
]
|
|
932
|
+
for row in self._Rows
|
|
933
|
+
]
|
|
934
|
+
)
|
|
261
935
|
|
|
262
|
-
|
|
263
|
-
self.monitor.draw_polygon(x = x, y = y, radius = radius, sides = sides, xside = xside, yside = yside, lines = lines, marker = marker, color = color, fill = fill, label = label) if self._no_plots else [[self._get_subplot(row, col).polygon(x = x, y = y, radius = radius, sides = sides, xside = xside, yside = yside, lines = lines, marker = marker, color = color, fill = fill, label = label) for col in self._Cols] for row in self._Rows]
|
|
936
|
+
hline = horizontal_line
|
|
264
937
|
|
|
265
|
-
def
|
|
266
|
-
self
|
|
938
|
+
def text(
|
|
939
|
+
self,
|
|
940
|
+
label,
|
|
941
|
+
x,
|
|
942
|
+
y,
|
|
943
|
+
color=None,
|
|
944
|
+
background=None,
|
|
945
|
+
style=None,
|
|
946
|
+
orientation=None,
|
|
947
|
+
alignment=None,
|
|
948
|
+
xside=None,
|
|
949
|
+
yside=None,
|
|
950
|
+
):
|
|
951
|
+
(
|
|
952
|
+
self.monitor.draw_text(
|
|
953
|
+
label,
|
|
954
|
+
x,
|
|
955
|
+
y,
|
|
956
|
+
xside=xside,
|
|
957
|
+
yside=yside,
|
|
958
|
+
color=color,
|
|
959
|
+
background=background,
|
|
960
|
+
style=style,
|
|
961
|
+
orientation=orientation,
|
|
962
|
+
alignment=alignment,
|
|
963
|
+
)
|
|
964
|
+
if self._no_plots
|
|
965
|
+
else [
|
|
966
|
+
[
|
|
967
|
+
self._get_subplot(row, col).text(
|
|
968
|
+
label,
|
|
969
|
+
x,
|
|
970
|
+
y,
|
|
971
|
+
xside=xside,
|
|
972
|
+
yside=yside,
|
|
973
|
+
color=color,
|
|
974
|
+
background=background,
|
|
975
|
+
style=style,
|
|
976
|
+
orientation=orientation,
|
|
977
|
+
alignment=alignment,
|
|
978
|
+
)
|
|
979
|
+
for col in self._Cols
|
|
980
|
+
]
|
|
981
|
+
for row in self._Rows
|
|
982
|
+
]
|
|
983
|
+
)
|
|
984
|
+
|
|
985
|
+
def rectangle(
|
|
986
|
+
self,
|
|
987
|
+
x=None,
|
|
988
|
+
y=None,
|
|
989
|
+
marker=None,
|
|
990
|
+
color=None,
|
|
991
|
+
lines=None,
|
|
992
|
+
fill=None,
|
|
993
|
+
xside=None,
|
|
994
|
+
yside=None,
|
|
995
|
+
label=None,
|
|
996
|
+
):
|
|
997
|
+
(
|
|
998
|
+
self.monitor.draw_rectangle(
|
|
999
|
+
x=x,
|
|
1000
|
+
y=y,
|
|
1001
|
+
xside=xside,
|
|
1002
|
+
yside=yside,
|
|
1003
|
+
lines=lines,
|
|
1004
|
+
marker=marker,
|
|
1005
|
+
color=color,
|
|
1006
|
+
fill=fill,
|
|
1007
|
+
label=label,
|
|
1008
|
+
)
|
|
1009
|
+
if self._no_plots
|
|
1010
|
+
else [
|
|
1011
|
+
[
|
|
1012
|
+
self._get_subplot(row, col).rectangle(
|
|
1013
|
+
x=x,
|
|
1014
|
+
y=y,
|
|
1015
|
+
xside=xside,
|
|
1016
|
+
yside=yside,
|
|
1017
|
+
lines=lines,
|
|
1018
|
+
marker=marker,
|
|
1019
|
+
color=color,
|
|
1020
|
+
fill=fill,
|
|
1021
|
+
label=label,
|
|
1022
|
+
)
|
|
1023
|
+
for col in self._Cols
|
|
1024
|
+
]
|
|
1025
|
+
for row in self._Rows
|
|
1026
|
+
]
|
|
1027
|
+
)
|
|
1028
|
+
|
|
1029
|
+
def polygon(
|
|
1030
|
+
self,
|
|
1031
|
+
x=None,
|
|
1032
|
+
y=None,
|
|
1033
|
+
radius=None,
|
|
1034
|
+
sides=None,
|
|
1035
|
+
marker=None,
|
|
1036
|
+
color=None,
|
|
1037
|
+
lines=None,
|
|
1038
|
+
fill=None,
|
|
1039
|
+
xside=None,
|
|
1040
|
+
yside=None,
|
|
1041
|
+
label=None,
|
|
1042
|
+
):
|
|
1043
|
+
(
|
|
1044
|
+
self.monitor.draw_polygon(
|
|
1045
|
+
x=x,
|
|
1046
|
+
y=y,
|
|
1047
|
+
radius=radius,
|
|
1048
|
+
sides=sides,
|
|
1049
|
+
xside=xside,
|
|
1050
|
+
yside=yside,
|
|
1051
|
+
lines=lines,
|
|
1052
|
+
marker=marker,
|
|
1053
|
+
color=color,
|
|
1054
|
+
fill=fill,
|
|
1055
|
+
label=label,
|
|
1056
|
+
)
|
|
1057
|
+
if self._no_plots
|
|
1058
|
+
else [
|
|
1059
|
+
[
|
|
1060
|
+
self._get_subplot(row, col).polygon(
|
|
1061
|
+
x=x,
|
|
1062
|
+
y=y,
|
|
1063
|
+
radius=radius,
|
|
1064
|
+
sides=sides,
|
|
1065
|
+
xside=xside,
|
|
1066
|
+
yside=yside,
|
|
1067
|
+
lines=lines,
|
|
1068
|
+
marker=marker,
|
|
1069
|
+
color=color,
|
|
1070
|
+
fill=fill,
|
|
1071
|
+
label=label,
|
|
1072
|
+
)
|
|
1073
|
+
for col in self._Cols
|
|
1074
|
+
]
|
|
1075
|
+
for row in self._Rows
|
|
1076
|
+
]
|
|
1077
|
+
)
|
|
1078
|
+
|
|
1079
|
+
def confusion_matrix(self, actual, predicted, color=None, style=None, labels=None):
|
|
1080
|
+
(
|
|
1081
|
+
self.monitor.draw_confusion_matrix(
|
|
1082
|
+
actual, predicted, labels=labels, color=color, style=style
|
|
1083
|
+
)
|
|
1084
|
+
if self._no_plots
|
|
1085
|
+
else [
|
|
1086
|
+
[
|
|
1087
|
+
self._get_subplot(row, col).confusion_matrix(
|
|
1088
|
+
actual, predicted, labels=labels, color=color, style=style
|
|
1089
|
+
)
|
|
1090
|
+
for col in self._Cols
|
|
1091
|
+
]
|
|
1092
|
+
for row in self._Rows
|
|
1093
|
+
]
|
|
1094
|
+
)
|
|
267
1095
|
|
|
268
1096
|
cmatrix = confusion_matrix
|
|
269
1097
|
|
|
270
|
-
def indicator(self, value, label
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
1098
|
+
def indicator(self, value, label=None, color=None, style=None):
|
|
1099
|
+
(
|
|
1100
|
+
self.monitor.draw_indicator(value, label=label, color=color, style=style)
|
|
1101
|
+
if self._no_plots
|
|
1102
|
+
else [
|
|
1103
|
+
[
|
|
1104
|
+
self._get_subplot(row, col).confusion_matrix(
|
|
1105
|
+
value, label=label, color=color, style=style
|
|
1106
|
+
)
|
|
1107
|
+
for col in self._Cols
|
|
1108
|
+
]
|
|
1109
|
+
for row in self._Rows
|
|
1110
|
+
]
|
|
1111
|
+
)
|
|
1112
|
+
|
|
1113
|
+
##############################################
|
|
1114
|
+
############## 2D Plots ################
|
|
1115
|
+
##############################################
|
|
1116
|
+
|
|
1117
|
+
def matrix_plot(self, matrix, marker=None, style=None, fast=False):
|
|
1118
|
+
(
|
|
1119
|
+
self.monitor.draw_matrix(matrix, marker=marker, style=style, fast=fast)
|
|
1120
|
+
if self._no_plots
|
|
1121
|
+
else [
|
|
1122
|
+
[
|
|
1123
|
+
self._get_subplot(row, col).matrix_plot(
|
|
1124
|
+
matrix, marker=marker, style=style, fast=fast
|
|
1125
|
+
)
|
|
1126
|
+
for col in self._Cols
|
|
1127
|
+
]
|
|
1128
|
+
for row in self._Rows
|
|
1129
|
+
]
|
|
1130
|
+
)
|
|
1131
|
+
|
|
1132
|
+
def pie(
|
|
1133
|
+
self,
|
|
1134
|
+
labels,
|
|
1135
|
+
values,
|
|
1136
|
+
colors=None,
|
|
1137
|
+
radius=None,
|
|
1138
|
+
show_values=True,
|
|
1139
|
+
show_percentages=True,
|
|
1140
|
+
title=None,
|
|
1141
|
+
show_values_on_slices=False,
|
|
1142
|
+
donut=False,
|
|
1143
|
+
remaining_color=None,
|
|
1144
|
+
):
|
|
1145
|
+
(
|
|
1146
|
+
self.monitor.draw_pie(
|
|
1147
|
+
labels,
|
|
1148
|
+
values,
|
|
1149
|
+
colors=colors,
|
|
1150
|
+
radius=radius,
|
|
1151
|
+
show_values=show_values,
|
|
1152
|
+
show_percentages=show_percentages,
|
|
1153
|
+
title=title,
|
|
1154
|
+
show_values_on_slices=show_values_on_slices,
|
|
1155
|
+
donut=donut,
|
|
1156
|
+
remaining_color=remaining_color,
|
|
1157
|
+
)
|
|
1158
|
+
if self._no_plots
|
|
1159
|
+
else [
|
|
1160
|
+
[
|
|
1161
|
+
self._get_subplot(row, col).pie(
|
|
1162
|
+
labels,
|
|
1163
|
+
values,
|
|
1164
|
+
colors=colors,
|
|
1165
|
+
radius=radius,
|
|
1166
|
+
show_values=show_values,
|
|
1167
|
+
show_percentages=show_percentages,
|
|
1168
|
+
title=title,
|
|
1169
|
+
show_values_on_slices=show_values_on_slices,
|
|
1170
|
+
donut=donut,
|
|
1171
|
+
remaining_color=remaining_color,
|
|
1172
|
+
)
|
|
1173
|
+
for col in self._Cols
|
|
1174
|
+
]
|
|
1175
|
+
for row in self._Rows
|
|
1176
|
+
]
|
|
1177
|
+
)
|
|
1178
|
+
|
|
1179
|
+
def heatmap(self, dataframe, color=None, style=None):
|
|
1180
|
+
(
|
|
1181
|
+
self.monitor.draw_heatmap(dataframe, color=color, style=style)
|
|
1182
|
+
if self._no_plots
|
|
1183
|
+
else [
|
|
1184
|
+
[
|
|
1185
|
+
self._get_subplot(row, col).heatmap(
|
|
1186
|
+
dataframe, color=color, style=style
|
|
1187
|
+
)
|
|
1188
|
+
for col in self._Cols
|
|
1189
|
+
]
|
|
1190
|
+
for row in self._Rows
|
|
1191
|
+
]
|
|
1192
|
+
)
|
|
1193
|
+
|
|
1194
|
+
def image_plot(self, path, marker=None, style=None, fast=False, grayscale=False):
|
|
1195
|
+
(
|
|
1196
|
+
self.monitor.draw_image(
|
|
1197
|
+
path, marker=marker, style=style, grayscale=grayscale, fast=fast
|
|
1198
|
+
)
|
|
1199
|
+
if self._no_plots
|
|
1200
|
+
else [
|
|
1201
|
+
[
|
|
1202
|
+
self._get_subplot(row, col).image_plot(
|
|
1203
|
+
path, marker=marker, style=style, grayscale=grayscale, fast=fast
|
|
1204
|
+
)
|
|
1205
|
+
for col in self._Cols
|
|
1206
|
+
]
|
|
1207
|
+
for row in self._Rows
|
|
1208
|
+
]
|
|
1209
|
+
)
|
|
1210
|
+
|
|
1211
|
+
##############################################
|
|
1212
|
+
########### Date Functions #############
|
|
1213
|
+
##############################################
|
|
1214
|
+
|
|
1215
|
+
def date_form(self, input_form=None, output_form=None):
|
|
294
1216
|
self._master._dummy.date.date_form(input_form, output_form)
|
|
295
1217
|
if self._no_plots:
|
|
296
1218
|
self.monitor.date.date_form(input_form, output_form)
|
|
297
1219
|
else:
|
|
298
|
-
[
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
1220
|
+
[
|
|
1221
|
+
[
|
|
1222
|
+
self._get_subplot(row, col).date_form(input_form, output_form)
|
|
1223
|
+
for col in self._Cols
|
|
1224
|
+
]
|
|
1225
|
+
for row in self._Rows
|
|
1226
|
+
]
|
|
1227
|
+
|
|
1228
|
+
def set_time0(self, string, input_form=None):
|
|
1229
|
+
(
|
|
1230
|
+
self.monitor.date.set_time0(string, input_form)
|
|
1231
|
+
if self._no_plots
|
|
1232
|
+
else [
|
|
1233
|
+
[
|
|
1234
|
+
self._get_subplot(row, col).set_time0(string, input_form)
|
|
1235
|
+
for col in self._Cols
|
|
1236
|
+
]
|
|
1237
|
+
for row in self._Rows
|
|
1238
|
+
]
|
|
1239
|
+
)
|
|
302
1240
|
|
|
303
1241
|
def today_datetime(self):
|
|
304
1242
|
return self.monitor.date.today_datetime()
|
|
305
|
-
|
|
306
|
-
def today_string(self, output_form
|
|
1243
|
+
|
|
1244
|
+
def today_string(self, output_form=None):
|
|
307
1245
|
return self.monitor.date.today_string(output_form)
|
|
308
|
-
|
|
309
|
-
def datetime_to_string(self, datetime, output_form = None):
|
|
310
|
-
return self.monitor.date.datetime_to_string(datetime, output_form = output_form)
|
|
311
|
-
|
|
312
|
-
def datetimes_to_strings(self, datetimes, output_form = None):
|
|
313
|
-
return self.monitor.date.datetimes_to_strings(datetimes, output_form = output_form)
|
|
314
|
-
|
|
315
|
-
def string_to_datetime(self, string, input_form = None):
|
|
316
|
-
return self.monitor.date.string_to_datetime(string, input_form = input_form)
|
|
317
|
-
|
|
318
|
-
def string_to_time(self, string, input_form = None):
|
|
319
|
-
return self.monitor.date.string_to_time(string, input_form = input_form)
|
|
320
|
-
|
|
321
|
-
def strings_to_time(self, string, input_form = None):
|
|
322
|
-
return self.monitor.date.strings_to_time(string, input_form = input_form)
|
|
323
|
-
|
|
324
|
-
##############################################
|
|
325
|
-
########### Build Functions ############
|
|
326
|
-
##############################################
|
|
327
|
-
|
|
328
|
-
def show(self): # it build and shows the overall figure
|
|
329
|
-
t = time()
|
|
330
|
-
self.build()
|
|
331
|
-
ut.write(self.monitor.matrix.canvas) # it prints the final canvas
|
|
332
|
-
self._time = time() - t # computational time of build + print (it does not include any pre-processing time, which is gets more important for bar and image plots)
|
|
333
|
-
self.main() if not self._master._interactive else None# it returns control to main figure on top level
|
|
334
1246
|
|
|
335
|
-
def
|
|
1247
|
+
def datetime_to_string(self, datetime, output_form=None):
|
|
1248
|
+
return self.monitor.date.datetime_to_string(datetime, output_form=output_form)
|
|
1249
|
+
|
|
1250
|
+
def datetimes_to_strings(self, datetimes, output_form=None):
|
|
1251
|
+
return self.monitor.date.datetimes_to_strings(
|
|
1252
|
+
datetimes, output_form=output_form
|
|
1253
|
+
)
|
|
1254
|
+
|
|
1255
|
+
def string_to_datetime(self, string, input_form=None):
|
|
1256
|
+
return self.monitor.date.string_to_datetime(string, input_form=input_form)
|
|
1257
|
+
|
|
1258
|
+
def string_to_time(self, string, input_form=None):
|
|
1259
|
+
return self.monitor.date.string_to_time(string, input_form=input_form)
|
|
1260
|
+
|
|
1261
|
+
def strings_to_time(self, string, input_form=None):
|
|
1262
|
+
return self.monitor.date.strings_to_time(string, input_form=input_form)
|
|
1263
|
+
|
|
1264
|
+
##############################################
|
|
1265
|
+
########### Build Functions ############
|
|
1266
|
+
##############################################
|
|
1267
|
+
|
|
1268
|
+
def show(self): # it build and shows the overall figure
|
|
1269
|
+
t = time()
|
|
1270
|
+
self.build()
|
|
1271
|
+
ut.write(self.monitor.matrix.canvas) # it prints the final canvas
|
|
1272
|
+
self._time = (
|
|
1273
|
+
time() - t
|
|
1274
|
+
) # computational time of build + print (it does not include any pre-processing time, which is gets more important for bar and image plots)
|
|
1275
|
+
(
|
|
1276
|
+
self.main() if not self._master._interactive else None
|
|
1277
|
+
) # it returns control to main figure on top level
|
|
1278
|
+
|
|
1279
|
+
def build(self): # it build the current figure without showing it
|
|
336
1280
|
self._set_sizes()
|
|
337
1281
|
self._build_matrix()
|
|
338
1282
|
self.monitor.matrix.set_canvas() if not self.monitor.fast_plot else None
|
|
339
|
-
return self.monitor.matrix.get_canvas()
|
|
1283
|
+
return self.monitor.matrix.get_canvas()
|
|
340
1284
|
|
|
341
1285
|
def _build_matrix(self):
|
|
342
1286
|
if self._no_plots:
|
|
343
1287
|
self.monitor.build_plot() if not self.monitor.fast_plot else None
|
|
344
1288
|
else:
|
|
345
|
-
[
|
|
346
|
-
|
|
1289
|
+
[
|
|
1290
|
+
[self._get_subplot(row, col)._build_matrix() for col in self._Cols]
|
|
1291
|
+
for row in self._Rows
|
|
1292
|
+
]
|
|
1293
|
+
matrices = [
|
|
1294
|
+
[self._get_subplot(row, col).monitor.matrix for col in self._Cols]
|
|
1295
|
+
for row in self._Rows
|
|
1296
|
+
]
|
|
347
1297
|
self.monitor.matrix = join_matrices(matrices)
|
|
348
1298
|
|
|
349
|
-
##############################################
|
|
350
|
-
######### Set Size Utilities ###########
|
|
351
|
-
##############################################
|
|
1299
|
+
##############################################
|
|
1300
|
+
######### Set Size Utilities ###########
|
|
1301
|
+
##############################################
|
|
352
1302
|
|
|
353
|
-
def _set_sizes(self):
|
|
354
|
-
self._set_slots_max(*self._size)
|
|
1303
|
+
def _set_sizes(self): # it properly sets coherent sub figure dimensions
|
|
1304
|
+
self._set_slots_max(*self._size)
|
|
355
1305
|
self._set_slots(*self._slots)
|
|
356
1306
|
widths = self._get_widths()
|
|
357
|
-
widths = ut.set_sizes(
|
|
358
|
-
|
|
1307
|
+
widths = ut.set_sizes(
|
|
1308
|
+
widths, self._width
|
|
1309
|
+
) # it sets the free subplots widths in accord with the parent figure width
|
|
1310
|
+
widths = ut.fit_sizes(
|
|
1311
|
+
widths, self._width
|
|
1312
|
+
) # it fits the subplots widths to the parent figure width
|
|
359
1313
|
heights = self._get_heights()
|
|
360
|
-
heights = ut.set_sizes(
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
1314
|
+
heights = ut.set_sizes(
|
|
1315
|
+
heights, self._height
|
|
1316
|
+
) # it sets the free subplots height in accord with the parent figure height
|
|
1317
|
+
heights = ut.fit_sizes(
|
|
1318
|
+
heights, self._height
|
|
1319
|
+
) # it fits the subplots heights to the parent figure height
|
|
365
1320
|
self.monitor.set_size(self._size)
|
|
366
|
-
#
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
1321
|
+
# Note: width/height calculations removed as they were unused
|
|
1322
|
+
# Original: self._set_size(sum(widths), sum(heights))
|
|
1323
|
+
(
|
|
1324
|
+
[
|
|
1325
|
+
[
|
|
1326
|
+
self._set_subplot_size(row, col, widths[col - 1], heights[row - 1])
|
|
1327
|
+
for col in self._Cols
|
|
1328
|
+
]
|
|
1329
|
+
for row in self._Rows
|
|
1330
|
+
]
|
|
1331
|
+
if (not self._no_plots)
|
|
1332
|
+
else None
|
|
1333
|
+
) # to make sure that all sub figures have internal dimensions set as well
|
|
1334
|
+
|
|
1335
|
+
def _get_widths(self): # the subplots max/min widths for each column
|
|
1336
|
+
widths = [
|
|
1337
|
+
[self._get_subplot(row, col)._width for row in self._Rows]
|
|
1338
|
+
for col in self._Cols
|
|
1339
|
+
]
|
|
1340
|
+
widths = [
|
|
1341
|
+
self.max_or_min([sub for sub in el if sub is not None], default=None)
|
|
1342
|
+
for el in widths
|
|
1343
|
+
]
|
|
372
1344
|
return widths
|
|
373
1345
|
|
|
374
|
-
def _get_heights(self):
|
|
375
|
-
heights = [
|
|
376
|
-
|
|
1346
|
+
def _get_heights(self): # the subplots max/min heights for each row
|
|
1347
|
+
heights = [
|
|
1348
|
+
[self._get_subplot(row, col)._height for col in self._Cols]
|
|
1349
|
+
for row in self._Rows
|
|
1350
|
+
]
|
|
1351
|
+
heights = [
|
|
1352
|
+
self.max_or_min([sub for sub in el if sub is not None], default=None)
|
|
1353
|
+
for el in heights
|
|
1354
|
+
]
|
|
377
1355
|
return heights
|
|
378
1356
|
|
|
379
|
-
def _set_subplot_size(self, row
|
|
1357
|
+
def _set_subplot_size(self, row=None, col=None, width=None, height=None):
|
|
380
1358
|
self._get_subplot(row, col)._set_size(width, height)
|
|
381
|
-
self._get_subplot(row, col)._set_sizes()
|
|
1359
|
+
self._get_subplot(row, col)._set_sizes()
|
|
382
1360
|
|
|
383
|
-
##############################################
|
|
384
|
-
###### Externally Called Utility #######
|
|
385
|
-
##############################################
|
|
1361
|
+
##############################################
|
|
1362
|
+
###### Externally Called Utility #######
|
|
1363
|
+
##############################################
|
|
386
1364
|
|
|
387
|
-
def _get_time(
|
|
1365
|
+
def _get_time(
|
|
1366
|
+
self, show=True
|
|
1367
|
+
): # it returns the computational time of latest show or build function
|
|
388
1368
|
time = ut.format_time(self._time)
|
|
389
|
-
|
|
1369
|
+
(
|
|
1370
|
+
print(ut.format_strings("plotext time:", time, ut.title_color))
|
|
1371
|
+
if show
|
|
1372
|
+
else None
|
|
1373
|
+
)
|
|
390
1374
|
return self._time
|
|
391
1375
|
|
|
392
|
-
def main(
|
|
1376
|
+
def main(
|
|
1377
|
+
self,
|
|
1378
|
+
): # returns the master figure and sets the active figure to the master
|
|
393
1379
|
self._master._active = self._master
|
|
394
1380
|
return self._master
|
|
395
1381
|
|
|
396
|
-
def plot_size(self, width
|
|
1382
|
+
def plot_size(self, width=None, height=None):
|
|
397
1383
|
width = self._width if width is None else width
|
|
398
1384
|
height = self._height if height is None else height
|
|
399
1385
|
self._set_size(width, height)
|
|
400
1386
|
self._set_master_size() if self._is_master else None
|
|
401
1387
|
self.monitor.size = self._size
|
|
402
1388
|
return self._width, self._height
|
|
403
|
-
|
|
1389
|
+
|
|
404
1390
|
plotsize = plot_size
|
|
405
1391
|
|
|
406
|
-
def take_min(
|
|
1392
|
+
def take_min(
|
|
1393
|
+
self,
|
|
1394
|
+
): # in a matrix of subplots the maximum height/width will be considered for each row/column
|
|
407
1395
|
self.max_or_min = min
|
|
408
1396
|
|
|
409
|
-
def save_fig(
|
|
410
|
-
path
|
|
1397
|
+
def save_fig(
|
|
1398
|
+
self, path=None, append=False, keep_colors=False
|
|
1399
|
+
): # it saves the plot as text or html, keep_colors = True preserves ansi colors for texts
|
|
1400
|
+
path = "plotext.txt" if path is None or not ut.correct_path(path) else path
|
|
411
1401
|
_, extension = os.path.splitext(path)
|
|
412
1402
|
canvas = self.monitor.matrix.get_canvas()
|
|
413
1403
|
if extension == ".html":
|
|
@@ -415,19 +1405,20 @@ class _figure_class():
|
|
|
415
1405
|
elif not keep_colors:
|
|
416
1406
|
canvas = ut.uncolorize(canvas)
|
|
417
1407
|
ut.save_text(canvas, path, append)
|
|
1408
|
+
|
|
418
1409
|
savefig = save_fig
|
|
419
|
-
|
|
420
|
-
##############################################
|
|
421
|
-
############ Docstrings ###############
|
|
422
|
-
##############################################
|
|
423
|
-
add(subplots)
|
|
1410
|
+
|
|
1411
|
+
##############################################
|
|
1412
|
+
############ Docstrings ###############
|
|
1413
|
+
##############################################
|
|
1414
|
+
add(subplots)
|
|
424
1415
|
add(subplots)
|
|
425
1416
|
add(subplot)
|
|
426
1417
|
add(main)
|
|
427
|
-
|
|
1418
|
+
|
|
428
1419
|
add(plot_size)
|
|
429
1420
|
add(take_min)
|
|
430
|
-
|
|
1421
|
+
|
|
431
1422
|
add(title)
|
|
432
1423
|
add(xlabel)
|
|
433
1424
|
add(ylabel)
|
|
@@ -450,12 +1441,12 @@ class _figure_class():
|
|
|
450
1441
|
add(ticks_color)
|
|
451
1442
|
add(ticks_style)
|
|
452
1443
|
add(theme)
|
|
453
|
-
|
|
1444
|
+
|
|
454
1445
|
add(clear_figure)
|
|
455
1446
|
add(clear_data)
|
|
456
1447
|
add(clear_color)
|
|
457
1448
|
add(clear_terminal)
|
|
458
|
-
|
|
1449
|
+
|
|
459
1450
|
add(scatter)
|
|
460
1451
|
add(plot)
|
|
461
1452
|
add(bar)
|
|
@@ -476,16 +1467,17 @@ class _figure_class():
|
|
|
476
1467
|
add(indicator)
|
|
477
1468
|
|
|
478
1469
|
add(matrix_plot)
|
|
1470
|
+
# add(pie) # Commented out to suppress warning - pie documentation needs to be added to _doc.py
|
|
479
1471
|
add(image_plot)
|
|
480
|
-
|
|
1472
|
+
|
|
481
1473
|
add(show)
|
|
482
1474
|
add(build)
|
|
483
1475
|
add(save_fig)
|
|
484
|
-
|
|
1476
|
+
|
|
485
1477
|
add(date_form)
|
|
486
1478
|
add(set_time0)
|
|
487
1479
|
add(today_datetime)
|
|
488
1480
|
add(today_string)
|
|
489
1481
|
add(datetime_to_string)
|
|
490
1482
|
add(datetimes_to_strings)
|
|
491
|
-
add(string_to_datetime)
|
|
1483
|
+
add(string_to_datetime)
|