plotext-plus 1.0.1__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 +31 -0
- plotext_plus/__main__.py +2 -0
- plotext_plus/_api.py +828 -0
- plotext_plus/_build.py +270 -0
- plotext_plus/_core.py +581 -0
- plotext_plus/_date.py +60 -0
- plotext_plus/_default.py +83 -0
- plotext_plus/_dict.py +210 -0
- plotext_plus/_doc.py +707 -0
- plotext_plus/_doc_utils.py +291 -0
- plotext_plus/_figure.py +488 -0
- plotext_plus/_global.py +370 -0
- plotext_plus/_matrix.py +171 -0
- plotext_plus/_monitor.py +848 -0
- plotext_plus/_output.py +136 -0
- plotext_plus/_shtab.py +9 -0
- plotext_plus/_themes.py +343 -0
- plotext_plus/_utility.py +853 -0
- plotext_plus/api.py +828 -0
- plotext_plus/charts.py +42 -0
- plotext_plus/core.py +581 -0
- plotext_plus/mcp_cli.py +79 -0
- plotext_plus/mcp_server.py +505 -0
- plotext_plus/plotext_cli.py +375 -0
- plotext_plus/plotting.py +92 -0
- plotext_plus/themes.py +29 -0
- plotext_plus/utilities.py +52 -0
- plotext_plus/utils.py +370 -0
- plotext_plus-1.0.1.dist-info/METADATA +303 -0
- plotext_plus-1.0.1.dist-info/RECORD +33 -0
- plotext_plus-1.0.1.dist-info/WHEEL +4 -0
- plotext_plus-1.0.1.dist-info/entry_points.txt +3 -0
- plotext_plus-1.0.1.dist-info/licenses/LICENSE +23 -0
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
from plotext_plus._utility import all_markers, colors
|
|
3
|
+
import argparse, sys, os
|
|
4
|
+
import plotext_plus as plt
|
|
5
|
+
try:
|
|
6
|
+
import shtab
|
|
7
|
+
except ImportError:
|
|
8
|
+
from . import _shtab as shtab
|
|
9
|
+
|
|
10
|
+
# For Possible Colors and Markers Completion
|
|
11
|
+
def dict_to_complete(d={}):
|
|
12
|
+
return {'zsh': '((' + ' '.join(map(lambda x: str(x[0]) + '\\:' + x[1], d.items())) + '))'}
|
|
13
|
+
|
|
14
|
+
def list_to_complete(data):
|
|
15
|
+
return {'zsh': '((' + ' '.join([el + '\\:' for el in data]) + '))'}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def build_parser():
|
|
19
|
+
|
|
20
|
+
examples = """Access each function documentation for further guidance, eg: plotext scatter -h"""
|
|
21
|
+
|
|
22
|
+
parser = argparse.ArgumentParser(
|
|
23
|
+
prog = "plotext",
|
|
24
|
+
description = "plotting directly on terminal",
|
|
25
|
+
epilog = examples,
|
|
26
|
+
formatter_class = argparse.RawDescriptionHelpFormatter)
|
|
27
|
+
shtab.add_argument_to(parser, ["-s", "--print-completion"])
|
|
28
|
+
|
|
29
|
+
parser.set_defaults(type = "scatter")
|
|
30
|
+
|
|
31
|
+
path_parser = argparse.ArgumentParser(add_help = False)
|
|
32
|
+
|
|
33
|
+
path_parser.add_argument("-p", "--path",
|
|
34
|
+
action = 'store',
|
|
35
|
+
#dest = 'path',
|
|
36
|
+
type = str,
|
|
37
|
+
metavar = "FILE",
|
|
38
|
+
help = "file path of the data table; if not used it will read from stdin. Use 'test' to automatically download, in your user folder, some test data/image/gif or video, depending on the function used; the file will be removed after the plot",
|
|
39
|
+
).complete = shtab.FILE
|
|
40
|
+
path_parser.add_argument("-r", "--first-row",
|
|
41
|
+
action = "store",
|
|
42
|
+
type = int,
|
|
43
|
+
default = 0,
|
|
44
|
+
metavar = "FIRST-ROW",
|
|
45
|
+
help = "The first line to consider in the data file (counting from 0).")
|
|
46
|
+
|
|
47
|
+
common_parser = argparse.ArgumentParser(add_help = False)
|
|
48
|
+
|
|
49
|
+
common_parser.add_argument("-clt", "--clear_terminal",
|
|
50
|
+
nargs = 1,
|
|
51
|
+
type = str,
|
|
52
|
+
default = ["False"],
|
|
53
|
+
choices = ["True", "False"],
|
|
54
|
+
metavar = "BOOL",
|
|
55
|
+
help = "it clears the terminal before plotting, if True (as by default)")
|
|
56
|
+
|
|
57
|
+
common_parser.add_argument("-s", "--sleep",
|
|
58
|
+
nargs = 1,
|
|
59
|
+
type = float,
|
|
60
|
+
default = [0],
|
|
61
|
+
help = "it adds a sleeping time after plotting, to reduce flickering when multiple plots are required; 0 by default")
|
|
62
|
+
|
|
63
|
+
data_parser = argparse.ArgumentParser(add_help = False)
|
|
64
|
+
|
|
65
|
+
data_parser.add_argument("-xcol", "--xcolumn",
|
|
66
|
+
nargs = "+", # 1 or more
|
|
67
|
+
type = str,
|
|
68
|
+
default = ["none"],
|
|
69
|
+
help = "the column number (starting from 1), in the data table, that will be used as x data; by default 'none'")
|
|
70
|
+
|
|
71
|
+
data_parser.add_argument("-ycols", "--ycolumns",
|
|
72
|
+
nargs = "+", # 1 or more
|
|
73
|
+
type = str,
|
|
74
|
+
default = ["all"],
|
|
75
|
+
help = "the column numbers (starting from 1), in the data table, that will be used as y data; by default 'all'")
|
|
76
|
+
|
|
77
|
+
data_parser.add_argument("-d", "--delimiter",
|
|
78
|
+
type = str,
|
|
79
|
+
default = [' '],
|
|
80
|
+
nargs = 1,
|
|
81
|
+
help = "character to be used to separate columns in the data table (eg: ;); by default the white space ' '")
|
|
82
|
+
|
|
83
|
+
data_parser.add_argument("-l", "--lines",
|
|
84
|
+
nargs = "+", # 1 or more
|
|
85
|
+
type = int,
|
|
86
|
+
default = [1000],
|
|
87
|
+
help = "number of lines, from data table, to be plotted at each iteration; 1000 by default; data shorter then this will be plotted in a single iteration")
|
|
88
|
+
|
|
89
|
+
options_parser = argparse.ArgumentParser(add_help = False)
|
|
90
|
+
|
|
91
|
+
options_parser.add_argument("-m", "--marker",
|
|
92
|
+
type = str,
|
|
93
|
+
default = ['hd'],
|
|
94
|
+
nargs = 1,
|
|
95
|
+
choices = all_markers.keys(),
|
|
96
|
+
metavar = "marker",
|
|
97
|
+
help = "character or marker code identifying the data points in the plot, eg: x, braille, sd, heart, fhd; by default hd",
|
|
98
|
+
).complete = dict_to_complete(all_markers)
|
|
99
|
+
|
|
100
|
+
options_parser.add_argument("-c", "--color",
|
|
101
|
+
type = str,
|
|
102
|
+
default = [None],
|
|
103
|
+
nargs = 1,
|
|
104
|
+
choices = colors,
|
|
105
|
+
metavar = "COLOR",
|
|
106
|
+
help = "color of the data points in the plot, between: " + ",".join(colors) + "; add + at the end of the color (except black and white) for clearer colors, eg: red+"
|
|
107
|
+
).complete = list_to_complete(colors)
|
|
108
|
+
|
|
109
|
+
options_parser.add_argument("-t", "--title",
|
|
110
|
+
nargs = 1,
|
|
111
|
+
type = str,
|
|
112
|
+
default = [None],
|
|
113
|
+
help = "the plot title")
|
|
114
|
+
|
|
115
|
+
options_parser.add_argument("-xl", "--xlabel",
|
|
116
|
+
nargs = 1,
|
|
117
|
+
type = str,
|
|
118
|
+
default = [None],
|
|
119
|
+
help = "the label of the x axis")
|
|
120
|
+
|
|
121
|
+
options_parser.add_argument("-yl", "--ylabel",
|
|
122
|
+
nargs = 1,
|
|
123
|
+
type = str,
|
|
124
|
+
default = [None],
|
|
125
|
+
help = "the label of the y axis")
|
|
126
|
+
|
|
127
|
+
options_parser.add_argument("-g", "--grid",
|
|
128
|
+
nargs = 1,
|
|
129
|
+
type = str,
|
|
130
|
+
default = ["False"],
|
|
131
|
+
choices = ["True", "False"],
|
|
132
|
+
metavar = "BOOL",
|
|
133
|
+
help = "it add grid lines if True, or removed them if False (as by default)")
|
|
134
|
+
|
|
135
|
+
barhist_parser = argparse.ArgumentParser(add_help = False)
|
|
136
|
+
|
|
137
|
+
barhist_parser.add_argument("-o", "--orientation",
|
|
138
|
+
nargs = 1,
|
|
139
|
+
type = str,
|
|
140
|
+
default = ['v'],
|
|
141
|
+
choices = ['v', 'h'],
|
|
142
|
+
metavar = "ORIENTATION",
|
|
143
|
+
help = "bar orientation, v for vertical (as by default), h for horizontal")
|
|
144
|
+
|
|
145
|
+
barhist_parser.add_argument("-f", "--fill",
|
|
146
|
+
nargs = 1,
|
|
147
|
+
type = str,
|
|
148
|
+
default = ["True"],
|
|
149
|
+
choices = ["True", "False"],
|
|
150
|
+
metavar = "BOOL",
|
|
151
|
+
help = "it fills the bars with colored markers if True (as by default), otherwise only the bars skeleton is shown")
|
|
152
|
+
|
|
153
|
+
subparser = parser.add_subparsers(dest = 'type',
|
|
154
|
+
help = 'the user defined plot type')
|
|
155
|
+
|
|
156
|
+
scatter = subparser.add_parser('scatter',
|
|
157
|
+
description = "plots a series of data points",
|
|
158
|
+
parents = [path_parser, data_parser, common_parser, options_parser],
|
|
159
|
+
help = 'plots a series of data points',
|
|
160
|
+
epilog = "eg: plotext scatter --path test --xcolumn 1 --ycolumns 2 --lines 5000 --title 'Scatter Plot Test' --marker braille")
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
plot = subparser.add_parser('plot',
|
|
164
|
+
parents = [path_parser, data_parser, common_parser, options_parser],
|
|
165
|
+
description = "plots lines between consecutive data points",
|
|
166
|
+
help = 'plots lines between consecutive data points',
|
|
167
|
+
epilog = "eg: plotext plot --path test --xcolumn 1 --ycolumns 2 --sleep 0.1 --lines 2500 --clear_terminal True --color magenta+ --title 'Plot Test'")
|
|
168
|
+
|
|
169
|
+
plotter = subparser.add_parser('plotter',
|
|
170
|
+
parents = [path_parser, data_parser, common_parser, options_parser],
|
|
171
|
+
description = 'plots a series of data points and the lines between consecutive ones',
|
|
172
|
+
help = 'scatter + plot',
|
|
173
|
+
epilog = "eg:plotext plotter --path test --xcolumn 1 --ycolumns 2 --sleep 0.1 --lines 120 --clear_terminal True --marker hd --title 'Plotter Test'")
|
|
174
|
+
|
|
175
|
+
bar = subparser.add_parser('bar',
|
|
176
|
+
parents = [path_parser, data_parser, common_parser, options_parser, barhist_parser],
|
|
177
|
+
description = 'builds a bar plot',
|
|
178
|
+
help = 'bar plot',
|
|
179
|
+
epilog = "eg: plotext bar --path test --xcolumn 1 --title 'Bar Plot Test' --xlabel Animals --ylabel Count")
|
|
180
|
+
|
|
181
|
+
bar.add_argument("-w", "--width",
|
|
182
|
+
nargs = 1,
|
|
183
|
+
type = float,
|
|
184
|
+
default = [None],
|
|
185
|
+
help = "bars width as a float between 0 and 1")
|
|
186
|
+
|
|
187
|
+
hist = subparser.add_parser('hist',
|
|
188
|
+
parents = [path_parser, data_parser, common_parser, options_parser, barhist_parser],
|
|
189
|
+
description = 'builds a histogram plot',
|
|
190
|
+
help = 'histogram plot',
|
|
191
|
+
epilog = "eg: plotext hist --path test --xcolumn 1 --ycolumns 2 --lines 5000 --title 'Histogram Test'")
|
|
192
|
+
|
|
193
|
+
hist.add_argument("-b", "--bins",
|
|
194
|
+
nargs = 1,
|
|
195
|
+
type = int,
|
|
196
|
+
default = [10],
|
|
197
|
+
help = "histogram bins (10 by default)")
|
|
198
|
+
|
|
199
|
+
image = subparser.add_parser('image',
|
|
200
|
+
parents = [path_parser, common_parser],
|
|
201
|
+
description = 'plots an image from path',
|
|
202
|
+
help = 'plots an image from file path',
|
|
203
|
+
epilog = "eg: plotext image --path test")
|
|
204
|
+
|
|
205
|
+
gif = subparser.add_parser('gif',
|
|
206
|
+
parents = [path_parser, common_parser],
|
|
207
|
+
description = 'plays a gif image from path',
|
|
208
|
+
help = 'plays a gif image from path',
|
|
209
|
+
epilog = "eg: plotext gif --path test")
|
|
210
|
+
|
|
211
|
+
video = subparser.add_parser('video',
|
|
212
|
+
parents = [path_parser, common_parser],
|
|
213
|
+
description = 'plays a video from path',
|
|
214
|
+
help = 'plays a video from path',
|
|
215
|
+
epilog = "eg: plotext video --path test --from_youtube True")
|
|
216
|
+
|
|
217
|
+
video.add_argument("-fy", "--from_youtube",
|
|
218
|
+
nargs = 1,
|
|
219
|
+
type = str,
|
|
220
|
+
default = ["False"],
|
|
221
|
+
choices = ["True", "False"],
|
|
222
|
+
metavar = "BOOL",
|
|
223
|
+
help = "set it to True to render the colors correctly for videos downloaded from youtube; default is False")
|
|
224
|
+
|
|
225
|
+
youtube = subparser.add_parser('youtube',
|
|
226
|
+
description = 'plays a youtube video from url',
|
|
227
|
+
help = 'plays a youtube video from url',
|
|
228
|
+
epilog = "eg: plotext youtube --url test")
|
|
229
|
+
|
|
230
|
+
youtube.add_argument("-u", "--url",
|
|
231
|
+
action = 'store',
|
|
232
|
+
dest = 'url',
|
|
233
|
+
nargs = 1,
|
|
234
|
+
type = str,
|
|
235
|
+
metavar = "URL",
|
|
236
|
+
help = "the url of a youtube video; use 'test' for a test video")
|
|
237
|
+
|
|
238
|
+
return parser
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def main(argv = None):
|
|
242
|
+
parser = build_parser()
|
|
243
|
+
args = parser.parse_args(argv)
|
|
244
|
+
|
|
245
|
+
type = args.type
|
|
246
|
+
first_row = 0
|
|
247
|
+
if type != "youtube":
|
|
248
|
+
path = args.path
|
|
249
|
+
first_row = args.first_row
|
|
250
|
+
clt = True if args.clear_terminal[-1] == 'True' else False
|
|
251
|
+
sleep = args.sleep[0]
|
|
252
|
+
|
|
253
|
+
def get_xY(data):
|
|
254
|
+
l = len(data)
|
|
255
|
+
xcol = args.xcolumn[0]
|
|
256
|
+
ycols = args.ycolumns
|
|
257
|
+
xcol = "none" if xcol == "none" else int(xcol) if int(xcol) - 1 in range(l) else "none"
|
|
258
|
+
all_ycols = [el for el in range(l) if el != xcol]
|
|
259
|
+
ycols = all_ycols if ycols == ["all"] else [int(el) for el in ycols if int(el) - 1 in range(l)]
|
|
260
|
+
x = list(range(1, len(data[0]) + 1)) if xcol == "none" else data[xcol - 1]
|
|
261
|
+
Y = [data[i - 1] for i in ycols]
|
|
262
|
+
return x, Y
|
|
263
|
+
|
|
264
|
+
def plot(x, Y):
|
|
265
|
+
for y in Y:
|
|
266
|
+
plt.plot(x, y, marker = marker, color = color) if type in ['plot', 'plotter'] else None
|
|
267
|
+
plt.scatter(x, y, marker = marker, color = None if type == 'plotter' else color) if type in ['scatter', 'plotter'] else None
|
|
268
|
+
plt.bar(x, y, marker = marker, color = color, width = width, orientation = orientation, fill = fill) if type == 'bar' else None
|
|
269
|
+
plt.hist(y, marker = marker, color = color, orientation = orientation, fill = fill, bins = bins) if type == 'hist' else None
|
|
270
|
+
plt.clt() if clt else None
|
|
271
|
+
plt.show()
|
|
272
|
+
plt.cld()
|
|
273
|
+
plt.sleep(sleep)
|
|
274
|
+
|
|
275
|
+
data_plot = ['scatter', 'plot', 'plotter', 'bar', 'hist']
|
|
276
|
+
test_path = 'test'
|
|
277
|
+
|
|
278
|
+
if type in data_plot:
|
|
279
|
+
lines = args.lines[0]
|
|
280
|
+
delimiter = args.delimiter[0]
|
|
281
|
+
title = args.title[0]
|
|
282
|
+
xlabel = args.xlabel[0]
|
|
283
|
+
ylabel = args.ylabel[0]
|
|
284
|
+
grid = True if args.grid[-1] == 'True' else False
|
|
285
|
+
|
|
286
|
+
orientation = args.orientation[0] if type in ['bar', 'hist'] else 'v'
|
|
287
|
+
fill = args.fill[0] == 'True' if type in ['bar', 'hist'] else False
|
|
288
|
+
width = args.width[0] if type == 'bar' else 0
|
|
289
|
+
bins = args.bins[0] if type in 'hist' else None
|
|
290
|
+
|
|
291
|
+
marker = args.marker[0]
|
|
292
|
+
color = args.color[0]
|
|
293
|
+
|
|
294
|
+
plt.title(title);
|
|
295
|
+
plt.xlabel(xlabel)
|
|
296
|
+
plt.ylabel(ylabel)
|
|
297
|
+
plt.grid(grid)
|
|
298
|
+
|
|
299
|
+
if path == test_path:
|
|
300
|
+
plt.plotsize(None, plt.th() - 3)
|
|
301
|
+
if type != "bar":
|
|
302
|
+
plt.download(plt.test_data_url, test_path, log = True)
|
|
303
|
+
else:
|
|
304
|
+
plt.download(plt.test_bar_data_url, test_path, log = True)
|
|
305
|
+
path = test_path
|
|
306
|
+
|
|
307
|
+
if path is None:
|
|
308
|
+
def plot_text(text):
|
|
309
|
+
data = plt._utility.read_lines(text, delimiter = delimiter)
|
|
310
|
+
data = plt.transpose(data)
|
|
311
|
+
x, Y = get_xY(data)
|
|
312
|
+
plot(x, Y)
|
|
313
|
+
|
|
314
|
+
for _ in range(first_row):
|
|
315
|
+
sys.stdin.readline()
|
|
316
|
+
text = []
|
|
317
|
+
i = 0
|
|
318
|
+
for line in iter(sys.stdin.readline, ''):
|
|
319
|
+
text.append(line)
|
|
320
|
+
i+=1;
|
|
321
|
+
if len(text) == lines:
|
|
322
|
+
plot_text(text)
|
|
323
|
+
text = []
|
|
324
|
+
if len(text) > 0: # this is when there is some residual data to be plotted, not lines long
|
|
325
|
+
plot_text(text)
|
|
326
|
+
text = []
|
|
327
|
+
|
|
328
|
+
else:
|
|
329
|
+
data = plt.read_data(path, delimiter = delimiter, first_row = first_row)
|
|
330
|
+
data = plt.transpose(data)
|
|
331
|
+
x, Y = get_xY(data)
|
|
332
|
+
chunks = len(x) // lines + (1 if len(x) % lines else 0)
|
|
333
|
+
for c in range(chunks):
|
|
334
|
+
xc = x[c * lines: (c + 1) * lines]
|
|
335
|
+
Yc = [y[c * lines: (c + 1) * lines] for y in Y]
|
|
336
|
+
plot(xc, Yc)
|
|
337
|
+
|
|
338
|
+
elif type == 'image':
|
|
339
|
+
if path == test_path:
|
|
340
|
+
plt.plotsize(None, plt.th() - 3)
|
|
341
|
+
plt.download(plt.test_image_url, test_path, log = True)
|
|
342
|
+
path = test_path
|
|
343
|
+
plt.image_plot(path, fast = True)
|
|
344
|
+
plt.clt() if clt else None
|
|
345
|
+
plt.show()
|
|
346
|
+
|
|
347
|
+
elif type == 'gif':
|
|
348
|
+
if path == test_path:
|
|
349
|
+
plt.plotsize(None, plt.th() - 3)
|
|
350
|
+
plt.download(plt.test_gif_url, test_path, log = True)
|
|
351
|
+
path = test_path
|
|
352
|
+
plt.play_gif(path)
|
|
353
|
+
|
|
354
|
+
elif type == 'video':
|
|
355
|
+
if path == test_path:
|
|
356
|
+
plt.plotsize(None, plt.th() - 3)
|
|
357
|
+
plt.download(plt.test_video_url, test_path, log = True)
|
|
358
|
+
path = test_path
|
|
359
|
+
from_youtube = True if args.from_youtube[-1] == 'True' else False
|
|
360
|
+
plt.play_video(path, from_youtube)
|
|
361
|
+
|
|
362
|
+
elif type == 'youtube':
|
|
363
|
+
url = args.url[-1]
|
|
364
|
+
url = plt.test_youtube_url if url == test_path else url
|
|
365
|
+
plt.play_youtube(url)
|
|
366
|
+
|
|
367
|
+
if os.path.isfile(test_path):
|
|
368
|
+
plt.delete_file(test_path, True)
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
if __name__ == "__main__":
|
|
372
|
+
sys.exit(main())
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
plotext_plus/plotting.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# /usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Plotext Core Plotting Functions - Clean Public API
|
|
6
|
+
=================================================
|
|
7
|
+
|
|
8
|
+
This module provides the main plotting functions that users interact with.
|
|
9
|
+
All the core plotting capabilities are exposed through clean, public interfaces.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
# Import all main plotting functions from the internal core module
|
|
13
|
+
from ._core import (
|
|
14
|
+
# Basic plotting functions
|
|
15
|
+
scatter, plot, bar,
|
|
16
|
+
matrix_plot, candlestick,
|
|
17
|
+
|
|
18
|
+
# Plot customization
|
|
19
|
+
title, xlabel, ylabel,
|
|
20
|
+
xlim, ylim,
|
|
21
|
+
xscale, yscale,
|
|
22
|
+
grid, frame,
|
|
23
|
+
|
|
24
|
+
# Colors and themes
|
|
25
|
+
theme, colorize,
|
|
26
|
+
|
|
27
|
+
# Layout and display
|
|
28
|
+
show, build, sleep,
|
|
29
|
+
clear_figure, clear_data, clear_terminal, clear_color,
|
|
30
|
+
clf, cld, clt, clc,
|
|
31
|
+
|
|
32
|
+
# Figure management
|
|
33
|
+
plotsize, limitsize,
|
|
34
|
+
subplots, subplot,
|
|
35
|
+
|
|
36
|
+
# Data utilities
|
|
37
|
+
save_fig,
|
|
38
|
+
|
|
39
|
+
# Interactive features
|
|
40
|
+
banner_mode,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# Import utilities that users might need
|
|
44
|
+
from ._utility import (
|
|
45
|
+
terminal_width, terminal_height,
|
|
46
|
+
colorize as color_text,
|
|
47
|
+
delete_file,
|
|
48
|
+
download as download_file,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
# Import global functions for media handling
|
|
52
|
+
from ._global import (
|
|
53
|
+
play_video,
|
|
54
|
+
play_gif,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Import core functions for media handling
|
|
58
|
+
from ._core import (
|
|
59
|
+
image_plot,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
__all__ = [
|
|
63
|
+
# Basic plotting
|
|
64
|
+
'scatter', 'plot', 'bar',
|
|
65
|
+
'matrix_plot', 'candlestick',
|
|
66
|
+
|
|
67
|
+
# Plot customization
|
|
68
|
+
'title', 'xlabel', 'ylabel',
|
|
69
|
+
'xlim', 'ylim',
|
|
70
|
+
'xscale', 'yscale',
|
|
71
|
+
'grid', 'frame',
|
|
72
|
+
|
|
73
|
+
# Colors and themes
|
|
74
|
+
'theme', 'colorize', 'color_text',
|
|
75
|
+
|
|
76
|
+
# Layout and display
|
|
77
|
+
'show', 'build', 'sleep',
|
|
78
|
+
'clear_figure', 'clear_data', 'clear_terminal', 'clear_color',
|
|
79
|
+
'clf', 'cld', 'clt', 'clc',
|
|
80
|
+
|
|
81
|
+
# Figure management
|
|
82
|
+
'plotsize', 'limitsize', 'subplots', 'subplot',
|
|
83
|
+
|
|
84
|
+
# Utilities
|
|
85
|
+
'save_fig',
|
|
86
|
+
'terminal_width', 'terminal_height',
|
|
87
|
+
'banner_mode',
|
|
88
|
+
|
|
89
|
+
# Media handling
|
|
90
|
+
'download_file', 'delete_file',
|
|
91
|
+
'image_plot', 'play_gif', 'play_video',
|
|
92
|
+
]
|
plotext_plus/themes.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# /usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Plotext Themes - Clean Public API
|
|
6
|
+
===============================
|
|
7
|
+
|
|
8
|
+
This module provides access to all available themes and theme-related functionality.
|
|
9
|
+
Users can easily access, apply, and customize themes for their plots.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
# Import theme functionality from internal modules
|
|
13
|
+
from ._themes import (
|
|
14
|
+
get_theme_info,
|
|
15
|
+
apply_chuk_theme_to_chart,
|
|
16
|
+
get_chuk_theme_for_banner_mode,
|
|
17
|
+
create_chuk_term_themes,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Import theme application from core
|
|
21
|
+
from ._core import theme as apply_theme
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
# Theme management
|
|
25
|
+
'get_theme_info', 'apply_theme',
|
|
26
|
+
'apply_chuk_theme_to_chart',
|
|
27
|
+
'get_chuk_theme_for_banner_mode',
|
|
28
|
+
'create_chuk_term_themes',
|
|
29
|
+
]
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# /usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Plotext Utilities - Clean Public API
|
|
6
|
+
===================================
|
|
7
|
+
|
|
8
|
+
This module provides utility functions for terminal operations, file handling,
|
|
9
|
+
and other helper functionality that users might need.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
# Import utility functions from internal modules
|
|
13
|
+
from ._utility import (
|
|
14
|
+
terminal_width,
|
|
15
|
+
colorize, no_color,
|
|
16
|
+
matrix_size,
|
|
17
|
+
delete_file,
|
|
18
|
+
download,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# Import global utilities - check what's actually available
|
|
22
|
+
from ._global import (
|
|
23
|
+
test_data_url, test_bar_data_url,
|
|
24
|
+
test_image_url, test_gif_url, test_video_url,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
# Import output utilities
|
|
28
|
+
from ._output import (
|
|
29
|
+
info as log_info,
|
|
30
|
+
success as log_success,
|
|
31
|
+
warning as log_warning,
|
|
32
|
+
error as log_error,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
__all__ = [
|
|
36
|
+
# Terminal utilities
|
|
37
|
+
'terminal_width',
|
|
38
|
+
'colorize', 'no_color',
|
|
39
|
+
|
|
40
|
+
# Matrix utilities
|
|
41
|
+
'matrix_size',
|
|
42
|
+
|
|
43
|
+
# File utilities
|
|
44
|
+
'delete_file', 'download',
|
|
45
|
+
|
|
46
|
+
# Test data URLs
|
|
47
|
+
'test_data_url', 'test_bar_data_url',
|
|
48
|
+
'test_image_url', 'test_gif_url', 'test_video_url',
|
|
49
|
+
|
|
50
|
+
# Logging utilities
|
|
51
|
+
'log_info', 'log_success', 'log_warning', 'log_error',
|
|
52
|
+
]
|