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
plotext_plus/charts.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# /usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Plotext Modern Chart Classes - Clean Public API
|
|
6
|
+
==============================================
|
|
7
|
+
|
|
8
|
+
This module provides the modern, object-oriented chart classes for more
|
|
9
|
+
structured plotting workflows. These classes offer a cleaner, more intuitive
|
|
10
|
+
interface compared to the traditional function-based API.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
# Import all chart classes from the internal API module
|
|
14
|
+
from ._api import (
|
|
15
|
+
# Base classes
|
|
16
|
+
Chart, Legend, PlotextAPI, api,
|
|
17
|
+
|
|
18
|
+
# Specific chart types
|
|
19
|
+
ScatterChart, LineChart, BarChart, HistogramChart,
|
|
20
|
+
CandlestickChart, HeatmapChart, MatrixChart, StemChart,
|
|
21
|
+
|
|
22
|
+
# Convenience functions
|
|
23
|
+
create_chart, quick_scatter, quick_line, quick_bar,
|
|
24
|
+
|
|
25
|
+
# Banner and logging utilities
|
|
26
|
+
enable_banners, log_info, log_success, log_warning, log_error,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
# Base classes
|
|
31
|
+
'Chart', 'Legend', 'PlotextAPI', 'api',
|
|
32
|
+
|
|
33
|
+
# Chart types
|
|
34
|
+
'ScatterChart', 'LineChart', 'BarChart', 'HistogramChart',
|
|
35
|
+
'CandlestickChart', 'HeatmapChart', 'MatrixChart', 'StemChart',
|
|
36
|
+
|
|
37
|
+
# Convenience functions
|
|
38
|
+
'create_chart', 'quick_scatter', 'quick_line', 'quick_bar',
|
|
39
|
+
|
|
40
|
+
# Utilities
|
|
41
|
+
'enable_banners', 'log_info', 'log_success', 'log_warning', 'log_error',
|
|
42
|
+
]
|
plotext_plus/core.py
ADDED
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
# /usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
# This file contains all the main plotext functions available externally to the user
|
|
5
|
+
|
|
6
|
+
##############################################
|
|
7
|
+
########### Initialisation #############
|
|
8
|
+
##############################################
|
|
9
|
+
|
|
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
|
+
from time import sleep as _sleep
|
|
16
|
+
import plotext_plus._global as _glob
|
|
17
|
+
from plotext import __version__
|
|
18
|
+
import plotext_plus._utility as _ut
|
|
19
|
+
|
|
20
|
+
_figure = _glob.figure # the main figure at top level (defined in _global.py because it is useful also there)
|
|
21
|
+
|
|
22
|
+
##############################################
|
|
23
|
+
######### Subplots Functions ###########
|
|
24
|
+
##############################################
|
|
25
|
+
|
|
26
|
+
def subplots(rows = None, cols = None):
|
|
27
|
+
sub = _figure._active.subplots(rows, cols)
|
|
28
|
+
_figure.show() if _figure._interactive else None
|
|
29
|
+
return sub
|
|
30
|
+
|
|
31
|
+
def subplot(row = None, col = None):
|
|
32
|
+
sub = _figure.subplot(row, col)
|
|
33
|
+
_figure.show() if _figure._interactive else None
|
|
34
|
+
return sub
|
|
35
|
+
|
|
36
|
+
def main():
|
|
37
|
+
return _figure.main()
|
|
38
|
+
|
|
39
|
+
def active():
|
|
40
|
+
return _figure._active
|
|
41
|
+
|
|
42
|
+
##############################################
|
|
43
|
+
####### Outside Set Functions ##########
|
|
44
|
+
##############################################
|
|
45
|
+
|
|
46
|
+
def interactive(interactive = None):
|
|
47
|
+
_figure._set_interactive(interactive)
|
|
48
|
+
|
|
49
|
+
def plot_size(width = None, height = None):
|
|
50
|
+
size = _figure._active.plot_size(width, height)
|
|
51
|
+
_figure.show() if _figure._interactive else None
|
|
52
|
+
return size
|
|
53
|
+
plotsize = plot_size
|
|
54
|
+
|
|
55
|
+
def limit_size(width = None, height = None):
|
|
56
|
+
#_figure._master._set_size()
|
|
57
|
+
_figure._master._limit_size(width, height)
|
|
58
|
+
limitsize = limit_size
|
|
59
|
+
|
|
60
|
+
def take_min():
|
|
61
|
+
_figure._active.take_min()
|
|
62
|
+
takemin = take_min
|
|
63
|
+
|
|
64
|
+
def title(label):
|
|
65
|
+
_figure._active.title(label)
|
|
66
|
+
_figure.show() if _figure._interactive else None
|
|
67
|
+
|
|
68
|
+
def xlabel(label = None, xside = None):
|
|
69
|
+
_figure._active.xlabel(label = label, xside = xside)
|
|
70
|
+
_figure.show() if _figure._interactive else None
|
|
71
|
+
|
|
72
|
+
def ylabel(label = None, yside = None):
|
|
73
|
+
_figure._active.ylabel(label = label, yside = yside)
|
|
74
|
+
_figure.show() if _figure._interactive else None
|
|
75
|
+
|
|
76
|
+
def xlim(left = None, right = None, xside = None):
|
|
77
|
+
_figure._active.xlim(left = left, right = right, xside = xside)
|
|
78
|
+
_figure.show() if _figure._interactive else None
|
|
79
|
+
|
|
80
|
+
def ylim(lower = None, upper = None, yside = None):
|
|
81
|
+
_figure._active.ylim(lower = lower, upper = upper, yside = yside)
|
|
82
|
+
_figure.show() if _figure._interactive else None
|
|
83
|
+
|
|
84
|
+
def xscale(scale = None, xside = None):
|
|
85
|
+
_figure._active.xscale(scale = scale, xside = xside)
|
|
86
|
+
_figure.show() if _figure._interactive else None
|
|
87
|
+
|
|
88
|
+
def yscale(scale = None, yside = None):
|
|
89
|
+
_figure._active.yscale(scale = scale, yside = yside)
|
|
90
|
+
_figure.show() if _figure._interactive else None
|
|
91
|
+
|
|
92
|
+
def xticks(ticks = None, labels = None, xside = None):
|
|
93
|
+
_figure._active.xticks(ticks = ticks, labels = labels, xside = xside)
|
|
94
|
+
_figure.show() if _figure._interactive else None
|
|
95
|
+
|
|
96
|
+
def yticks(ticks = None, labels = None, yside = None):
|
|
97
|
+
_figure._active.yticks(ticks = ticks, labels = labels, yside = yside)
|
|
98
|
+
_figure.show() if _figure._interactive else None
|
|
99
|
+
|
|
100
|
+
def xfrequency(frequency = None, xside = None):
|
|
101
|
+
_figure._active.xfrequency(frequency = frequency, xside = xside)
|
|
102
|
+
_figure.show() if _figure._interactive else None
|
|
103
|
+
|
|
104
|
+
def yfrequency(frequency = None, yside = None):
|
|
105
|
+
_figure._active.yfrequency(frequency = frequency, yside = yside)
|
|
106
|
+
_figure.show() if _figure._interactive else None
|
|
107
|
+
|
|
108
|
+
def xreverse(reverse = None, xside = None):
|
|
109
|
+
_figure._active.xreverse(reverse = reverse, xside = xside)
|
|
110
|
+
_figure.show() if _figure._interactive else None
|
|
111
|
+
|
|
112
|
+
def yreverse(reverse = None, yside = None):
|
|
113
|
+
_figure._active.yreverse(reverse = reverse, yside = yside)
|
|
114
|
+
_figure.show() if _figure._interactive else None
|
|
115
|
+
|
|
116
|
+
def xaxes(lower = None, upper = None):
|
|
117
|
+
_figure._active.xaxes(lower = lower, upper = upper)
|
|
118
|
+
_figure.show() if _figure._interactive else None
|
|
119
|
+
|
|
120
|
+
def yaxes(left = None, right = None):
|
|
121
|
+
_figure._active.yaxes(left = left, right = right)
|
|
122
|
+
_figure.show() if _figure._interactive else None
|
|
123
|
+
|
|
124
|
+
def frame(frame = None):
|
|
125
|
+
_figure._active.frame(frame = frame)
|
|
126
|
+
_figure.show() if _figure._interactive else None
|
|
127
|
+
|
|
128
|
+
def grid(horizontal = None, vertical = None):
|
|
129
|
+
_figure._active.grid(horizontal = horizontal, vertical = vertical)
|
|
130
|
+
_figure.show() if _figure._interactive else None
|
|
131
|
+
|
|
132
|
+
def canvas_color(color = None):
|
|
133
|
+
_figure._active.canvas_color(color)
|
|
134
|
+
_figure.show() if _figure._interactive else None
|
|
135
|
+
|
|
136
|
+
def axes_color(color = None):
|
|
137
|
+
_figure._active.axes_color(color)
|
|
138
|
+
_figure.show() if _figure._interactive else None
|
|
139
|
+
|
|
140
|
+
def ticks_color(color = None):
|
|
141
|
+
_figure._active.ticks_color(color)
|
|
142
|
+
_figure.show() if _figure._interactive else None
|
|
143
|
+
|
|
144
|
+
def ticks_style(style = None):
|
|
145
|
+
_figure._active.ticks_style(style)
|
|
146
|
+
_figure.show() if _figure._interactive else None
|
|
147
|
+
|
|
148
|
+
def theme(theme = None):
|
|
149
|
+
_figure._active.theme(theme)
|
|
150
|
+
_figure.show() if _figure._interactive else None
|
|
151
|
+
|
|
152
|
+
##############################################
|
|
153
|
+
########### Clear Functions ############
|
|
154
|
+
##############################################
|
|
155
|
+
|
|
156
|
+
def clear_figure():
|
|
157
|
+
_figure._active.clear_figure()
|
|
158
|
+
_figure.show() if _figure._interactive else None
|
|
159
|
+
clf = clear_figure
|
|
160
|
+
|
|
161
|
+
def clear_data():
|
|
162
|
+
_figure._active.clear_data()
|
|
163
|
+
_figure.show() if _figure._interactive else None
|
|
164
|
+
cld = clear_data
|
|
165
|
+
|
|
166
|
+
def clear_color():
|
|
167
|
+
_figure._active.clear_color()
|
|
168
|
+
_figure.show() if _figure._interactive else None
|
|
169
|
+
clc = clear_color
|
|
170
|
+
|
|
171
|
+
def clear_terminal(lines = None):
|
|
172
|
+
_figure._active.clear_terminal(lines = lines)
|
|
173
|
+
clt = clear_terminal
|
|
174
|
+
|
|
175
|
+
##############################################
|
|
176
|
+
###### Main Plotting Functions #########
|
|
177
|
+
##############################################
|
|
178
|
+
|
|
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
|
+
|
|
183
|
+
def plot(*args, marker = None, color = None, style = None, fillx = None, filly = None, xside = None, yside = None, label = None):
|
|
184
|
+
_figure._active.plot(*args, xside = xside, yside = yside, marker = marker, color = color, fillx = fillx, filly = filly, label = label)
|
|
185
|
+
_figure.show() if _figure._interactive else None
|
|
186
|
+
|
|
187
|
+
def candlestick(dates, data, xside = None, yside = None, orientation = None, colors = None, label = None):
|
|
188
|
+
_figure._active.candlestick(dates, data, xside = xside, yside = yside, orientation = orientation, colors = colors, label = label)
|
|
189
|
+
_figure.show() if _figure._interactive else None
|
|
190
|
+
|
|
191
|
+
def bar(*args, marker = None, color = None, fill = None, width = None, orientation = None, minimum = None, reset_ticks = None, xside = None, yside = None, label = None):
|
|
192
|
+
_figure._active.bar(*args, xside = xside, yside = yside, marker = marker, color = color, fill = fill, width = width, orientation = orientation, label = label, minimum = minimum, reset_ticks = reset_ticks)
|
|
193
|
+
_figure.show() if _figure._interactive else None
|
|
194
|
+
|
|
195
|
+
def simple_bar(*args, marker = None, color = None, title = None, width = None):
|
|
196
|
+
_glob.simple_bar(*args, width = width, marker = marker, color = color, title = title)
|
|
197
|
+
_figure.show() if _figure._interactive else None
|
|
198
|
+
|
|
199
|
+
def multiple_bar(*args, marker = None, color = None, fill = None, width = None, orientation = None, minimum = None, reset_ticks = None, xside = None, yside = None, labels = None):
|
|
200
|
+
_figure._active.multiple_bar(*args, xside = xside, yside = yside, marker = marker, color = color, fill = fill, width = width, orientation = orientation, labels = labels, minimum = minimum, reset_ticks = reset_ticks)
|
|
201
|
+
_figure.show() if _figure._interactive else None
|
|
202
|
+
|
|
203
|
+
def simple_multiple_bar(*args, marker = None, colors = None, title = None, width = None, labels = None):
|
|
204
|
+
_glob.simple_multiple_bar(*args, width = width, marker = marker, colors = colors, title = title, labels = labels)
|
|
205
|
+
_figure.show() if _figure._interactive else None
|
|
206
|
+
|
|
207
|
+
def stacked_bar(*args, marker = None, color = None, fill = None, width = None, orientation = None, minimum = None, reset_ticks = None, xside = None, yside = None, labels = None):
|
|
208
|
+
_figure._active.stacked_bar(*args, xside = xside, yside = yside, marker = marker, color = color, fill = fill, width = width, orientation = orientation, labels = labels, minimum = minimum, reset_ticks = reset_ticks)
|
|
209
|
+
_figure.show() if _figure._interactive else None
|
|
210
|
+
|
|
211
|
+
def simple_stacked_bar(*args, marker = None, colors = None, title = None, width = None, labels = None):
|
|
212
|
+
_glob.simple_stacked_bar(*args, width = width, marker = marker, colors = colors, title = title, labels = labels)
|
|
213
|
+
_figure.show() if _figure._interactive else None
|
|
214
|
+
|
|
215
|
+
def hist(data, bins = None, marker = None, color = None, fill = None, norm = None, width = None, orientation = None, minimum = None, xside = None, yside = None, label = None):
|
|
216
|
+
_figure._active.hist(data, bins = bins, norm = norm, xside = xside, yside = yside, marker = marker, color = color, fill = fill, width = width, orientation = orientation, label = label, minimum = minimum)
|
|
217
|
+
_figure.show() if _figure._interactive else None
|
|
218
|
+
|
|
219
|
+
def candlestick(dates, data, colors = None, orientation = None, xside = None, yside = None, label = None):
|
|
220
|
+
_figure._active.candlestick(dates, data, xside = xside, yside = yside, orientation = orientation, colors = colors, label = label)
|
|
221
|
+
_figure.show() if _figure._interactive else None
|
|
222
|
+
|
|
223
|
+
def box(*args, quintuples = None, colors = None, fill = None, width = None, orientation = None, minimum = None, reset_ticks = None, xside = None, yside = None, label = None):
|
|
224
|
+
_figure._active.box(*args, xside = xside, yside = yside, orientation = orientation, colors = colors, label = label, fill=fill, width = width, minimum = minimum, reset_ticks = reset_ticks, quintuples = quintuples)
|
|
225
|
+
_figure.show() if _figure._interactive else None
|
|
226
|
+
|
|
227
|
+
##############################################
|
|
228
|
+
########### Plotting Tools #############
|
|
229
|
+
##############################################
|
|
230
|
+
|
|
231
|
+
def error(*args, xerr = None, yerr = None, color = None, xside = None, yside = None, label = None):
|
|
232
|
+
_figure.error(*args, xerr = xerr, yerr = yerr, xside = xside, yside = yside, color = color, label = label)
|
|
233
|
+
_figure.show() if _figure._interactive else None
|
|
234
|
+
|
|
235
|
+
def event_plot(data, marker = None, color = None, orientation = None, side = None):
|
|
236
|
+
_figure._active.event_plot(data, orientation = orientation, marker = marker, color = color, side = side)
|
|
237
|
+
_figure.show() if _figure._interactive else None
|
|
238
|
+
|
|
239
|
+
eventplot = event_plot
|
|
240
|
+
|
|
241
|
+
def vertical_line(coordinate, color = None, xside = None):
|
|
242
|
+
_figure._active.vertical_line(coordinate, color = color, xside = xside)
|
|
243
|
+
_figure.show() if _figure._interactive else None
|
|
244
|
+
vline = vertical_line
|
|
245
|
+
|
|
246
|
+
def horizontal_line(coordinate, color = None, yside = None):
|
|
247
|
+
_figure._active.horizontal_line(coordinate, color = color, yside = yside)
|
|
248
|
+
_figure.show() if _figure._interactive else None
|
|
249
|
+
hline = horizontal_line
|
|
250
|
+
|
|
251
|
+
def text(label, x, y, color = None, background = None, style = None, orientation = None, alignment = None, xside = None, yside = None):
|
|
252
|
+
_figure._active.text(label, x, y, xside = xside, yside = yside, color = color, background = background, style = style, orientation = orientation, alignment = alignment)
|
|
253
|
+
_figure.show() if _figure._interactive else None
|
|
254
|
+
|
|
255
|
+
def rectangle(x = None, y = None, marker = None, color = None, lines = None, fill = None, xside = None, yside = None, label = None):
|
|
256
|
+
_figure._active.rectangle(x = x, y = y, xside = xside, yside = yside, lines = lines, marker = marker, color = color, fill = fill, label = label)
|
|
257
|
+
_figure.show() if _figure._interactive else None
|
|
258
|
+
|
|
259
|
+
def polygon(x = None, y = None, radius = None, sides = None, marker = None, color = None, lines = None, fill = None, xside = None, yside = None, label = None):
|
|
260
|
+
_figure._active.polygon(x = x, y = y, radius = radius, sides = sides, xside = xside, yside = yside, lines = lines, marker = marker, color = color, fill = fill, label = label)
|
|
261
|
+
_figure.show() if _figure._interactive else None
|
|
262
|
+
|
|
263
|
+
def confusion_matrix(actual, predicted, color = None, style = None, labels = None):
|
|
264
|
+
_figure._active.confusion_matrix(actual, predicted, labels = labels, color = color, style = style)
|
|
265
|
+
_figure.show() if _figure._interactive else None
|
|
266
|
+
|
|
267
|
+
cmatrix = confusion_matrix
|
|
268
|
+
|
|
269
|
+
def indicator(value, label = None, color = None, style = None):
|
|
270
|
+
_figure._active.indicator(value, label = label, color = color, style = style)
|
|
271
|
+
_figure.show() if _figure._interactive else None
|
|
272
|
+
|
|
273
|
+
##############################################
|
|
274
|
+
############## 2D Plots ################
|
|
275
|
+
##############################################
|
|
276
|
+
|
|
277
|
+
def matrix_plot(matrix, marker = None, style = None, fast = False):
|
|
278
|
+
_figure._active.matrix_plot(matrix, marker = marker, style = style, fast = fast)
|
|
279
|
+
_figure.show() if _figure._interactive else None
|
|
280
|
+
|
|
281
|
+
def heatmap(dataframe, color = None, style=None):
|
|
282
|
+
_figure._active.heatmap(dataframe, color = color, style = style)
|
|
283
|
+
_figure.show() if _figure._interactive else None
|
|
284
|
+
|
|
285
|
+
def image_plot(path, marker = None, style = None, fast = False, grayscale = False):
|
|
286
|
+
_figure._active.image_plot(path, marker = marker, style = style, grayscale = grayscale, fast = fast)
|
|
287
|
+
_figure.show() if _figure._interactive else None
|
|
288
|
+
|
|
289
|
+
def play_gif(path):
|
|
290
|
+
_glob.play_gif(path)
|
|
291
|
+
_figure.show() if _figure._interactive else None
|
|
292
|
+
|
|
293
|
+
def play_video(path, from_youtube = False):
|
|
294
|
+
_glob.play_video(path, from_youtube)
|
|
295
|
+
_figure.show() if _figure._interactive else None
|
|
296
|
+
|
|
297
|
+
def play_youtube(url):
|
|
298
|
+
_glob.play_youtube(url)
|
|
299
|
+
_figure.show() if _figure._interactive else None
|
|
300
|
+
|
|
301
|
+
def get_youtube(url, path = None, log = True):
|
|
302
|
+
_glob.get_youtube(url, path, log)
|
|
303
|
+
|
|
304
|
+
##############################################
|
|
305
|
+
########## Build Functions #############
|
|
306
|
+
##############################################
|
|
307
|
+
|
|
308
|
+
def show():
|
|
309
|
+
_figure.show()
|
|
310
|
+
|
|
311
|
+
def build():
|
|
312
|
+
return _figure.build()
|
|
313
|
+
|
|
314
|
+
def sleep(time = 0):
|
|
315
|
+
_sleep(time)
|
|
316
|
+
|
|
317
|
+
def time(show = True):
|
|
318
|
+
return _figure._get_time(show)
|
|
319
|
+
|
|
320
|
+
def save_fig(path = None, append = False, keep_colors = False):
|
|
321
|
+
_figure.save_fig(path, append, keep_colors)
|
|
322
|
+
savefig = save_fig
|
|
323
|
+
|
|
324
|
+
def from_matplotlib(fig, marker = None):
|
|
325
|
+
_glob.from_matplotlib(fig, marker = marker)
|
|
326
|
+
|
|
327
|
+
##############################################
|
|
328
|
+
########## Output Functions ############
|
|
329
|
+
##############################################
|
|
330
|
+
|
|
331
|
+
def banner_mode(enabled = True, title = None):
|
|
332
|
+
"""Enable or disable banner mode for chart output using chuk-term"""
|
|
333
|
+
from plotext_plus._output import set_output_mode
|
|
334
|
+
set_output_mode(enabled, title)
|
|
335
|
+
|
|
336
|
+
def output_info(message):
|
|
337
|
+
"""Output info message using chuk-term styling"""
|
|
338
|
+
from plotext_plus._output import info
|
|
339
|
+
info(message)
|
|
340
|
+
|
|
341
|
+
def output_success(message):
|
|
342
|
+
"""Output success message using chuk-term styling"""
|
|
343
|
+
from plotext_plus._output import success
|
|
344
|
+
success(message)
|
|
345
|
+
|
|
346
|
+
def output_warning(message):
|
|
347
|
+
"""Output warning message using chuk-term styling"""
|
|
348
|
+
from plotext_plus._output import warning
|
|
349
|
+
warning(message)
|
|
350
|
+
|
|
351
|
+
def output_error(message):
|
|
352
|
+
"""Output error message using chuk-term styling"""
|
|
353
|
+
from plotext_plus._output import error
|
|
354
|
+
error(message)
|
|
355
|
+
|
|
356
|
+
##############################################
|
|
357
|
+
########## Date Functions #############
|
|
358
|
+
##############################################
|
|
359
|
+
|
|
360
|
+
def date_form(input_form = None, output_form = None):
|
|
361
|
+
_figure._active.date_form(input_form, output_form)
|
|
362
|
+
|
|
363
|
+
def set_time0(string, input_form = None):
|
|
364
|
+
_figure._active.set_time0(string, input_form = input_form)
|
|
365
|
+
|
|
366
|
+
def today_datetime():
|
|
367
|
+
return _figure._active.today_datetime()
|
|
368
|
+
|
|
369
|
+
def today_string(output_form = None):
|
|
370
|
+
return _figure._active.today_string(output_form)
|
|
371
|
+
|
|
372
|
+
def datetime_to_string(datetime, output_form = None):
|
|
373
|
+
return _figure._active.datetime_to_string(datetime, output_form = output_form)
|
|
374
|
+
|
|
375
|
+
def datetimes_to_strings(datetimes, output_form = None):
|
|
376
|
+
return _figure._active.datetimes_to_strings(datetimes, output_form = output_form)
|
|
377
|
+
|
|
378
|
+
datetimes_to_string = datetimes_to_strings
|
|
379
|
+
|
|
380
|
+
def string_to_datetime(string, input_form = None):
|
|
381
|
+
return _figure._active.string_to_datetime(string, input_form = input_form)
|
|
382
|
+
|
|
383
|
+
def string_to_time(string, input_form = None):##########ADD DOC############
|
|
384
|
+
return _figure._active.string_to_time(string, input_form = input_form)
|
|
385
|
+
|
|
386
|
+
def strings_to_time(string, input_form = None):##########ADD DOC############
|
|
387
|
+
return _figure._active.strings_to_time(string, input_form = input_form)
|
|
388
|
+
|
|
389
|
+
##############################################
|
|
390
|
+
########## File Functions ############
|
|
391
|
+
##############################################
|
|
392
|
+
|
|
393
|
+
script_folder = _ut.script_folder
|
|
394
|
+
|
|
395
|
+
def parent_folder(path, level = 1):
|
|
396
|
+
return _ut.parent_folder(path, level = level)
|
|
397
|
+
|
|
398
|
+
def join_paths(*args):
|
|
399
|
+
return _ut.join_paths(*args)
|
|
400
|
+
|
|
401
|
+
def save_text(text, path, log = True):
|
|
402
|
+
_ut.save_text(text, path, log = log)
|
|
403
|
+
|
|
404
|
+
def read_data(path, delimiter = None, columns = None, first_row = None, log = True):
|
|
405
|
+
return _ut.read_data(path, delimiter = delimiter, columns = columns, first_row = first_row, log = log)
|
|
406
|
+
|
|
407
|
+
def write_data(data, path, delimiter = None, columns = None, log = True):
|
|
408
|
+
_ut.write_data(data, path, delimiter = delimiter, columns = columns, log = log)
|
|
409
|
+
|
|
410
|
+
def download(url, path, log = True):
|
|
411
|
+
_ut.download(url, path, log)
|
|
412
|
+
|
|
413
|
+
def delete_file(path, log = True):
|
|
414
|
+
_ut.delete_file(path, log = log)
|
|
415
|
+
|
|
416
|
+
test_data_url = _glob.test_data_url
|
|
417
|
+
test_bar_data_url = _glob.test_bar_data_url
|
|
418
|
+
test_image_url = _glob.test_image_url
|
|
419
|
+
test_gif_url = _glob.test_gif_url
|
|
420
|
+
test_video_url = _glob.test_video_url
|
|
421
|
+
test_youtube_url = _glob.test_youtube_url
|
|
422
|
+
|
|
423
|
+
##############################################
|
|
424
|
+
########## Other Functions ############
|
|
425
|
+
##############################################
|
|
426
|
+
|
|
427
|
+
def colorize(string, color = None, style = None, background = None, show = False):
|
|
428
|
+
return _ut.colorize(string, color = color, style = style, background = background, show = show)
|
|
429
|
+
|
|
430
|
+
def uncolorize(string):
|
|
431
|
+
return _ut.uncolorize(string)
|
|
432
|
+
|
|
433
|
+
def terminal_size():
|
|
434
|
+
return _ut.terminal_size()
|
|
435
|
+
|
|
436
|
+
ts = terminal_size
|
|
437
|
+
|
|
438
|
+
def terminal_width():
|
|
439
|
+
return _ut.terminal_width()
|
|
440
|
+
|
|
441
|
+
tw = terminal_width
|
|
442
|
+
|
|
443
|
+
def terminal_height():
|
|
444
|
+
return _ut.terminal_height()
|
|
445
|
+
|
|
446
|
+
th = terminal_height
|
|
447
|
+
|
|
448
|
+
def sin(periods = 2, length = 200, amplitude = 1, phase = 0, decay = 0):
|
|
449
|
+
return _ut.sin(periods = periods, length = length, amplitude = amplitude, phase = phase, decay = decay)
|
|
450
|
+
|
|
451
|
+
def square(periods = 2, length = 200, amplitude = 1):
|
|
452
|
+
return _ut.square(periods = periods, length = length, amplitude = amplitude)
|
|
453
|
+
|
|
454
|
+
def transpose(data):
|
|
455
|
+
return _ut.transpose(data)
|
|
456
|
+
|
|
457
|
+
colors = _glob.colors
|
|
458
|
+
|
|
459
|
+
styles = _glob.styles
|
|
460
|
+
|
|
461
|
+
markers = _glob.markers
|
|
462
|
+
|
|
463
|
+
themes = _glob.themes
|
|
464
|
+
|
|
465
|
+
test = _glob.test
|
|
466
|
+
|
|
467
|
+
version = __version__
|
|
468
|
+
|
|
469
|
+
platform = _ut.platform
|
|
470
|
+
|
|
471
|
+
##############################################
|
|
472
|
+
############ Docstrings ###############
|
|
473
|
+
##############################################
|
|
474
|
+
|
|
475
|
+
add(subplots)
|
|
476
|
+
add(subplot)
|
|
477
|
+
add(main)
|
|
478
|
+
add(active)
|
|
479
|
+
|
|
480
|
+
add(interactive)
|
|
481
|
+
add(plot_size)
|
|
482
|
+
add(limit_size)
|
|
483
|
+
add(take_min)
|
|
484
|
+
|
|
485
|
+
add(title)
|
|
486
|
+
add(xlabel)
|
|
487
|
+
add(ylabel)
|
|
488
|
+
add(xlim)
|
|
489
|
+
add(ylim)
|
|
490
|
+
add(xscale)
|
|
491
|
+
add(yscale)
|
|
492
|
+
add(xticks)
|
|
493
|
+
add(yticks)
|
|
494
|
+
add(xfrequency)
|
|
495
|
+
add(yfrequency)
|
|
496
|
+
add(xreverse)
|
|
497
|
+
add(yreverse)
|
|
498
|
+
add(xaxes)
|
|
499
|
+
add(yaxes)
|
|
500
|
+
add(frame)
|
|
501
|
+
add(grid)
|
|
502
|
+
add(canvas_color)
|
|
503
|
+
add(axes_color)
|
|
504
|
+
add(ticks_color)
|
|
505
|
+
add(ticks_style)
|
|
506
|
+
add(theme)
|
|
507
|
+
|
|
508
|
+
add(clear_figure)
|
|
509
|
+
add(clear_data)
|
|
510
|
+
add(clear_color)
|
|
511
|
+
add(clear_terminal)
|
|
512
|
+
|
|
513
|
+
add(scatter)
|
|
514
|
+
add(plot)
|
|
515
|
+
add(candlestick)
|
|
516
|
+
add(bar)
|
|
517
|
+
add(simple_bar)
|
|
518
|
+
add(multiple_bar)
|
|
519
|
+
add(simple_multiple_bar)
|
|
520
|
+
add(stacked_bar)
|
|
521
|
+
add(simple_stacked_bar)
|
|
522
|
+
add(simple_bar)
|
|
523
|
+
add(hist)
|
|
524
|
+
add(box)
|
|
525
|
+
|
|
526
|
+
add(error)
|
|
527
|
+
add(event_plot)
|
|
528
|
+
add(vertical_line)
|
|
529
|
+
add(horizontal_line)
|
|
530
|
+
add(text)
|
|
531
|
+
add(rectangle)
|
|
532
|
+
add(polygon)
|
|
533
|
+
add(confusion_matrix)
|
|
534
|
+
add(indicator)
|
|
535
|
+
|
|
536
|
+
add(matrix_plot)
|
|
537
|
+
add(image_plot)
|
|
538
|
+
|
|
539
|
+
add(play_gif)
|
|
540
|
+
add(play_video)
|
|
541
|
+
add(play_youtube)
|
|
542
|
+
add(get_youtube)
|
|
543
|
+
|
|
544
|
+
add(show)
|
|
545
|
+
add(build)
|
|
546
|
+
add(sleep)
|
|
547
|
+
add(time)
|
|
548
|
+
add(save_fig)
|
|
549
|
+
add(from_matplotlib)
|
|
550
|
+
|
|
551
|
+
add(date_form)
|
|
552
|
+
add(set_time0)
|
|
553
|
+
add(today_datetime)
|
|
554
|
+
add(today_string)
|
|
555
|
+
add(datetime_to_string)
|
|
556
|
+
add(datetimes_to_strings)
|
|
557
|
+
add(string_to_datetime)
|
|
558
|
+
|
|
559
|
+
add(script_folder)
|
|
560
|
+
add(parent_folder)
|
|
561
|
+
add(join_paths)
|
|
562
|
+
add(save_text)
|
|
563
|
+
add(read_data)
|
|
564
|
+
add(write_data)
|
|
565
|
+
add(download)
|
|
566
|
+
add(delete_file)
|
|
567
|
+
|
|
568
|
+
add(colorize)
|
|
569
|
+
add(uncolorize)
|
|
570
|
+
add(terminal_size)
|
|
571
|
+
add(terminal_width)
|
|
572
|
+
add(terminal_height)
|
|
573
|
+
add(sin)
|
|
574
|
+
add(square)
|
|
575
|
+
add(transpose)
|
|
576
|
+
|
|
577
|
+
add(colors)
|
|
578
|
+
add(styles)
|
|
579
|
+
add(markers)
|
|
580
|
+
add(themes)
|
|
581
|
+
add(test)
|
plotext_plus/mcp_cli.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
Plotext Plus MCP Server CLI
|
|
6
|
+
==========================
|
|
7
|
+
|
|
8
|
+
Command-line interface for starting the Plotext Plus MCP server.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import sys
|
|
12
|
+
import argparse
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
"""Main entry point for the MCP server CLI."""
|
|
17
|
+
parser = argparse.ArgumentParser(
|
|
18
|
+
description="Plotext Plus MCP Server - Terminal plotting for AI clients"
|
|
19
|
+
)
|
|
20
|
+
parser.add_argument(
|
|
21
|
+
"--version",
|
|
22
|
+
action="version",
|
|
23
|
+
version="plotext_plus MCP server"
|
|
24
|
+
)
|
|
25
|
+
parser.add_argument(
|
|
26
|
+
"--info",
|
|
27
|
+
action="store_true",
|
|
28
|
+
help="Show MCP server information"
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
args = parser.parse_args()
|
|
32
|
+
|
|
33
|
+
if args.info:
|
|
34
|
+
print("Plotext Plus MCP Server")
|
|
35
|
+
print("======================")
|
|
36
|
+
print("Terminal plotting library with MCP (Model Context Protocol) support")
|
|
37
|
+
print("Exposes plotting, charting, theming, and utility functions as MCP tools")
|
|
38
|
+
print("")
|
|
39
|
+
print("Available tools:")
|
|
40
|
+
print("- scatter_plot: Create scatter plots")
|
|
41
|
+
print("- line_plot: Create line plots")
|
|
42
|
+
print("- bar_chart: Create bar charts")
|
|
43
|
+
print("- matrix_plot: Create matrix/heatmap plots")
|
|
44
|
+
print("- quick_scatter/line/bar: Quick chart creation")
|
|
45
|
+
print("- theme management tools")
|
|
46
|
+
print("- utility functions")
|
|
47
|
+
print("")
|
|
48
|
+
print("Available prompts:")
|
|
49
|
+
print("- basic_scatter: Simple scatter plot example")
|
|
50
|
+
print("- basic_bar_chart: Bar chart example")
|
|
51
|
+
print("- multi_step_workflow: Complex multi-step analysis")
|
|
52
|
+
print("- theme_exploration: Theme comparison examples")
|
|
53
|
+
print("- regional_sales_analysis: Interactive data analysis")
|
|
54
|
+
print("- performance_testing: Large dataset testing")
|
|
55
|
+
print("- error_handling_test: Edge case testing")
|
|
56
|
+
print("- complete_workflow: End-to-end visualization workflow")
|
|
57
|
+
print("- And 7 more prompts covering all use cases")
|
|
58
|
+
print("")
|
|
59
|
+
print("Available resources:")
|
|
60
|
+
print("- config://plotext: Server configuration and capabilities")
|
|
61
|
+
print("")
|
|
62
|
+
print("To start the server, run: plotext-mcp")
|
|
63
|
+
return
|
|
64
|
+
|
|
65
|
+
try:
|
|
66
|
+
from .mcp_server import start_server
|
|
67
|
+
start_server()
|
|
68
|
+
except ImportError as e:
|
|
69
|
+
if "chuk-mcp-server" in str(e):
|
|
70
|
+
print("ERROR: MCP functionality requires chuk-mcp-server")
|
|
71
|
+
print("Install it with: uv add --optional mcp plotext_plus")
|
|
72
|
+
print("Or: pip install 'plotext_plus[mcp]'")
|
|
73
|
+
sys.exit(1)
|
|
74
|
+
else:
|
|
75
|
+
raise
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
if __name__ == "__main__":
|
|
79
|
+
main()
|