plotext-plus 1.0.9__py3-none-any.whl → 1.0.10__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.10.dist-info}/METADATA +7 -2
- plotext_plus-1.0.10.dist-info/RECORD +33 -0
- plotext_plus-1.0.9.dist-info/RECORD +0 -33
- {plotext_plus-1.0.9.dist-info → plotext_plus-1.0.10.dist-info}/WHEEL +0 -0
- {plotext_plus-1.0.9.dist-info → plotext_plus-1.0.10.dist-info}/entry_points.txt +0 -0
- {plotext_plus-1.0.9.dist-info → plotext_plus-1.0.10.dist-info}/licenses/LICENSE +0 -0
plotext_plus/_core.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# /usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
2
|
|
|
4
3
|
# This file contains all the main plotext functions available externally to the user
|
|
5
4
|
|
|
@@ -7,284 +6,654 @@
|
|
|
7
6
|
########### Initialisation #############
|
|
8
7
|
##############################################
|
|
9
8
|
|
|
10
|
-
import plotext_plus._doc
|
|
11
|
-
from plotext_plus._doc_utils import documentation as doc
|
|
12
|
-
from plotext_plus._doc_utils import add
|
|
13
|
-
|
|
14
|
-
from ._figure import _figure_class
|
|
15
9
|
from time import sleep as _sleep
|
|
10
|
+
|
|
16
11
|
import plotext_plus._global as _glob
|
|
17
|
-
from plotext_plus import __version__
|
|
18
12
|
import plotext_plus._utility as _ut
|
|
13
|
+
from plotext_plus import __version__
|
|
14
|
+
from plotext_plus._doc_utils import add
|
|
19
15
|
|
|
20
|
-
_figure =
|
|
16
|
+
_figure = (
|
|
17
|
+
_glob.figure
|
|
18
|
+
) # the main figure at top level (defined in _global.py because it is useful also there)
|
|
21
19
|
|
|
22
20
|
##############################################
|
|
23
21
|
######### Subplots Functions ###########
|
|
24
22
|
##############################################
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
|
|
25
|
+
def subplots(rows=None, cols=None):
|
|
26
|
+
"""Create a matrix of subplots for displaying multiple plots.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
rows (int, optional): Number of subplot rows. Defaults to None.
|
|
30
|
+
cols (int, optional): Number of subplot columns. Defaults to None.
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
Figure: The active figure object with configured subplots.
|
|
34
|
+
"""
|
|
27
35
|
sub = _figure._active.subplots(rows, cols)
|
|
28
36
|
_figure.show() if _figure._interactive else None
|
|
29
37
|
return sub
|
|
30
38
|
|
|
31
|
-
|
|
39
|
+
|
|
40
|
+
def subplot(row=None, col=None):
|
|
41
|
+
"""Select or activate a specific subplot within the subplot matrix.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
row (int, optional): Row index of the subplot to select. Defaults to None.
|
|
45
|
+
col (int, optional): Column index of the subplot to select. Defaults to None.
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
Monitor: The subplot monitor object for the specified position.
|
|
49
|
+
"""
|
|
32
50
|
sub = _figure.subplot(row, col)
|
|
33
51
|
_figure.show() if _figure._interactive else None
|
|
34
52
|
return sub
|
|
35
53
|
|
|
54
|
+
|
|
36
55
|
def main():
|
|
56
|
+
"""Return to the main figure (exit subplot mode).
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
Figure: The main figure object.
|
|
60
|
+
"""
|
|
37
61
|
return _figure.main()
|
|
38
62
|
|
|
63
|
+
|
|
39
64
|
def active():
|
|
40
65
|
return _figure._active
|
|
41
66
|
|
|
67
|
+
|
|
42
68
|
##############################################
|
|
43
69
|
####### Outside Set Functions ##########
|
|
44
70
|
##############################################
|
|
45
71
|
|
|
46
|
-
|
|
72
|
+
|
|
73
|
+
def interactive(interactive=None):
|
|
47
74
|
_figure._set_interactive(interactive)
|
|
48
75
|
|
|
49
|
-
|
|
76
|
+
|
|
77
|
+
def plot_size(width=None, height=None):
|
|
78
|
+
"""Set or get the plot size dimensions.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
width (int, optional): Plot width in characters. Defaults to None.
|
|
82
|
+
height (int, optional): Plot height in characters. Defaults to None.
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
tuple: The current plot size as (width, height).
|
|
86
|
+
"""
|
|
50
87
|
size = _figure._active.plot_size(width, height)
|
|
51
88
|
_figure.show() if _figure._interactive else None
|
|
52
89
|
return size
|
|
90
|
+
|
|
91
|
+
|
|
53
92
|
plotsize = plot_size
|
|
54
93
|
|
|
55
|
-
|
|
56
|
-
|
|
94
|
+
|
|
95
|
+
def limit_size(width=None, height=None):
|
|
96
|
+
# _figure._master._set_size()
|
|
57
97
|
_figure._master._limit_size(width, height)
|
|
98
|
+
|
|
99
|
+
|
|
58
100
|
limitsize = limit_size
|
|
59
101
|
|
|
102
|
+
|
|
60
103
|
def take_min():
|
|
61
104
|
_figure._active.take_min()
|
|
105
|
+
|
|
106
|
+
|
|
62
107
|
takemin = take_min
|
|
63
108
|
|
|
109
|
+
|
|
64
110
|
def title(label):
|
|
65
111
|
_figure._active.title(label)
|
|
66
112
|
_figure.show() if _figure._interactive else None
|
|
67
113
|
|
|
68
|
-
|
|
69
|
-
|
|
114
|
+
|
|
115
|
+
def xlabel(label=None, xside=None):
|
|
116
|
+
_figure._active.xlabel(label=label, xside=xside)
|
|
70
117
|
_figure.show() if _figure._interactive else None
|
|
71
118
|
|
|
72
|
-
|
|
73
|
-
|
|
119
|
+
|
|
120
|
+
def ylabel(label=None, yside=None):
|
|
121
|
+
_figure._active.ylabel(label=label, yside=yside)
|
|
74
122
|
_figure.show() if _figure._interactive else None
|
|
75
123
|
|
|
76
|
-
|
|
77
|
-
|
|
124
|
+
|
|
125
|
+
def xlim(left=None, right=None, xside=None):
|
|
126
|
+
_figure._active.xlim(left=left, right=right, xside=xside)
|
|
78
127
|
_figure.show() if _figure._interactive else None
|
|
79
128
|
|
|
80
|
-
|
|
81
|
-
|
|
129
|
+
|
|
130
|
+
def ylim(lower=None, upper=None, yside=None):
|
|
131
|
+
_figure._active.ylim(lower=lower, upper=upper, yside=yside)
|
|
82
132
|
_figure.show() if _figure._interactive else None
|
|
83
133
|
|
|
84
|
-
|
|
85
|
-
|
|
134
|
+
|
|
135
|
+
def xscale(scale=None, xside=None):
|
|
136
|
+
_figure._active.xscale(scale=scale, xside=xside)
|
|
86
137
|
_figure.show() if _figure._interactive else None
|
|
87
138
|
|
|
88
|
-
|
|
89
|
-
|
|
139
|
+
|
|
140
|
+
def yscale(scale=None, yside=None):
|
|
141
|
+
_figure._active.yscale(scale=scale, yside=yside)
|
|
90
142
|
_figure.show() if _figure._interactive else None
|
|
91
143
|
|
|
92
|
-
|
|
93
|
-
|
|
144
|
+
|
|
145
|
+
def xticks(ticks=None, labels=None, xside=None):
|
|
146
|
+
_figure._active.xticks(ticks=ticks, labels=labels, xside=xside)
|
|
94
147
|
_figure.show() if _figure._interactive else None
|
|
95
148
|
|
|
96
|
-
|
|
97
|
-
|
|
149
|
+
|
|
150
|
+
def yticks(ticks=None, labels=None, yside=None):
|
|
151
|
+
_figure._active.yticks(ticks=ticks, labels=labels, yside=yside)
|
|
98
152
|
_figure.show() if _figure._interactive else None
|
|
99
153
|
|
|
100
|
-
|
|
101
|
-
|
|
154
|
+
|
|
155
|
+
def xfrequency(frequency=None, xside=None):
|
|
156
|
+
_figure._active.xfrequency(frequency=frequency, xside=xside)
|
|
102
157
|
_figure.show() if _figure._interactive else None
|
|
103
158
|
|
|
104
|
-
|
|
105
|
-
|
|
159
|
+
|
|
160
|
+
def yfrequency(frequency=None, yside=None):
|
|
161
|
+
_figure._active.yfrequency(frequency=frequency, yside=yside)
|
|
106
162
|
_figure.show() if _figure._interactive else None
|
|
107
163
|
|
|
108
|
-
|
|
109
|
-
|
|
164
|
+
|
|
165
|
+
def xreverse(reverse=None, xside=None):
|
|
166
|
+
_figure._active.xreverse(reverse=reverse, xside=xside)
|
|
110
167
|
_figure.show() if _figure._interactive else None
|
|
111
168
|
|
|
112
|
-
|
|
113
|
-
|
|
169
|
+
|
|
170
|
+
def yreverse(reverse=None, yside=None):
|
|
171
|
+
_figure._active.yreverse(reverse=reverse, yside=yside)
|
|
114
172
|
_figure.show() if _figure._interactive else None
|
|
115
173
|
|
|
116
|
-
|
|
117
|
-
|
|
174
|
+
|
|
175
|
+
def xaxes(lower=None, upper=None):
|
|
176
|
+
_figure._active.xaxes(lower=lower, upper=upper)
|
|
118
177
|
_figure.show() if _figure._interactive else None
|
|
119
178
|
|
|
120
|
-
|
|
121
|
-
|
|
179
|
+
|
|
180
|
+
def yaxes(left=None, right=None):
|
|
181
|
+
_figure._active.yaxes(left=left, right=right)
|
|
122
182
|
_figure.show() if _figure._interactive else None
|
|
123
183
|
|
|
124
|
-
|
|
125
|
-
|
|
184
|
+
|
|
185
|
+
def frame(frame=None):
|
|
186
|
+
_figure._active.frame(frame=frame)
|
|
126
187
|
_figure.show() if _figure._interactive else None
|
|
127
188
|
|
|
128
|
-
|
|
129
|
-
|
|
189
|
+
|
|
190
|
+
def grid(horizontal=None, vertical=None):
|
|
191
|
+
_figure._active.grid(horizontal=horizontal, vertical=vertical)
|
|
130
192
|
_figure.show() if _figure._interactive else None
|
|
131
193
|
|
|
132
|
-
|
|
194
|
+
|
|
195
|
+
def canvas_color(color=None):
|
|
133
196
|
_figure._active.canvas_color(color)
|
|
134
197
|
_figure.show() if _figure._interactive else None
|
|
135
198
|
|
|
136
|
-
|
|
199
|
+
|
|
200
|
+
def axes_color(color=None):
|
|
137
201
|
_figure._active.axes_color(color)
|
|
138
202
|
_figure.show() if _figure._interactive else None
|
|
139
203
|
|
|
140
|
-
|
|
204
|
+
|
|
205
|
+
def ticks_color(color=None):
|
|
141
206
|
_figure._active.ticks_color(color)
|
|
142
207
|
_figure.show() if _figure._interactive else None
|
|
143
208
|
|
|
144
|
-
|
|
209
|
+
|
|
210
|
+
def ticks_style(style=None):
|
|
145
211
|
_figure._active.ticks_style(style)
|
|
146
212
|
_figure.show() if _figure._interactive else None
|
|
147
213
|
|
|
148
|
-
|
|
214
|
+
|
|
215
|
+
def theme(theme=None):
|
|
149
216
|
_figure._active.theme(theme)
|
|
150
217
|
_figure.show() if _figure._interactive else None
|
|
151
218
|
|
|
219
|
+
|
|
152
220
|
##############################################
|
|
153
221
|
########### Clear Functions ############
|
|
154
222
|
##############################################
|
|
155
223
|
|
|
156
|
-
|
|
224
|
+
|
|
225
|
+
def clear_figure():
|
|
157
226
|
_figure._active.clear_figure()
|
|
158
227
|
_figure.show() if _figure._interactive else None
|
|
228
|
+
|
|
229
|
+
|
|
159
230
|
clf = clear_figure
|
|
160
231
|
|
|
161
|
-
|
|
232
|
+
|
|
233
|
+
def clear_data():
|
|
162
234
|
_figure._active.clear_data()
|
|
163
235
|
_figure.show() if _figure._interactive else None
|
|
236
|
+
|
|
237
|
+
|
|
164
238
|
cld = clear_data
|
|
165
239
|
|
|
166
|
-
|
|
240
|
+
|
|
241
|
+
def clear_color():
|
|
167
242
|
_figure._active.clear_color()
|
|
168
243
|
_figure.show() if _figure._interactive else None
|
|
244
|
+
|
|
245
|
+
|
|
169
246
|
clc = clear_color
|
|
170
247
|
|
|
171
|
-
|
|
172
|
-
|
|
248
|
+
|
|
249
|
+
def clear_terminal(lines=None):
|
|
250
|
+
_figure._active.clear_terminal(lines=lines)
|
|
251
|
+
|
|
252
|
+
|
|
173
253
|
clt = clear_terminal
|
|
174
254
|
|
|
175
255
|
##############################################
|
|
176
256
|
###### Main Plotting Functions #########
|
|
177
257
|
##############################################
|
|
178
258
|
|
|
179
|
-
def scatter(*args, marker = None, color = None, style = None, fillx = None, filly = None, xside = None, yside = None, label = None):
|
|
180
|
-
_figure._active.scatter(*args, xside = xside, yside = yside, marker = marker, color = color, style = style, fillx = fillx, filly = filly, label = label)
|
|
181
|
-
_figure.show() if _figure._interactive else None
|
|
182
259
|
|
|
183
|
-
def
|
|
184
|
-
|
|
260
|
+
def scatter(
|
|
261
|
+
*args,
|
|
262
|
+
marker=None,
|
|
263
|
+
color=None,
|
|
264
|
+
style=None,
|
|
265
|
+
fillx=None,
|
|
266
|
+
filly=None,
|
|
267
|
+
xside=None,
|
|
268
|
+
yside=None,
|
|
269
|
+
label=None,
|
|
270
|
+
):
|
|
271
|
+
_figure._active.scatter(
|
|
272
|
+
*args,
|
|
273
|
+
xside=xside,
|
|
274
|
+
yside=yside,
|
|
275
|
+
marker=marker,
|
|
276
|
+
color=color,
|
|
277
|
+
style=style,
|
|
278
|
+
fillx=fillx,
|
|
279
|
+
filly=filly,
|
|
280
|
+
label=label,
|
|
281
|
+
)
|
|
185
282
|
_figure.show() if _figure._interactive else None
|
|
186
283
|
|
|
187
|
-
|
|
188
|
-
|
|
284
|
+
|
|
285
|
+
def plot(
|
|
286
|
+
*args,
|
|
287
|
+
marker=None,
|
|
288
|
+
color=None,
|
|
289
|
+
style=None,
|
|
290
|
+
fillx=None,
|
|
291
|
+
filly=None,
|
|
292
|
+
xside=None,
|
|
293
|
+
yside=None,
|
|
294
|
+
label=None,
|
|
295
|
+
):
|
|
296
|
+
_figure._active.plot(
|
|
297
|
+
*args,
|
|
298
|
+
xside=xside,
|
|
299
|
+
yside=yside,
|
|
300
|
+
marker=marker,
|
|
301
|
+
color=color,
|
|
302
|
+
fillx=fillx,
|
|
303
|
+
filly=filly,
|
|
304
|
+
label=label,
|
|
305
|
+
)
|
|
189
306
|
_figure.show() if _figure._interactive else None
|
|
190
307
|
|
|
191
|
-
|
|
192
|
-
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def bar(
|
|
311
|
+
*args,
|
|
312
|
+
marker=None,
|
|
313
|
+
color=None,
|
|
314
|
+
fill=None,
|
|
315
|
+
width=None,
|
|
316
|
+
orientation=None,
|
|
317
|
+
minimum=None,
|
|
318
|
+
reset_ticks=None,
|
|
319
|
+
xside=None,
|
|
320
|
+
yside=None,
|
|
321
|
+
label=None,
|
|
322
|
+
):
|
|
323
|
+
_figure._active.bar(
|
|
324
|
+
*args,
|
|
325
|
+
xside=xside,
|
|
326
|
+
yside=yside,
|
|
327
|
+
marker=marker,
|
|
328
|
+
color=color,
|
|
329
|
+
fill=fill,
|
|
330
|
+
width=width,
|
|
331
|
+
orientation=orientation,
|
|
332
|
+
label=label,
|
|
333
|
+
minimum=minimum,
|
|
334
|
+
reset_ticks=reset_ticks,
|
|
335
|
+
)
|
|
193
336
|
_figure.show() if _figure._interactive else None
|
|
194
337
|
|
|
195
|
-
|
|
196
|
-
|
|
338
|
+
|
|
339
|
+
def simple_bar(*args, marker=None, color=None, title=None, width=None):
|
|
340
|
+
_glob.simple_bar(*args, width=width, marker=marker, color=color, title=title)
|
|
197
341
|
_figure.show() if _figure._interactive else None
|
|
198
342
|
|
|
199
|
-
|
|
200
|
-
|
|
343
|
+
|
|
344
|
+
def multiple_bar(
|
|
345
|
+
*args,
|
|
346
|
+
marker=None,
|
|
347
|
+
color=None,
|
|
348
|
+
fill=None,
|
|
349
|
+
width=None,
|
|
350
|
+
orientation=None,
|
|
351
|
+
minimum=None,
|
|
352
|
+
reset_ticks=None,
|
|
353
|
+
xside=None,
|
|
354
|
+
yside=None,
|
|
355
|
+
labels=None,
|
|
356
|
+
):
|
|
357
|
+
_figure._active.multiple_bar(
|
|
358
|
+
*args,
|
|
359
|
+
xside=xside,
|
|
360
|
+
yside=yside,
|
|
361
|
+
marker=marker,
|
|
362
|
+
color=color,
|
|
363
|
+
fill=fill,
|
|
364
|
+
width=width,
|
|
365
|
+
orientation=orientation,
|
|
366
|
+
labels=labels,
|
|
367
|
+
minimum=minimum,
|
|
368
|
+
reset_ticks=reset_ticks,
|
|
369
|
+
)
|
|
201
370
|
_figure.show() if _figure._interactive else None
|
|
202
371
|
|
|
203
|
-
|
|
204
|
-
|
|
372
|
+
|
|
373
|
+
def simple_multiple_bar(
|
|
374
|
+
*args, marker=None, colors=None, title=None, width=None, labels=None
|
|
375
|
+
):
|
|
376
|
+
_glob.simple_multiple_bar(
|
|
377
|
+
*args, width=width, marker=marker, colors=colors, title=title, labels=labels
|
|
378
|
+
)
|
|
205
379
|
_figure.show() if _figure._interactive else None
|
|
206
380
|
|
|
207
|
-
|
|
208
|
-
|
|
381
|
+
|
|
382
|
+
def stacked_bar(
|
|
383
|
+
*args,
|
|
384
|
+
marker=None,
|
|
385
|
+
color=None,
|
|
386
|
+
fill=None,
|
|
387
|
+
width=None,
|
|
388
|
+
orientation=None,
|
|
389
|
+
minimum=None,
|
|
390
|
+
reset_ticks=None,
|
|
391
|
+
xside=None,
|
|
392
|
+
yside=None,
|
|
393
|
+
labels=None,
|
|
394
|
+
):
|
|
395
|
+
_figure._active.stacked_bar(
|
|
396
|
+
*args,
|
|
397
|
+
xside=xside,
|
|
398
|
+
yside=yside,
|
|
399
|
+
marker=marker,
|
|
400
|
+
color=color,
|
|
401
|
+
fill=fill,
|
|
402
|
+
width=width,
|
|
403
|
+
orientation=orientation,
|
|
404
|
+
labels=labels,
|
|
405
|
+
minimum=minimum,
|
|
406
|
+
reset_ticks=reset_ticks,
|
|
407
|
+
)
|
|
209
408
|
_figure.show() if _figure._interactive else None
|
|
210
409
|
|
|
211
|
-
|
|
212
|
-
|
|
410
|
+
|
|
411
|
+
def simple_stacked_bar(
|
|
412
|
+
*args, marker=None, colors=None, title=None, width=None, labels=None
|
|
413
|
+
):
|
|
414
|
+
_glob.simple_stacked_bar(
|
|
415
|
+
*args, width=width, marker=marker, colors=colors, title=title, labels=labels
|
|
416
|
+
)
|
|
213
417
|
_figure.show() if _figure._interactive else None
|
|
214
418
|
|
|
215
|
-
|
|
216
|
-
|
|
419
|
+
|
|
420
|
+
def hist(
|
|
421
|
+
data,
|
|
422
|
+
bins=None,
|
|
423
|
+
marker=None,
|
|
424
|
+
color=None,
|
|
425
|
+
fill=None,
|
|
426
|
+
norm=None,
|
|
427
|
+
width=None,
|
|
428
|
+
orientation=None,
|
|
429
|
+
minimum=None,
|
|
430
|
+
xside=None,
|
|
431
|
+
yside=None,
|
|
432
|
+
label=None,
|
|
433
|
+
):
|
|
434
|
+
_figure._active.hist(
|
|
435
|
+
data,
|
|
436
|
+
bins=bins,
|
|
437
|
+
norm=norm,
|
|
438
|
+
xside=xside,
|
|
439
|
+
yside=yside,
|
|
440
|
+
marker=marker,
|
|
441
|
+
color=color,
|
|
442
|
+
fill=fill,
|
|
443
|
+
width=width,
|
|
444
|
+
orientation=orientation,
|
|
445
|
+
label=label,
|
|
446
|
+
minimum=minimum,
|
|
447
|
+
)
|
|
217
448
|
_figure.show() if _figure._interactive else None
|
|
218
449
|
|
|
219
|
-
|
|
220
|
-
|
|
450
|
+
|
|
451
|
+
def candlestick(
|
|
452
|
+
dates, data, colors=None, orientation=None, xside=None, yside=None, label=None
|
|
453
|
+
):
|
|
454
|
+
_figure._active.candlestick(
|
|
455
|
+
dates,
|
|
456
|
+
data,
|
|
457
|
+
xside=xside,
|
|
458
|
+
yside=yside,
|
|
459
|
+
orientation=orientation,
|
|
460
|
+
colors=colors,
|
|
461
|
+
label=label,
|
|
462
|
+
)
|
|
221
463
|
_figure.show() if _figure._interactive else None
|
|
222
464
|
|
|
223
|
-
|
|
224
|
-
|
|
465
|
+
|
|
466
|
+
def box(
|
|
467
|
+
*args,
|
|
468
|
+
quintuples=None,
|
|
469
|
+
colors=None,
|
|
470
|
+
fill=None,
|
|
471
|
+
width=None,
|
|
472
|
+
orientation=None,
|
|
473
|
+
minimum=None,
|
|
474
|
+
reset_ticks=None,
|
|
475
|
+
xside=None,
|
|
476
|
+
yside=None,
|
|
477
|
+
label=None,
|
|
478
|
+
):
|
|
479
|
+
_figure._active.box(
|
|
480
|
+
*args,
|
|
481
|
+
xside=xside,
|
|
482
|
+
yside=yside,
|
|
483
|
+
orientation=orientation,
|
|
484
|
+
colors=colors,
|
|
485
|
+
label=label,
|
|
486
|
+
fill=fill,
|
|
487
|
+
width=width,
|
|
488
|
+
minimum=minimum,
|
|
489
|
+
reset_ticks=reset_ticks,
|
|
490
|
+
quintuples=quintuples,
|
|
491
|
+
)
|
|
225
492
|
_figure.show() if _figure._interactive else None
|
|
226
493
|
|
|
494
|
+
|
|
227
495
|
##############################################
|
|
228
496
|
########### Plotting Tools #############
|
|
229
497
|
##############################################
|
|
230
498
|
|
|
231
|
-
|
|
232
|
-
|
|
499
|
+
|
|
500
|
+
def error(*args, xerr=None, yerr=None, color=None, xside=None, yside=None, label=None):
|
|
501
|
+
_figure.error(
|
|
502
|
+
*args, xerr=xerr, yerr=yerr, xside=xside, yside=yside, color=color, label=label
|
|
503
|
+
)
|
|
233
504
|
_figure.show() if _figure._interactive else None
|
|
234
505
|
|
|
235
|
-
|
|
236
|
-
|
|
506
|
+
|
|
507
|
+
def event_plot(data, marker=None, color=None, orientation=None, side=None):
|
|
508
|
+
_figure._active.event_plot(
|
|
509
|
+
data, orientation=orientation, marker=marker, color=color, side=side
|
|
510
|
+
)
|
|
237
511
|
_figure.show() if _figure._interactive else None
|
|
238
512
|
|
|
513
|
+
|
|
239
514
|
eventplot = event_plot
|
|
240
515
|
|
|
241
|
-
|
|
242
|
-
|
|
516
|
+
|
|
517
|
+
def vertical_line(coordinate, color=None, xside=None):
|
|
518
|
+
_figure._active.vertical_line(coordinate, color=color, xside=xside)
|
|
243
519
|
_figure.show() if _figure._interactive else None
|
|
520
|
+
|
|
521
|
+
|
|
244
522
|
vline = vertical_line
|
|
245
523
|
|
|
246
|
-
|
|
247
|
-
|
|
524
|
+
|
|
525
|
+
def horizontal_line(coordinate, color=None, yside=None):
|
|
526
|
+
_figure._active.horizontal_line(coordinate, color=color, yside=yside)
|
|
248
527
|
_figure.show() if _figure._interactive else None
|
|
528
|
+
|
|
529
|
+
|
|
249
530
|
hline = horizontal_line
|
|
250
531
|
|
|
251
|
-
|
|
252
|
-
|
|
532
|
+
|
|
533
|
+
def text(
|
|
534
|
+
label,
|
|
535
|
+
x,
|
|
536
|
+
y,
|
|
537
|
+
color=None,
|
|
538
|
+
background=None,
|
|
539
|
+
style=None,
|
|
540
|
+
orientation=None,
|
|
541
|
+
alignment=None,
|
|
542
|
+
xside=None,
|
|
543
|
+
yside=None,
|
|
544
|
+
):
|
|
545
|
+
_figure._active.text(
|
|
546
|
+
label,
|
|
547
|
+
x,
|
|
548
|
+
y,
|
|
549
|
+
xside=xside,
|
|
550
|
+
yside=yside,
|
|
551
|
+
color=color,
|
|
552
|
+
background=background,
|
|
553
|
+
style=style,
|
|
554
|
+
orientation=orientation,
|
|
555
|
+
alignment=alignment,
|
|
556
|
+
)
|
|
253
557
|
_figure.show() if _figure._interactive else None
|
|
254
558
|
|
|
255
|
-
|
|
256
|
-
|
|
559
|
+
|
|
560
|
+
def rectangle(
|
|
561
|
+
x=None,
|
|
562
|
+
y=None,
|
|
563
|
+
marker=None,
|
|
564
|
+
color=None,
|
|
565
|
+
lines=None,
|
|
566
|
+
fill=None,
|
|
567
|
+
xside=None,
|
|
568
|
+
yside=None,
|
|
569
|
+
label=None,
|
|
570
|
+
):
|
|
571
|
+
_figure._active.rectangle(
|
|
572
|
+
x=x,
|
|
573
|
+
y=y,
|
|
574
|
+
xside=xside,
|
|
575
|
+
yside=yside,
|
|
576
|
+
lines=lines,
|
|
577
|
+
marker=marker,
|
|
578
|
+
color=color,
|
|
579
|
+
fill=fill,
|
|
580
|
+
label=label,
|
|
581
|
+
)
|
|
257
582
|
_figure.show() if _figure._interactive else None
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
def polygon(
|
|
586
|
+
x=None,
|
|
587
|
+
y=None,
|
|
588
|
+
radius=None,
|
|
589
|
+
sides=None,
|
|
590
|
+
marker=None,
|
|
591
|
+
color=None,
|
|
592
|
+
lines=None,
|
|
593
|
+
fill=None,
|
|
594
|
+
xside=None,
|
|
595
|
+
yside=None,
|
|
596
|
+
label=None,
|
|
597
|
+
):
|
|
598
|
+
_figure._active.polygon(
|
|
599
|
+
x=x,
|
|
600
|
+
y=y,
|
|
601
|
+
radius=radius,
|
|
602
|
+
sides=sides,
|
|
603
|
+
xside=xside,
|
|
604
|
+
yside=yside,
|
|
605
|
+
lines=lines,
|
|
606
|
+
marker=marker,
|
|
607
|
+
color=color,
|
|
608
|
+
fill=fill,
|
|
609
|
+
label=label,
|
|
610
|
+
)
|
|
261
611
|
_figure.show() if _figure._interactive else None
|
|
262
612
|
|
|
263
|
-
|
|
264
|
-
|
|
613
|
+
|
|
614
|
+
def confusion_matrix(actual, predicted, color=None, style=None, labels=None):
|
|
615
|
+
_figure._active.confusion_matrix(
|
|
616
|
+
actual, predicted, labels=labels, color=color, style=style
|
|
617
|
+
)
|
|
265
618
|
_figure.show() if _figure._interactive else None
|
|
266
619
|
|
|
620
|
+
|
|
267
621
|
cmatrix = confusion_matrix
|
|
268
622
|
|
|
269
|
-
|
|
270
|
-
|
|
623
|
+
|
|
624
|
+
def indicator(value, label=None, color=None, style=None):
|
|
625
|
+
_figure._active.indicator(value, label=label, color=color, style=style)
|
|
271
626
|
_figure.show() if _figure._interactive else None
|
|
272
627
|
|
|
628
|
+
|
|
273
629
|
##############################################
|
|
274
630
|
############## 2D Plots ################
|
|
275
|
-
##############################################
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
631
|
+
##############################################
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
def matrix_plot(matrix, marker=None, style=None, fast=False):
|
|
635
|
+
_figure._active.matrix_plot(matrix, marker=marker, style=style, fast=fast)
|
|
279
636
|
_figure.show() if _figure._interactive else None
|
|
280
637
|
|
|
281
|
-
|
|
638
|
+
|
|
639
|
+
def pie(
|
|
640
|
+
labels,
|
|
641
|
+
values,
|
|
642
|
+
colors=None,
|
|
643
|
+
radius=None,
|
|
644
|
+
show_values=True,
|
|
645
|
+
show_percentages=True,
|
|
646
|
+
title=None,
|
|
647
|
+
show_values_on_slices=False,
|
|
648
|
+
donut=False,
|
|
649
|
+
remaining_color=None,
|
|
650
|
+
):
|
|
282
651
|
"""
|
|
283
652
|
Create a pie chart representation using terminal characters.
|
|
284
|
-
|
|
653
|
+
|
|
285
654
|
Args:
|
|
286
655
|
labels (list): Labels for each slice
|
|
287
|
-
values (list): Values for each slice
|
|
656
|
+
values (list): Values for each slice
|
|
288
657
|
colors (list, optional): Colors for each slice
|
|
289
658
|
radius (int, optional): Radius of the pie chart
|
|
290
659
|
show_values (bool): Whether to show actual values in legend
|
|
@@ -294,118 +663,168 @@ def pie(labels, values, colors = None, radius = None, show_values = True, show_p
|
|
|
294
663
|
donut (bool): If True, creates a doughnut chart with hollow center (inner radius = 1/3 outer radius)
|
|
295
664
|
remaining_color (str): If specified, colors the remaining slice with this color instead of leaving it as spaces
|
|
296
665
|
"""
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
666
|
+
# Call the monitor directly since _figure.pie method is not available
|
|
667
|
+
_figure.monitor.draw_pie(
|
|
668
|
+
labels,
|
|
669
|
+
values,
|
|
670
|
+
colors=colors,
|
|
671
|
+
radius=radius,
|
|
672
|
+
show_values=show_values,
|
|
673
|
+
show_percentages=show_percentages,
|
|
674
|
+
title=title,
|
|
675
|
+
show_values_on_slices=show_values_on_slices,
|
|
676
|
+
donut=donut,
|
|
677
|
+
remaining_color=remaining_color,
|
|
678
|
+
)
|
|
300
679
|
_figure.show() if _figure._interactive else None
|
|
301
680
|
|
|
302
|
-
|
|
303
|
-
|
|
681
|
+
|
|
682
|
+
def heatmap(dataframe, color=None, style=None):
|
|
683
|
+
_figure._active.heatmap(dataframe, color=color, style=style)
|
|
304
684
|
_figure.show() if _figure._interactive else None
|
|
305
685
|
|
|
306
|
-
|
|
307
|
-
|
|
686
|
+
|
|
687
|
+
def image_plot(path, marker=None, style=None, fast=False, grayscale=False):
|
|
688
|
+
_figure._active.image_plot(
|
|
689
|
+
path, marker=marker, style=style, grayscale=grayscale, fast=fast
|
|
690
|
+
)
|
|
308
691
|
_figure.show() if _figure._interactive else None
|
|
309
|
-
|
|
692
|
+
|
|
693
|
+
|
|
310
694
|
def play_gif(path):
|
|
311
695
|
_glob.play_gif(path)
|
|
312
696
|
_figure.show() if _figure._interactive else None
|
|
313
697
|
|
|
314
|
-
|
|
698
|
+
|
|
699
|
+
def play_video(path, from_youtube=False):
|
|
315
700
|
_glob.play_video(path, from_youtube)
|
|
316
701
|
_figure.show() if _figure._interactive else None
|
|
317
702
|
|
|
703
|
+
|
|
318
704
|
def play_youtube(url):
|
|
319
705
|
_glob.play_youtube(url)
|
|
320
706
|
_figure.show() if _figure._interactive else None
|
|
321
707
|
|
|
322
|
-
|
|
708
|
+
|
|
709
|
+
def get_youtube(url, path=None, log=True):
|
|
323
710
|
_glob.get_youtube(url, path, log)
|
|
324
711
|
|
|
712
|
+
|
|
325
713
|
##############################################
|
|
326
714
|
########## Build Functions #############
|
|
327
715
|
##############################################
|
|
328
716
|
|
|
717
|
+
|
|
329
718
|
def show():
|
|
330
719
|
_figure.show()
|
|
331
720
|
|
|
721
|
+
|
|
332
722
|
def build():
|
|
333
723
|
return _figure.build()
|
|
334
724
|
|
|
335
|
-
|
|
725
|
+
|
|
726
|
+
def sleep(time=0):
|
|
336
727
|
_sleep(time)
|
|
337
728
|
|
|
338
|
-
|
|
729
|
+
|
|
730
|
+
def time(show=True):
|
|
339
731
|
return _figure._get_time(show)
|
|
340
732
|
|
|
341
|
-
|
|
733
|
+
|
|
734
|
+
def save_fig(path=None, append=False, keep_colors=False):
|
|
342
735
|
_figure.save_fig(path, append, keep_colors)
|
|
736
|
+
|
|
737
|
+
|
|
343
738
|
savefig = save_fig
|
|
344
739
|
|
|
345
|
-
|
|
346
|
-
|
|
740
|
+
|
|
741
|
+
def from_matplotlib(fig, marker=None):
|
|
742
|
+
_glob.from_matplotlib(fig, marker=marker)
|
|
743
|
+
|
|
347
744
|
|
|
348
745
|
##############################################
|
|
349
746
|
########## Output Functions ############
|
|
350
747
|
##############################################
|
|
351
748
|
|
|
352
|
-
|
|
749
|
+
|
|
750
|
+
def banner_mode(enabled=True, title=None):
|
|
353
751
|
"""Enable or disable banner mode for chart output using chuk-term"""
|
|
354
752
|
from plotext_plus._output import set_output_mode
|
|
753
|
+
|
|
355
754
|
set_output_mode(enabled, title)
|
|
356
755
|
|
|
756
|
+
|
|
357
757
|
def output_info(message):
|
|
358
758
|
"""Output info message using chuk-term styling"""
|
|
359
759
|
from plotext_plus._output import info
|
|
760
|
+
|
|
360
761
|
info(message)
|
|
361
762
|
|
|
763
|
+
|
|
362
764
|
def output_success(message):
|
|
363
765
|
"""Output success message using chuk-term styling"""
|
|
364
766
|
from plotext_plus._output import success
|
|
767
|
+
|
|
365
768
|
success(message)
|
|
366
769
|
|
|
770
|
+
|
|
367
771
|
def output_warning(message):
|
|
368
772
|
"""Output warning message using chuk-term styling"""
|
|
369
773
|
from plotext_plus._output import warning
|
|
774
|
+
|
|
370
775
|
warning(message)
|
|
371
776
|
|
|
777
|
+
|
|
372
778
|
def output_error(message):
|
|
373
779
|
"""Output error message using chuk-term styling"""
|
|
374
780
|
from plotext_plus._output import error
|
|
781
|
+
|
|
375
782
|
error(message)
|
|
376
783
|
|
|
784
|
+
|
|
377
785
|
##############################################
|
|
378
786
|
########## Date Functions #############
|
|
379
787
|
##############################################
|
|
380
788
|
|
|
381
|
-
|
|
789
|
+
|
|
790
|
+
def date_form(input_form=None, output_form=None):
|
|
382
791
|
_figure._active.date_form(input_form, output_form)
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
def set_time0(string, input_form=None):
|
|
795
|
+
_figure._active.set_time0(string, input_form=input_form)
|
|
796
|
+
|
|
386
797
|
|
|
387
798
|
def today_datetime():
|
|
388
799
|
return _figure._active.today_datetime()
|
|
389
800
|
|
|
390
|
-
|
|
801
|
+
|
|
802
|
+
def today_string(output_form=None):
|
|
391
803
|
return _figure._active.today_string(output_form)
|
|
392
804
|
|
|
393
|
-
def datetime_to_string(datetime, output_form = None):
|
|
394
|
-
return _figure._active.datetime_to_string(datetime, output_form = output_form)
|
|
395
805
|
|
|
396
|
-
def
|
|
397
|
-
return _figure._active.
|
|
806
|
+
def datetime_to_string(datetime, output_form=None):
|
|
807
|
+
return _figure._active.datetime_to_string(datetime, output_form=output_form)
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
def datetimes_to_strings(datetimes, output_form=None):
|
|
811
|
+
return _figure._active.datetimes_to_strings(datetimes, output_form=output_form)
|
|
812
|
+
|
|
398
813
|
|
|
399
814
|
datetimes_to_string = datetimes_to_strings
|
|
400
815
|
|
|
401
|
-
def string_to_datetime(string, input_form = None):
|
|
402
|
-
return _figure._active.string_to_datetime(string, input_form = input_form)
|
|
403
816
|
|
|
404
|
-
def
|
|
405
|
-
return _figure._active.
|
|
817
|
+
def string_to_datetime(string, input_form=None):
|
|
818
|
+
return _figure._active.string_to_datetime(string, input_form=input_form)
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
def string_to_time(string, input_form=None): ##########ADD DOC############
|
|
822
|
+
return _figure._active.string_to_time(string, input_form=input_form)
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
def strings_to_time(string, input_form=None): ##########ADD DOC############
|
|
826
|
+
return _figure._active.strings_to_time(string, input_form=input_form)
|
|
406
827
|
|
|
407
|
-
def strings_to_time(string, input_form = None):##########ADD DOC############
|
|
408
|
-
return _figure._active.strings_to_time(string, input_form = input_form)
|
|
409
828
|
|
|
410
829
|
##############################################
|
|
411
830
|
########## File Functions ############
|
|
@@ -413,68 +832,94 @@ def strings_to_time(string, input_form = None):##########ADD DOC############
|
|
|
413
832
|
|
|
414
833
|
script_folder = _ut.script_folder
|
|
415
834
|
|
|
416
|
-
|
|
417
|
-
|
|
835
|
+
|
|
836
|
+
def parent_folder(path, level=1):
|
|
837
|
+
return _ut.parent_folder(path, level=level)
|
|
838
|
+
|
|
418
839
|
|
|
419
840
|
def join_paths(*args):
|
|
420
841
|
return _ut.join_paths(*args)
|
|
421
842
|
|
|
422
|
-
def save_text(text, path, log = True):
|
|
423
|
-
_ut.save_text(text, path, log = log)
|
|
424
843
|
|
|
425
|
-
def
|
|
426
|
-
|
|
844
|
+
def save_text(text, path, log=True):
|
|
845
|
+
_ut.save_text(text, path, log=log)
|
|
427
846
|
|
|
428
|
-
def write_data(data, path, delimiter = None, columns = None, log = True):
|
|
429
|
-
_ut.write_data(data, path, delimiter = delimiter, columns = columns, log = log)
|
|
430
847
|
|
|
431
|
-
def
|
|
848
|
+
def read_data(path, delimiter=None, columns=None, first_row=None, log=True):
|
|
849
|
+
return _ut.read_data(
|
|
850
|
+
path, delimiter=delimiter, columns=columns, first_row=first_row, log=log
|
|
851
|
+
)
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
def write_data(data, path, delimiter=None, columns=None, log=True):
|
|
855
|
+
_ut.write_data(data, path, delimiter=delimiter, columns=columns, log=log)
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
def download(url, path, log=True):
|
|
432
859
|
_ut.download(url, path, log)
|
|
433
860
|
|
|
434
|
-
def delete_file(path, log = True):
|
|
435
|
-
_ut.delete_file(path, log = log)
|
|
436
861
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
862
|
+
def delete_file(path, log=True):
|
|
863
|
+
_ut.delete_file(path, log=log)
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
test_data_url = _glob.test_data_url
|
|
867
|
+
test_bar_data_url = _glob.test_bar_data_url
|
|
868
|
+
test_image_url = _glob.test_image_url
|
|
869
|
+
test_gif_url = _glob.test_gif_url
|
|
870
|
+
test_video_url = _glob.test_video_url
|
|
871
|
+
test_youtube_url = _glob.test_youtube_url
|
|
443
872
|
|
|
444
873
|
##############################################
|
|
445
874
|
########## Other Functions ############
|
|
446
875
|
##############################################
|
|
447
876
|
|
|
448
|
-
|
|
449
|
-
|
|
877
|
+
|
|
878
|
+
def colorize(string, color=None, style=None, background=None, show=False):
|
|
879
|
+
return _ut.colorize(
|
|
880
|
+
string, color=color, style=style, background=background, show=show
|
|
881
|
+
)
|
|
882
|
+
|
|
450
883
|
|
|
451
884
|
def uncolorize(string):
|
|
452
885
|
return _ut.uncolorize(string)
|
|
453
886
|
|
|
887
|
+
|
|
454
888
|
def terminal_size():
|
|
455
889
|
return _ut.terminal_size()
|
|
456
890
|
|
|
891
|
+
|
|
457
892
|
ts = terminal_size
|
|
458
893
|
|
|
894
|
+
|
|
459
895
|
def terminal_width():
|
|
460
896
|
return _ut.terminal_width()
|
|
461
897
|
|
|
898
|
+
|
|
462
899
|
tw = terminal_width
|
|
463
900
|
|
|
901
|
+
|
|
464
902
|
def terminal_height():
|
|
465
903
|
return _ut.terminal_height()
|
|
466
904
|
|
|
905
|
+
|
|
467
906
|
th = terminal_height
|
|
468
907
|
|
|
469
|
-
def sin(periods = 2, length = 200, amplitude = 1, phase = 0, decay = 0):
|
|
470
|
-
return _ut.sin(periods = periods, length = length, amplitude = amplitude, phase = phase, decay = decay)
|
|
471
908
|
|
|
472
|
-
def
|
|
473
|
-
return _ut.
|
|
909
|
+
def sin(periods=2, length=200, amplitude=1, phase=0, decay=0):
|
|
910
|
+
return _ut.sin(
|
|
911
|
+
periods=periods, length=length, amplitude=amplitude, phase=phase, decay=decay
|
|
912
|
+
)
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
def square(periods=2, length=200, amplitude=1):
|
|
916
|
+
return _ut.square(periods=periods, length=length, amplitude=amplitude)
|
|
917
|
+
|
|
474
918
|
|
|
475
919
|
def transpose(data):
|
|
476
920
|
return _ut.transpose(data)
|
|
477
921
|
|
|
922
|
+
|
|
478
923
|
colors = _glob.colors
|
|
479
924
|
|
|
480
925
|
styles = _glob.styles
|
|
@@ -488,10 +933,10 @@ test = _glob.test
|
|
|
488
933
|
version = __version__
|
|
489
934
|
|
|
490
935
|
platform = _ut.platform
|
|
491
|
-
|
|
936
|
+
|
|
492
937
|
##############################################
|
|
493
938
|
############ Docstrings ###############
|
|
494
|
-
##############################################
|
|
939
|
+
##############################################
|
|
495
940
|
|
|
496
941
|
add(subplots)
|
|
497
942
|
add(subplot)
|
|
@@ -599,4 +1044,4 @@ add(colors)
|
|
|
599
1044
|
add(styles)
|
|
600
1045
|
add(markers)
|
|
601
1046
|
add(themes)
|
|
602
|
-
add(test)
|
|
1047
|
+
add(test)
|