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/_date.py
CHANGED
|
@@ -1,60 +1,78 @@
|
|
|
1
|
+
from datetime import UTC # useful for dates before 1970 in windows
|
|
1
2
|
from datetime import datetime as dt
|
|
2
|
-
from datetime import timezone as tz # useful for dates before 1970 in windows
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
|
|
5
|
+
class DateClass:
|
|
6
|
+
|
|
6
7
|
def __init__(self):
|
|
7
8
|
self.date_form()
|
|
8
9
|
self.time0 = 0
|
|
9
|
-
self.set_time0(
|
|
10
|
+
self.set_time0("01/01/1900")
|
|
10
11
|
|
|
11
|
-
def date_form(
|
|
12
|
-
input_form =
|
|
12
|
+
def date_form(
|
|
13
|
+
self, input_form=None, output_form=None
|
|
14
|
+
): # it sets the datetime form used for functions that output date string and input date string
|
|
15
|
+
input_form = "d/m/Y" if input_form is None else input_form
|
|
13
16
|
output_form = input_form if output_form is None else output_form
|
|
14
17
|
self.input_form = self.correct_form(input_form)
|
|
15
18
|
self.output_form = self.correct_form(output_form)
|
|
16
|
-
|
|
17
|
-
def set_time0(
|
|
19
|
+
|
|
20
|
+
def set_time0(
|
|
21
|
+
self, string, input_form=None
|
|
22
|
+
): # the origin of time, useful for log scale not to hit the 0 timestamp
|
|
18
23
|
self.time0 = self.string_to_time(string, input_form, 0)
|
|
19
24
|
|
|
20
|
-
def today_datetime(self):
|
|
25
|
+
def today_datetime(self): # today in datetime form
|
|
21
26
|
return dt.today()
|
|
22
|
-
|
|
23
|
-
def today_string(self, output_form
|
|
27
|
+
|
|
28
|
+
def today_string(self, output_form=None): # today in string form
|
|
24
29
|
return self.datetime_to_string(self.today_datetime(), output_form)
|
|
25
|
-
|
|
26
|
-
def datetime_to_string(
|
|
27
|
-
|
|
30
|
+
|
|
31
|
+
def datetime_to_string(
|
|
32
|
+
self, datetime, output_form=None
|
|
33
|
+
): # from datetime form to string form
|
|
34
|
+
output_form = (
|
|
35
|
+
self.output_form if output_form is None else self.correct_form(output_form)
|
|
36
|
+
)
|
|
28
37
|
return datetime.strftime(output_form)
|
|
29
|
-
|
|
30
|
-
def datetimes_to_strings(
|
|
38
|
+
|
|
39
|
+
def datetimes_to_strings(
|
|
40
|
+
self, datetimes, output_form=None
|
|
41
|
+
): # from datetime form to string form
|
|
31
42
|
return [self.datetime_to_string(el, output_form) for el in datetimes]
|
|
32
43
|
|
|
33
|
-
def string_to_datetime(
|
|
34
|
-
|
|
44
|
+
def string_to_datetime(
|
|
45
|
+
self, string, input_form=None
|
|
46
|
+
): # from date and times in string form to standard datetime input_form
|
|
47
|
+
input_form = (
|
|
48
|
+
self.input_form if input_form is None else self.correct_form(input_form)
|
|
49
|
+
)
|
|
35
50
|
return dt.strptime(string, input_form)
|
|
36
51
|
|
|
37
|
-
##############################################
|
|
38
|
-
############ Utilities ################
|
|
39
|
-
##############################################
|
|
52
|
+
##############################################
|
|
53
|
+
############ Utilities ################
|
|
54
|
+
##############################################
|
|
40
55
|
|
|
41
56
|
def correct_form(self, date_form):
|
|
42
|
-
return
|
|
57
|
+
return "".join(["%" + el if el.isalpha() else el for el in date_form])
|
|
43
58
|
|
|
44
|
-
def string_to_time(self, string, input_form
|
|
45
|
-
input_form =
|
|
59
|
+
def string_to_time(self, string, input_form=None, time0=None):
|
|
60
|
+
input_form = (
|
|
61
|
+
self.input_form if input_form is None else self.correct_form(input_form)
|
|
62
|
+
)
|
|
46
63
|
time0 = self.time0 if time0 is None else time0
|
|
47
64
|
try:
|
|
48
|
-
return
|
|
49
|
-
|
|
50
|
-
|
|
65
|
+
return (
|
|
66
|
+
dt.strptime(string, input_form).replace(tzinfo=UTC).timestamp() - time0
|
|
67
|
+
)
|
|
68
|
+
except ValueError as e:
|
|
69
|
+
raise ValueError("Date Form should be: " + input_form) from e
|
|
51
70
|
|
|
52
|
-
def strings_to_time(self, strings, input_form
|
|
71
|
+
def strings_to_time(self, strings, input_form=None):
|
|
53
72
|
return [self.string_to_time(el, input_form) for el in strings]
|
|
54
73
|
|
|
55
|
-
def time_to_string(self, time, output_form
|
|
74
|
+
def time_to_string(self, time, output_form=None):
|
|
56
75
|
return self.datetime_to_string(dt.fromtimestamp(time + self.time0), output_form)
|
|
57
|
-
|
|
58
|
-
def times_to_string(self, times, input_form = None):
|
|
59
|
-
return [self.time_to_string(el, input_form) for el in times]
|
|
60
76
|
|
|
77
|
+
def times_to_string(self, times, input_form=None):
|
|
78
|
+
return [self.time_to_string(el, input_form) for el in times]
|
plotext_plus/_default.py
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
#from plotext_plus._utility import bar_marker
|
|
2
|
-
from plotext_plus._utility import no_color
|
|
1
|
+
# from plotext_plus._utility import bar_marker
|
|
2
|
+
from plotext_plus._utility import no_color
|
|
3
|
+
from plotext_plus._utility import plot_marker
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class DefaultFigureClass:
|
|
3
7
|
|
|
4
|
-
class default_figure_class():
|
|
5
|
-
|
|
6
8
|
def __init__(self):
|
|
7
9
|
self.set_limitsize()
|
|
8
10
|
self.set_size_term()
|
|
9
11
|
self.set_size_term_inf()
|
|
10
12
|
self.interactive = False
|
|
11
13
|
|
|
12
|
-
def set_limitsize(self, limit_width
|
|
14
|
+
def set_limitsize(self, limit_width=None, limit_height=None):
|
|
13
15
|
self.limit_width = True if limit_width is None else bool(limit_width)
|
|
14
16
|
self.limit_height = True if limit_height is None else bool(limit_height)
|
|
15
17
|
self.limit_size = [self.limit_width, self.limit_height]
|
|
16
18
|
|
|
17
|
-
def set_size_term(self, width
|
|
19
|
+
def set_size_term(self, width=None, height=None):
|
|
18
20
|
self.width_term = 211 * 2 // 3 if width is None else int(width)
|
|
19
21
|
self.height_term = 53 * 2 // 3 if height is None else int(height)
|
|
20
22
|
self.size_term = [self.width_term, self.height_term]
|
|
21
23
|
|
|
22
|
-
def set_size_term_inf(self, width
|
|
24
|
+
def set_size_term_inf(self, width=None, height=None):
|
|
23
25
|
m = 5
|
|
24
26
|
self.width_term_inf = m * self.width_term if width is None else int(width)
|
|
25
27
|
self.height_term_inf = m * self.height_term if height is None else int(height)
|
|
26
28
|
self.size_term_inf = [self.width_term, self.height_term]
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
class
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
class DefaultMonitorClass:
|
|
32
|
+
|
|
31
33
|
def __init__(self):
|
|
32
34
|
self.marker = plot_marker
|
|
33
35
|
self.color_init()
|
|
@@ -38,7 +40,7 @@ class default_monitor_class():
|
|
|
38
40
|
self.bar_init()
|
|
39
41
|
self.confusion_matrix_init()
|
|
40
42
|
|
|
41
|
-
def color_init(self):
|
|
43
|
+
def color_init(self): # Default Values for Color Set with Outside Functions
|
|
42
44
|
self.canvas_color = "white"
|
|
43
45
|
self.axes_color = "white"
|
|
44
46
|
self.ticks_color = "black"
|
|
@@ -47,37 +49,42 @@ class default_monitor_class():
|
|
|
47
49
|
def axes_init(self): # Default Values for Variables Set with Outside Functions
|
|
48
50
|
self.xaxes = [True, True]
|
|
49
51
|
self.yaxes = [True, True]
|
|
50
|
-
self.xfrequency = [5, 5]
|
|
51
|
-
self.yfrequency = [7, 7]
|
|
52
|
-
self.xdirection = [1, 1]
|
|
52
|
+
self.xfrequency = [5, 5] # lower and upper xaxes ticks frequency
|
|
53
|
+
self.yfrequency = [7, 7] # left and right yaxes ticks frequency
|
|
54
|
+
self.xdirection = [1, 1] # direction of x axes
|
|
53
55
|
self.ydirection = [1, 1]
|
|
54
|
-
self.xticks = [None, None]
|
|
56
|
+
self.xticks = [None, None] # xticks coordinates for both axes
|
|
55
57
|
self.yticks = [None, None]
|
|
56
58
|
|
|
57
59
|
def canvas_init(self):
|
|
58
|
-
self.xscale = ["linear", "log"]
|
|
60
|
+
self.xscale = ["linear", "log"] # the two possibilities, the first is default
|
|
59
61
|
self.yscale = ["linear", "log"]
|
|
60
62
|
self.grid = [False, False]
|
|
61
|
-
|
|
63
|
+
|
|
62
64
|
def text_init(self):
|
|
63
|
-
self.alignment = [
|
|
64
|
-
self.orientation = [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
self.alignment = ["left", "center", "right", "top", "bottom", "dynamic"]
|
|
66
|
+
self.orientation = [
|
|
67
|
+
"horizontal",
|
|
68
|
+
"vertical",
|
|
69
|
+
] # the two possible orientations, the first is the default: v = vertical, h = horizontal
|
|
70
|
+
|
|
71
|
+
def draw_init(
|
|
72
|
+
self,
|
|
73
|
+
): # Default Values for Variables Set with Draw internal Arguments
|
|
74
|
+
self.xside = ["lower", "upper"] # the two possibilities, the first is default
|
|
75
|
+
self.yside = ["left", "right"] # the two possibilities, the first is default
|
|
69
76
|
self.lines = False
|
|
70
77
|
self.fill = False
|
|
71
78
|
self.fill_internal = "internal"
|
|
72
|
-
#self.filly = False
|
|
79
|
+
# self.filly = False
|
|
73
80
|
self.label = None
|
|
74
81
|
|
|
75
82
|
def bar_init(self):
|
|
76
83
|
self.bar_marker = "sd"
|
|
77
|
-
self.bar_fill = True
|
|
78
|
-
self.bar_width = 4 / 5
|
|
84
|
+
self.bar_fill = True # bar plot filled or not
|
|
85
|
+
self.bar_width = 4 / 5 # bar width
|
|
79
86
|
self.hist_bins = 10
|
|
80
87
|
|
|
81
88
|
def confusion_matrix_init(self):
|
|
82
|
-
self.cmatrix_color =
|
|
83
|
-
self.cmatrix_style =
|
|
89
|
+
self.cmatrix_color = "orange+"
|
|
90
|
+
self.cmatrix_style = "bold"
|