plotext-plus 1.0.9__py3-none-any.whl → 1.0.11__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
plotext_plus/_doc.py CHANGED
@@ -1,121 +1,216 @@
1
1
  # this file contains all docstrings
2
2
 
3
- from ._doc_utils import method, doc, par, past, out, t
3
+ from ._doc_utils import doc
4
+ from ._doc_utils import method
5
+ from ._doc_utils import out
6
+ from ._doc_utils import par
7
+ from ._doc_utils import past
8
+ from ._doc_utils import t
4
9
 
5
10
  method("subplots")
6
- doc("It creates a matrix of subplots.\n\nNested subplots are allowed; for example: subplots(2, 2); subplot(1, 1); subplots(3, 4) - or directly subplots(2, 2).subplot(1, 1).subplots(3, 4) - creates a 2 by 2 matrix where the first subplot is a 3 by 4 matrix.")
11
+ doc(
12
+ "It creates a matrix of subplots.\n\nNested subplots are allowed; for example: subplots(2, 2); subplot(1, 1); subplots(3, 4) - or directly subplots(2, 2).subplot(1, 1).subplots(3, 4) - creates a 2 by 2 matrix where the first subplot is a 3 by 4 matrix."
13
+ )
7
14
  par("rows", "sets the number of rows relative to the matrix of subplots.", t.int, 1)
8
15
  par("cols", "sets the number of columns relative to the matrix of subplots.", t.int, 1)
9
- out('the figure object containing the matrix of subplots', t.fig)
16
+ out("the figure object containing the matrix of subplots", t.fig)
10
17
 
11
18
 
12
19
  method("subplot")
13
- doc("It sets (and returns) the active subplot in the matrix of subplots, such that further commands will refer to it.\n\nNote that most of the commands referring to the active subplot, could be alternatively passed directly to it. Eg: subplot(1, 3); plotsize(100, 30) becomes subplot(1, 3).plotsize(300, 30).")
14
- par("row", "sets the row relative to the active subplot in the matrix of subplots, from above and counting from 1.", t.int, 1)
15
- par("col", "sets the column relative to the active subplot in the matrix of subplots, from left and counting from 1.", t.int, 1)
16
- out('the selected figure object', t.fig)
20
+ doc(
21
+ "It sets (and returns) the active subplot in the matrix of subplots, such that further commands will refer to it.\n\nNote that most of the commands referring to the active subplot, could be alternatively passed directly to it. Eg: subplot(1, 3); plotsize(100, 30) becomes subplot(1, 3).plotsize(300, 30)."
22
+ )
23
+ par(
24
+ "row",
25
+ "sets the row relative to the active subplot in the matrix of subplots, from above and counting from 1.",
26
+ t.int,
27
+ 1,
28
+ )
29
+ par(
30
+ "col",
31
+ "sets the column relative to the active subplot in the matrix of subplots, from left and counting from 1.",
32
+ t.int,
33
+ 1,
34
+ )
35
+ out("the selected figure object", t.fig)
17
36
 
18
37
 
19
38
  method("main")
20
- doc("It returns the main figure (at the uppermost level in the matrix of subplots, if present), and sets the active figure to it. Any further commands will apply to the entire figure and to any of its subplots.")
21
- out('the main figure object', t.fig)
39
+ doc(
40
+ "It returns the main figure (at the uppermost level in the matrix of subplots, if present), and sets the active figure to it. Any further commands will apply to the entire figure and to any of its subplots."
41
+ )
42
+ out("the main figure object", t.fig)
22
43
 
23
44
 
24
45
  method("active")
25
46
  doc("It returns the active figure, which can be changed using the subplot() method.")
26
- out('the active figure object', t.fig)
47
+ out("the active figure object", t.fig)
27
48
 
28
49
 
29
50
  method("interactive")
30
- doc("It allows to plot dynamically without using the show() method. A new plot is shown automatically when any change is made to the plot. By default plots are not shown dynamically.")
31
- par("interactive", "is the Boolean required to make the plot dynamic.", 'bool', False)
51
+ doc(
52
+ "It allows to plot dynamically without using the show() method. A new plot is shown automatically when any change is made to the plot. By default plots are not shown dynamically."
53
+ )
54
+ par("interactive", "is the Boolean required to make the plot dynamic.", "bool", False)
32
55
 
33
56
 
34
57
  method("plot_size", "plotsize")
35
58
  doc("It sets the plot size of the active figure.\n\n")
36
- par("width", "sets the width of the active subplot (in unit of character width). If None the terminal width is used.", t.int, None)
37
- par("height", "sets the height of the active subplot (in unit of character height). If None the terminal height is used.", t.int, None)
38
- out('The plot width and height (in character units).', t.list_int(2))
59
+ par(
60
+ "width",
61
+ "sets the width of the active subplot (in unit of character width). If None the terminal width is used.",
62
+ t.int,
63
+ None,
64
+ )
65
+ par(
66
+ "height",
67
+ "sets the height of the active subplot (in unit of character height). If None the terminal height is used.",
68
+ t.int,
69
+ None,
70
+ )
71
+ out("The plot width and height (in character units).", t.list_int(2))
39
72
 
40
73
 
41
74
  method("limit_size", "limitsize"),
42
- doc("It sets, whatever or not, to limit the plot size to the terminal dimensions. To manually set the plot dimensions use the plot_size() method afterwards.\n\nThis method is only available to the main figure and not to its subplots, if present ")
43
- par("width", "sets whatever or not to limit the plot width to the terminal width.", t.bool, True)
44
- par("height", "sets whatever or not to limit the plot height to the terminal height.", t.bool, True)
75
+ doc(
76
+ "It sets, whatever or not, to limit the plot size to the terminal dimensions. To manually set the plot dimensions use the plot_size() method afterwards.\n\nThis method is only available to the main figure and not to its subplots, if present "
77
+ )
78
+ par(
79
+ "width",
80
+ "sets whatever or not to limit the plot width to the terminal width.",
81
+ t.bool,
82
+ True,
83
+ )
84
+ par(
85
+ "height",
86
+ "sets whatever or not to limit the plot height to the terminal height.",
87
+ t.bool,
88
+ True,
89
+ )
45
90
 
46
91
 
47
92
  method("take_min", "takemin")
48
- doc("In a matrix of subplots, the plot widths/heights will be set to the same value for each column/row.\n\nBy default the maximum value is considered, but if the take_min() method is called, the minimum is considered instead.\n\nThis method is available to the main figure, as well any of its subplot independently.")
93
+ doc(
94
+ "In a matrix of subplots, the plot widths/heights will be set to the same value for each column/row.\n\nBy default the maximum value is considered, but if the take_min() method is called, the minimum is considered instead.\n\nThis method is available to the main figure, as well any of its subplot independently."
95
+ )
49
96
 
50
97
 
51
98
  method("title")
52
99
  doc("It sets the title of the active plot.")
53
- par("label", "the string label required", t.str)
54
-
100
+ par("label", "the string label required", t.str)
55
101
 
56
102
 
57
103
  method("xlabel")
58
104
  doc("It sets the label relative to the x axis.")
59
105
  past("label", "title")
60
- par("xside", "it allows to independently address either the 'lower' or 'upper' x axis (1 or 2 in short).", t.str_int, 'lower')
106
+ par(
107
+ "xside",
108
+ "it allows to independently address either the 'lower' or 'upper' x axis (1 or 2 in short).",
109
+ t.str_int,
110
+ "lower",
111
+ )
61
112
 
62
113
 
63
114
  method("ylabel")
64
115
  doc("It sets the label of the y axis.")
65
116
  past("label", "xlabel")
66
- par("yside", "it allows to independently address either the 'left' or 'right' y axis (1 or 2 in short).", t.str_int, 'left')
117
+ par(
118
+ "yside",
119
+ "it allows to independently address either the 'left' or 'right' y axis (1 or 2 in short).",
120
+ t.str_int,
121
+ "left",
122
+ )
67
123
 
68
124
 
69
- lim_message = ' If \'None\', the limit is calculated automatically.'
125
+ lim_message = " If 'None', the limit is calculated automatically."
70
126
 
71
127
  method("xlim")
72
- doc("It sets the numerical limits relative to the x axis. Values outside this range will not be plotted.")
73
- par("left", "it sets the left (or minimum) plot limit relative to the x axis. A date in string form is accepted." + lim_message, t.str_num, None)
74
- par("right", "it sets the right (or maximum) plot limit relative to the x axis. A date in string form is accepted." + lim_message, t.str_num, None)
128
+ doc(
129
+ "It sets the numerical limits relative to the x axis. Values outside this range will not be plotted."
130
+ )
131
+ par(
132
+ "left",
133
+ "it sets the left (or minimum) plot limit relative to the x axis. A date in string form is accepted."
134
+ + lim_message,
135
+ t.str_num,
136
+ None,
137
+ )
138
+ par(
139
+ "right",
140
+ "it sets the right (or maximum) plot limit relative to the x axis. A date in string form is accepted."
141
+ + lim_message,
142
+ t.str_num,
143
+ None,
144
+ )
75
145
  past("xside", "xlabel")
76
146
 
77
147
 
78
148
  method("ylim")
79
- doc("It sets the limits relative to the y axis. Values outside this range will not be plotted.")
80
- par("lower", "it sets the lower (or minimum) plot limit relative the y axis. A date in string form is accepted." + lim_message, t.str_num, None)
81
- par("upper", "it sets the upper (or maximum) plot limit relative the y axis. A date in string form is accepted." + lim_message, t.str_num, None)
149
+ doc(
150
+ "It sets the limits relative to the y axis. Values outside this range will not be plotted."
151
+ )
152
+ par(
153
+ "lower",
154
+ "it sets the lower (or minimum) plot limit relative the y axis. A date in string form is accepted."
155
+ + lim_message,
156
+ t.str_num,
157
+ None,
158
+ )
159
+ par(
160
+ "upper",
161
+ "it sets the upper (or maximum) plot limit relative the y axis. A date in string form is accepted."
162
+ + lim_message,
163
+ t.str_num,
164
+ None,
165
+ )
82
166
  past("yside", "ylabel")
83
167
 
84
168
 
85
- method("xscale")
169
+ method("xscale")
86
170
  doc("It sets the scale (linear or base 10 logarithmic) relative to the x axis.")
87
- par("scale", "the axis scale, either 'linear' or 'log'.", t.str, 'linear')
171
+ par("scale", "the axis scale, either 'linear' or 'log'.", t.str, "linear")
88
172
  past("xside", "xlim")
89
173
 
90
174
 
91
- method("yscale")
175
+ method("yscale")
92
176
  doc("It sets the scale (linear or base 10 logarithmic) relative to the y axis.")
93
177
  past("scale", "xscale")
94
178
  past("yside", "ylim")
95
179
 
96
-
97
- method("xticks")
98
- doc("It sets the numerical data ticks and string labels relative to the x axis.")
99
- par("ticks", "the list of numerical data ticks. Dates in string form are accepted.", t.list_str_num())
100
- par("labels", "the optional list of ticks labels to be printed at the ticks coordinates given.", t.list_str_num())
101
- past("xside", "xlim")
102
180
 
181
+ method("xticks")
182
+ doc("It sets the numerical data ticks and string labels relative to the x axis.")
183
+ par(
184
+ "ticks",
185
+ "the list of numerical data ticks. Dates in string form are accepted.",
186
+ t.list_str_num(),
187
+ )
188
+ par(
189
+ "labels",
190
+ "the optional list of ticks labels to be printed at the ticks coordinates given.",
191
+ t.list_str_num(),
192
+ )
193
+ past("xside", "xlim")
103
194
 
104
195
 
105
- method("yticks")
196
+ method("yticks")
106
197
  doc("It sets the numerical data ticks and string labels relative to the y axis.")
107
198
  past("ticks", "xticks")
108
199
  past("labels", "xticks")
109
- past("yside", "ylim")
200
+ past("yside", "ylim")
110
201
 
111
202
 
112
- method("xfrequency")
113
- doc("It sets the number of numerical ticks relative to the x axis. The actual numerical values are calculated automatically.\n\nTo set the ticks manually use the xticks() method instead. Note that xticks() overrules xfrequency().")
203
+ method("xfrequency")
204
+ doc(
205
+ "It sets the number of numerical ticks relative to the x axis. The actual numerical values are calculated automatically.\n\nTo set the ticks manually use the xticks() method instead. Note that xticks() overrules xfrequency()."
206
+ )
114
207
  par("frequency", "the integer number of numerical ticks.", t.int, 5)
115
208
  past("xside", "xlim")
116
209
 
117
- method("yfrequency")
118
- doc("It sets the number of numerical ticks relative to the y axis. The actual numerical values are calculated automatically.\n\nTo set the ticks manually use the yticks() method instead. Note that yticks() overrules yfrequency().")
210
+ method("yfrequency")
211
+ doc(
212
+ "It sets the number of numerical ticks relative to the y axis. The actual numerical values are calculated automatically.\n\nTo set the ticks manually use the yticks() method instead. Note that yticks() overrules yfrequency()."
213
+ )
119
214
  par("frequency", "the integer number of numerical ticks.", t.int, 7)
120
215
  past("yside", "ylim")
121
216
 
@@ -129,55 +224,85 @@ past("xside", "xlim")
129
224
  method("yreverse")
130
225
  doc("It reverses the y axis direction.")
131
226
  past("reverse", "xreverse")
132
- past("yside", "ylim")
227
+ past("yside", "ylim")
133
228
 
134
229
 
135
- method("xaxes")
230
+ method("xaxes")
136
231
  doc("It is used to show or remove the x axes independently.")
137
232
  par("lower", "the Boolean required to show or not the lower x axis.", t.bool, True)
138
- par("upper", "the Boolean required to show or not the upper x axis.", t.bool, True)
233
+ par("upper", "the Boolean required to show or not the upper x axis.", t.bool, True)
139
234
 
140
235
 
141
- method("yaxes")
236
+ method("yaxes")
142
237
  doc("It is used to show or remove the y axes independently.")
143
- par("left", "the Boolean required to show or not the left y axis.", t.bool)
238
+ par("left", "the Boolean required to show or not the left y axis.", t.bool)
144
239
  par("right", "the Boolean required to show or not the right y axis.", t.bool)
145
240
 
146
241
 
147
- method("frame")
148
- doc("It is used to show or remove all 4 axes (which constitute the canvas frame) at the same time.\n\nTo address any individual axis use the xaxes() and yaxes() methods instead.")
149
- par("frame", "the Boolean required to show or not all plot axes.", t.bool, True)
242
+ method("frame")
243
+ doc(
244
+ "It is used to show or remove all 4 axes (which constitute the canvas frame) at the same time.\n\nTo address any individual axis use the xaxes() and yaxes() methods instead."
245
+ )
246
+ par("frame", "the Boolean required to show or not all plot axes.", t.bool, True)
150
247
 
151
248
 
152
- method("grid")
249
+ method("grid")
153
250
  doc("It is used to show or remove the plot grid lines.")
154
- par("horizontal", "the Boolean required to show the horizontal grid lines.", t.bool, False)
155
- par("vertical", "the Boolean required to show the vertical grid lines.", t.bool, False)
156
-
157
-
158
- method("canvas_color")
159
- doc("It sets the background color relative to the plot canvas, which is the area where the data points are plotted.")
160
- par("color", "the color code: access the colors() method for the available codes.", t.color, 'white')
161
-
162
-
163
- method("axes_color")
164
- doc("It sets the background color relative to the axes, which is the area where the axes are plotted, and include the axes numerical ticks, the axes labels and the plot title (but not the plot legend, which is set automatically using the canvas_color() method).")
251
+ par(
252
+ "horizontal",
253
+ "the Boolean required to show the horizontal grid lines.",
254
+ t.bool,
255
+ False,
256
+ )
257
+ par("vertical", "the Boolean required to show the vertical grid lines.", t.bool, False)
258
+
259
+
260
+ method("canvas_color")
261
+ doc(
262
+ "It sets the background color relative to the plot canvas, which is the area where the data points are plotted."
263
+ )
264
+ par(
265
+ "color",
266
+ "the color code: access the colors() method for the available codes.",
267
+ t.color,
268
+ "white",
269
+ )
270
+
271
+
272
+ method("axes_color")
273
+ doc(
274
+ "It sets the background color relative to the axes, which is the area where the axes are plotted, and include the axes numerical ticks, the axes labels and the plot title (but not the plot legend, which is set automatically using the canvas_color() method)."
275
+ )
165
276
  past("color", "canvas_color")
166
277
 
167
278
 
168
- method("ticks_color")
169
- doc("It sets the color relative to any writing on the plot: the axes, its numerical ticks and labels, the plot title and the plot legend.")
170
- past("color", "canvas_color", 'black')
279
+ method("ticks_color")
280
+ doc(
281
+ "It sets the color relative to any writing on the plot: the axes, its numerical ticks and labels, the plot title and the plot legend."
282
+ )
283
+ past("color", "canvas_color", "black")
171
284
 
172
285
 
173
- method("ticks_style")
174
- doc("It sets the style relative to any writing on the plot: the axes, its numerical ticks and labels, the plot title and the plot legend.")
175
- par("style", "the style code: access the styles() method for the available style codes.", t.str, 'default')
286
+ method("ticks_style")
287
+ doc(
288
+ "It sets the style relative to any writing on the plot: the axes, its numerical ticks and labels, the plot title and the plot legend."
289
+ )
290
+ par(
291
+ "style",
292
+ "the style code: access the styles() method for the available style codes.",
293
+ t.str,
294
+ "default",
295
+ )
176
296
 
177
297
 
178
- method("theme")
298
+ method("theme")
179
299
  doc("It sets the color theme relative to the active plot.")
180
- par("theme", "the string theme code: access the themes() method for the available theme codes.", t.str, 'default')
300
+ par(
301
+ "theme",
302
+ "the string theme code: access the themes() method for the available theme codes.",
303
+ t.str,
304
+ "default",
305
+ )
181
306
 
182
307
 
183
308
  method("clear_figure", "clf")
@@ -185,32 +310,81 @@ doc("It clears everything relative to the addressed figure, including its subplo
185
310
 
186
311
 
187
312
  method("clear_data", "cld")
188
- doc("It clears only the data, previously plotted, relative to the addressed figure, including its subplots, without clearing any other plot settings.")
313
+ doc(
314
+ "It clears only the data, previously plotted, relative to the addressed figure, including its subplots, without clearing any other plot settings."
315
+ )
189
316
 
190
317
  method("clear_color", "clc")
191
- doc("It clears only the color settings relative to the addressed figure, including its subplots, without clearing any other plot settings. The final rendering of this subplot will be colorless.")
192
-
193
-
194
- method("clear_terminal", "clt")
195
- doc("It clears the terminal screen and it is generally useful when plotting a continuous stream of data.\n\nNote that depending on the terminal shell used, few extra lines may be printed after the plot.")
196
- par("lines", "the optional number of terminal lines to be cleared. If None, the entire terminal will be cleared.", t.int, None)
197
-
198
-
199
- method("scatter")
200
- doc("It creates a scatter plot of coordinates given by the x and y lists provided.\n\nMultiple data sets can be plotted using consecutive plotting functions.")
201
- par("args", "The coordinates x and y (or just y) of the data points to be plotted; string dates are accepted.", t.xy)
202
- par("marker", "the marker used to identify the data points, which could be a single character or the available marker codes, accessible with the markers() method; a list of markers, one for each data point, could also be provided.", t.marker, 'hd')
203
- par("color", "the color code of the data points, accessible with the colors() method; a list of colors, one for each data point, could also be provided.", t.color_list, 'blue+')
204
- par("style", "the style of the data points, accessible with the styles() method; a list of styles, one for each data point, could also be provided.", t.marker, 'default')
205
- par("fillx", "if True, for each data point, a vertical line ending on the x axis (the level y = 0) will be printed; if a specific numerical value is provided, the line will stop at that y coordinate; if the string code 'internal' is provided, the line will stop when another data point is reached (if it exists); if False, no line will be printed.", t.bool_num_str, False)
206
- par("filly", "if True, for each data point, an horizontal line ending on the y axis (the level x = 0) will be printed; if a specific numerical value is provided, the line will stop at that x coordinate; if the string code 'internal' is provided, the line will stop when another data point is reached (if it exists); if False, no line will be printed.", t.bool_num_str, False)
318
+ doc(
319
+ "It clears only the color settings relative to the addressed figure, including its subplots, without clearing any other plot settings. The final rendering of this subplot will be colorless."
320
+ )
321
+
322
+
323
+ method("clear_terminal", "clt")
324
+ doc(
325
+ "It clears the terminal screen and it is generally useful when plotting a continuous stream of data.\n\nNote that depending on the terminal shell used, few extra lines may be printed after the plot."
326
+ )
327
+ par(
328
+ "lines",
329
+ "the optional number of terminal lines to be cleared. If None, the entire terminal will be cleared.",
330
+ t.int,
331
+ None,
332
+ )
333
+
334
+
335
+ method("scatter")
336
+ doc(
337
+ "It creates a scatter plot of coordinates given by the x and y lists provided.\n\nMultiple data sets can be plotted using consecutive plotting functions."
338
+ )
339
+ par(
340
+ "args",
341
+ "The coordinates x and y (or just y) of the data points to be plotted; string dates are accepted.",
342
+ t.xy,
343
+ )
344
+ par(
345
+ "marker",
346
+ "the marker used to identify the data points, which could be a single character or the available marker codes, accessible with the markers() method; a list of markers, one for each data point, could also be provided.",
347
+ t.marker,
348
+ "hd",
349
+ )
350
+ par(
351
+ "color",
352
+ "the color code of the data points, accessible with the colors() method; a list of colors, one for each data point, could also be provided.",
353
+ t.color_list,
354
+ "blue+",
355
+ )
356
+ par(
357
+ "style",
358
+ "the style of the data points, accessible with the styles() method; a list of styles, one for each data point, could also be provided.",
359
+ t.marker,
360
+ "default",
361
+ )
362
+ par(
363
+ "fillx",
364
+ "if True, for each data point, a vertical line ending on the x axis (the level y = 0) will be printed; if a specific numerical value is provided, the line will stop at that y coordinate; if the string code 'internal' is provided, the line will stop when another data point is reached (if it exists); if False, no line will be printed.",
365
+ t.bool_num_str,
366
+ False,
367
+ )
368
+ par(
369
+ "filly",
370
+ "if True, for each data point, an horizontal line ending on the y axis (the level x = 0) will be printed; if a specific numerical value is provided, the line will stop at that x coordinate; if the string code 'internal' is provided, the line will stop when another data point is reached (if it exists); if False, no line will be printed.",
371
+ t.bool_num_str,
372
+ False,
373
+ )
207
374
  past("xside", "xlim")
208
375
  past("yside", "ylim")
209
- par("label", "the label of the current data set, which will appear in the legend menu at the top left corner of the plot canvas. If None, no label is added.", t.str, None)
210
-
211
-
212
- method("plot")
213
- doc("It creates a plot of lines between consecutive data points using the coordinates given by the x and y lists. \n\nMultiple data sets can be plotted using consecutive plotting functions.")
376
+ par(
377
+ "label",
378
+ "the label of the current data set, which will appear in the legend menu at the top left corner of the plot canvas. If None, no label is added.",
379
+ t.str,
380
+ None,
381
+ )
382
+
383
+
384
+ method("plot")
385
+ doc(
386
+ "It creates a plot of lines between consecutive data points using the coordinates given by the x and y lists. \n\nMultiple data sets can be plotted using consecutive plotting functions."
387
+ )
214
388
  past("args", "scatter")
215
389
  past("marker", "scatter")
216
390
  past("color", "scatter")
@@ -221,47 +395,117 @@ past("xside", "scatter")
221
395
  past("yside", "scatter")
222
396
  past("label", "scatter")
223
397
 
224
-
225
- method("candlestick")
398
+
399
+ method("candlestick")
226
400
  doc("It creates a candlestick plot.")
227
- par("dates", "the list of strings, each representing a date time object; use the date_form() method to set the accepted date/time forms.", t.list_str())
401
+ par(
402
+ "dates",
403
+ "the list of strings, each representing a date time object; use the date_form() method to set the accepted date/time forms.",
404
+ t.list_str(),
405
+ )
228
406
  par("data", "the numerical data to be plotted.", t.dic)
229
- par("colors", "the two colors used to identify the positive and negative candlesticks; access the colors() method for the available color codes.", t.list_color(2), ['blue+', 'green+'])
230
- par("orientation", "the orientation of the plot which could be either 'vertical' (in short 'v', as by default) or 'horizontal' (in short 'h').", t.str, 'vertical')
407
+ par(
408
+ "colors",
409
+ "the two colors used to identify the positive and negative candlesticks; access the colors() method for the available color codes.",
410
+ t.list_color(2),
411
+ ["blue+", "green+"],
412
+ )
413
+ par(
414
+ "orientation",
415
+ "the orientation of the plot which could be either 'vertical' (in short 'v', as by default) or 'horizontal' (in short 'h').",
416
+ t.str,
417
+ "vertical",
418
+ )
231
419
  past("xside", "scatter")
232
420
  past("yside", "scatter")
233
421
  past("label", "scatter")
234
422
 
235
423
 
236
- method("bar")
424
+ method("bar")
237
425
  doc("It creates a bar plot using the x and y data provided.")
238
- par("args", "The coordinates x and y (or just y), of the bars; string labels or dates are accepted (but only as x values).", t.xy)
239
- par("marker", "the marker used to identify the bars, which could be a single character or the available marker codes, accessible with the markers() method.", t.str, 'sd')
240
- par("color", "the color code of the bars, accessible with the colors() method.", t.color, 'blue+')
241
- par("fill", "if True, the bars will be filled with the the given colored markers, otherwise only its borders would be printed.", t.bool, True)
242
- par("width", "the relative width of the bars, expressed as a float ranging from 0 to 1.", 'number', 4 / 5)
426
+ par(
427
+ "args",
428
+ "The coordinates x and y (or just y), of the bars; string labels or dates are accepted (but only as x values).",
429
+ t.xy,
430
+ )
431
+ par(
432
+ "marker",
433
+ "the marker used to identify the bars, which could be a single character or the available marker codes, accessible with the markers() method.",
434
+ t.str,
435
+ "sd",
436
+ )
437
+ par(
438
+ "color",
439
+ "the color code of the bars, accessible with the colors() method.",
440
+ t.color,
441
+ "blue+",
442
+ )
443
+ par(
444
+ "fill",
445
+ "if True, the bars will be filled with the the given colored markers, otherwise only its borders would be printed.",
446
+ t.bool,
447
+ True,
448
+ )
449
+ par(
450
+ "width",
451
+ "the relative width of the bars, expressed as a float ranging from 0 to 1.",
452
+ "number",
453
+ 4 / 5,
454
+ )
243
455
  past("orientation", "candlestick")
244
- par("minimum", "the minimum value of all the bars; this value could be easily tweaked, particularly when a logarithmic scale is chosen along the bars height.", 'number', 0)
245
- par("reset_ticks", "if True, the center coordinates at the base of each bar will be calculated (starting from 1) and printed automatically; otherwise the numerical ticks, along the base of the bars, will be calculated as for any other plot.", t.bool, True)
456
+ par(
457
+ "minimum",
458
+ "the minimum value of all the bars; this value could be easily tweaked, particularly when a logarithmic scale is chosen along the bars height.",
459
+ "number",
460
+ 0,
461
+ )
462
+ par(
463
+ "reset_ticks",
464
+ "if True, the center coordinates at the base of each bar will be calculated (starting from 1) and printed automatically; otherwise the numerical ticks, along the base of the bars, will be calculated as for any other plot.",
465
+ t.bool,
466
+ True,
467
+ )
246
468
  past("xside", "scatter")
247
469
  past("yside", "scatter")
248
470
  past("label", "scatter")
249
471
 
250
472
 
251
- method("simple_bar")
252
- doc("It creates a simpler and sketchier version of an horizontal bar plot.\n\nNote that this plot cannot be fit into a matrix of subplots and any setting methods - like plot_size() or canvas_color() etc ... - will not have any effect on it.")
473
+ method("simple_bar")
474
+ doc(
475
+ "It creates a simpler and sketchier version of an horizontal bar plot.\n\nNote that this plot cannot be fit into a matrix of subplots and any setting methods - like plot_size() or canvas_color() etc ... - will not have any effect on it."
476
+ )
253
477
  past("args", "bar")
254
478
  past("marker", "bar")
255
479
  past("color", "bar")
256
480
  par("title", "the title of the plot. If None, no title will be added.", t.str, None)
257
- par("width", "sets the horizontal width of the plot; if None, the width will adapt to the terminal size.", t.int, None)
258
-
259
-
260
- method("multiple_bar")
261
- doc("It creates a bar plot where multiple bars are grouped together (along the bar width axis) and have the same bar label.")
262
- par("args", "The coordinates x and Y (or just Y), of the bars, where Y is a list of lists, each containing the bar heights of the correspondent bar plot; string labels or dates are accepted (but only as x values).", t.multiple_xy)
263
- par("marker", "the marker used to identify the bars, which could be a single character or the available marker codes, accessible with the markers() method; a list of markers (with same length as Y) could also be provided to separately set the marker of each bar", t.str_list, 'sd')
264
- par("color", "the list of colors (with same length as Y) used to identify each bar in a group of bars; access the colors() method for the available color codes.", t.list_color())
481
+ par(
482
+ "width",
483
+ "sets the horizontal width of the plot; if None, the width will adapt to the terminal size.",
484
+ t.int,
485
+ None,
486
+ )
487
+
488
+
489
+ method("multiple_bar")
490
+ doc(
491
+ "It creates a bar plot where multiple bars are grouped together (along the bar width axis) and have the same bar label."
492
+ )
493
+ par(
494
+ "args",
495
+ "The coordinates x and Y (or just Y), of the bars, where Y is a list of lists, each containing the bar heights of the correspondent bar plot; string labels or dates are accepted (but only as x values).",
496
+ t.multiple_xy,
497
+ )
498
+ par(
499
+ "marker",
500
+ "the marker used to identify the bars, which could be a single character or the available marker codes, accessible with the markers() method; a list of markers (with same length as Y) could also be provided to separately set the marker of each bar",
501
+ t.str_list,
502
+ "sd",
503
+ )
504
+ par(
505
+ "color",
506
+ "the list of colors (with same length as Y) used to identify each bar in a group of bars; access the colors() method for the available color codes.",
507
+ t.list_color(),
508
+ )
265
509
  past("fill", "bar")
266
510
  past("width", "bar")
267
511
  past("orientation", "bar")
@@ -269,21 +513,33 @@ past("minimum", "bar")
269
513
  past("reset_ticks", "bar")
270
514
  past("xside", "scatter")
271
515
  past("yside", "scatter")
272
- par("labels", "the list of labels, one for each bar plot (with same length as Y), which will appear in the legend menu at the top left corner of the plot canvas.", t.list_str())
516
+ par(
517
+ "labels",
518
+ "the list of labels, one for each bar plot (with same length as Y), which will appear in the legend menu at the top left corner of the plot canvas.",
519
+ t.list_str(),
520
+ )
273
521
 
274
522
 
275
- method("simple_multiple_bar")
276
- doc("It creates a simpler and sketchier version of an horizontal multiple bar plot.\n\nNote that this plot cannot be fit into a matrix of subplots and any setting methods - like plot_size() or canvas_color() etc ... - will not have any effect on it.")
523
+ method("simple_multiple_bar")
524
+ doc(
525
+ "It creates a simpler and sketchier version of an horizontal multiple bar plot.\n\nNote that this plot cannot be fit into a matrix of subplots and any setting methods - like plot_size() or canvas_color() etc ... - will not have any effect on it."
526
+ )
277
527
  past("args", "multiple_bar")
278
528
  past("marker", "multiple_bar")
279
- par("colors", "the list of colors (with same length as Y) used to identify each bar in a group of bars; access the colors() method for the available color codes.", t.list_color())
529
+ par(
530
+ "colors",
531
+ "the list of colors (with same length as Y) used to identify each bar in a group of bars; access the colors() method for the available color codes.",
532
+ t.list_color(),
533
+ )
280
534
  past("title", "simple_bar")
281
535
  past("width", "simple_bar")
282
536
  past("labels", "multiple_bar")
283
537
 
284
538
 
285
- method("stacked_bar")
286
- doc("It creates a bar plot where multiple bars are stacked on top of each other (along the bar height axis) and have the same bar label.")
539
+ method("stacked_bar")
540
+ doc(
541
+ "It creates a bar plot where multiple bars are stacked on top of each other (along the bar height axis) and have the same bar label."
542
+ )
287
543
  past("args", "multiple_bar")
288
544
  past("marker", "multiple_bar")
289
545
  past("color", "multiple_bar")
@@ -297,8 +553,10 @@ past("yside", "scatter")
297
553
  past("labels", "multiple_bar")
298
554
 
299
555
 
300
- method("simple_stacked_bar")
301
- doc("It creates a simpler and sketchier version of an horizontal stacked bar plot. \n\nNote that this plot cannot be fit into a matrix of subplots and any setting methods - like plot_size() or canvas_color() etc ... - will not have any effect on it.")
556
+ method("simple_stacked_bar")
557
+ doc(
558
+ "It creates a simpler and sketchier version of an horizontal stacked bar plot. \n\nNote that this plot cannot be fit into a matrix of subplots and any setting methods - like plot_size() or canvas_color() etc ... - will not have any effect on it."
559
+ )
302
560
  past("args", "multiple_bar")
303
561
  past("marker", "multiple_bar")
304
562
  past("colors", "simple_multiple_bar")
@@ -307,14 +565,24 @@ past("width", "simple_bar")
307
565
  past("labels", "multiple_bar")
308
566
 
309
567
 
310
- method("hist")
568
+ method("hist")
311
569
  doc("It builds the histogram plot.")
312
570
  par("data", "the data to build an histogram upon.", t.list_num())
313
- par("bins", "the number of channels between the minimum and maximum values of the data set, used to count the data frequency.", t.int, 10)
571
+ par(
572
+ "bins",
573
+ "the number of channels between the minimum and maximum values of the data set, used to count the data frequency.",
574
+ t.int,
575
+ 10,
576
+ )
314
577
  past("marker", "scatter")
315
578
  past("color", "scatter")
316
579
  past("fill", "bar")
317
- par("norm", "If true, each frequency count is normalized, such that the sum of all counts is 1 (instead of the length of the data set).", t.bool, False)
580
+ par(
581
+ "norm",
582
+ "If true, each frequency count is normalized, such that the sum of all counts is 1 (instead of the length of the data set).",
583
+ t.bool,
584
+ False,
585
+ )
318
586
  past("width", "bar")
319
587
  past("orientation", "bar")
320
588
  past("minimum", "bar")
@@ -325,9 +593,23 @@ past("label", "scatter")
325
593
 
326
594
  method("box")
327
595
  doc("It creates a box plot. Further development needed.")
328
- par("args", "The coordinates x and Y (or just Y), of the bars, where Y is a list of lists, one for each box element; string labels or dates are accepted (but only as x values).", t.multiple_xy)
329
- par("quintuples", "If True, the input data is an array of 5 elements, each representing the precomputed quantiles at levels 0, 25, 50, 75, 100 s, otherwise it's the original data.", t.bool, False)
330
- par("colors", "A list of two colors, one for the box body and the other for its inner lines", t.list_color(2), ['green', 'red'])
596
+ par(
597
+ "args",
598
+ "The coordinates x and Y (or just Y), of the bars, where Y is a list of lists, one for each box element; string labels or dates are accepted (but only as x values).",
599
+ t.multiple_xy,
600
+ )
601
+ par(
602
+ "quintuples",
603
+ "If True, the input data is an array of 5 elements, each representing the precomputed quantiles at levels 0, 25, 50, 75, 100 s, otherwise it's the original data.",
604
+ t.bool,
605
+ False,
606
+ )
607
+ par(
608
+ "colors",
609
+ "A list of two colors, one for the box body and the other for its inner lines",
610
+ t.list_color(2),
611
+ ["green", "red"],
612
+ )
331
613
  past("fill", "bar")
332
614
  past("width", "bar")
333
615
  past("orientation", "bar")
@@ -338,22 +620,58 @@ past("yside", "scatter")
338
620
  past("label", "scatter")
339
621
 
340
622
 
341
- method("bar")
623
+ method("bar")
342
624
  doc("It creates a bar plot using the x and y data provided.")
343
- par("args", "The coordinates x and y (or just y), of the bars; string labels or dates are accepted (but only as x values).", t.xy)
344
- par("marker", "the marker used to identify the bars, which could be a single character or the available marker codes, accessible with the markers() method.", t.str, 'sd')
345
- par("color", "the color code of the bars, accessible with the colors() method.", t.color, 'blue+')
346
- par("fill", "if True, the bars will be filled with the the given colored markers, otherwise only its borders would be printed.", t.bool, True)
347
- par("width", "the relative width of the bars, expressed as a float ranging from 0 to 1.", 'number', 4 / 5)
625
+ par(
626
+ "args",
627
+ "The coordinates x and y (or just y), of the bars; string labels or dates are accepted (but only as x values).",
628
+ t.xy,
629
+ )
630
+ par(
631
+ "marker",
632
+ "the marker used to identify the bars, which could be a single character or the available marker codes, accessible with the markers() method.",
633
+ t.str,
634
+ "sd",
635
+ )
636
+ par(
637
+ "color",
638
+ "the color code of the bars, accessible with the colors() method.",
639
+ t.color,
640
+ "blue+",
641
+ )
642
+ par(
643
+ "fill",
644
+ "if True, the bars will be filled with the the given colored markers, otherwise only its borders would be printed.",
645
+ t.bool,
646
+ True,
647
+ )
648
+ par(
649
+ "width",
650
+ "the relative width of the bars, expressed as a float ranging from 0 to 1.",
651
+ "number",
652
+ 4 / 5,
653
+ )
348
654
  past("orientation", "candlestick")
349
- par("minimum", "the minimum value of all the bars; this value could be easily tweaked, particularly when a logarithmic scale is chosen along the bars height.", 'number', 0)
350
- par("reset_ticks", "if True, the center coordinates at the base of each bar will be calculated (starting from 1) and printed automatically; otherwise the numerical ticks, along the base of the bars, will be calculated as for any other plot.", t.bool, True)
655
+ par(
656
+ "minimum",
657
+ "the minimum value of all the bars; this value could be easily tweaked, particularly when a logarithmic scale is chosen along the bars height.",
658
+ "number",
659
+ 0,
660
+ )
661
+ par(
662
+ "reset_ticks",
663
+ "if True, the center coordinates at the base of each bar will be calculated (starting from 1) and printed automatically; otherwise the numerical ticks, along the base of the bars, will be calculated as for any other plot.",
664
+ t.bool,
665
+ True,
666
+ )
351
667
  past("xside", "scatter")
352
668
  past("yside", "scatter")
353
669
  past("label", "scatter")
354
670
 
355
- method("error")
356
- doc("It build a scatter plot with error bars.\n\nNote that no marker parameter is needed, as the markers are automatically set to straight lines.")
671
+ method("error")
672
+ doc(
673
+ "It build a scatter plot with error bars.\n\nNote that no marker parameter is needed, as the markers are automatically set to straight lines."
674
+ )
357
675
  past("args", "scatter")
358
676
  par("xerr", "The errors relative to the x data.", t.list_num())
359
677
  par("yerr", "The errors relative to the y data.", t.list_num())
@@ -363,85 +681,180 @@ past("yside", "scatter")
363
681
  past("label", "scatter")
364
682
 
365
683
 
366
-
367
- method("event_plot", "eventplot")
684
+ method("event_plot", "eventplot")
368
685
  doc("It plots parallel lines at the coordinates provided.")
369
- par("data", "The list of coordinates identifying each line; string dates are also accepted.", t.x)
686
+ par(
687
+ "data",
688
+ "The list of coordinates identifying each line; string dates are also accepted.",
689
+ t.x,
690
+ )
370
691
  past("marker", "scatter")
371
692
  past("color", "scatter")
372
693
  past("orientation", "bar")
373
- par("side", "It is used to identify on which axis to plot the data. It could be the 'lower' or 'upper' x axis (1 or 2 in short) for 'vertical' orientation, and 'left' or 'right' y axis (1 or 2 in short) for 'horizontal' orientation.", t.str_int, 'lower')
374
-
694
+ par(
695
+ "side",
696
+ "It is used to identify on which axis to plot the data. It could be the 'lower' or 'upper' x axis (1 or 2 in short) for 'vertical' orientation, and 'left' or 'right' y axis (1 or 2 in short) for 'horizontal' orientation.",
697
+ t.str_int,
698
+ "lower",
699
+ )
375
700
 
376
701
 
377
- method("vertical_line", "vline")
702
+ method("vertical_line", "vline")
378
703
  doc("It plots a vertical line, spanning the entire canvas range, along the y axis.")
379
- par("coordinate", "the x coordinate where the vertical line should be placed; string dates are allowed.", t.str_num)
380
- par("color", "the color code of the line, accessible with the colors() method.", t.color, 'black')
704
+ par(
705
+ "coordinate",
706
+ "the x coordinate where the vertical line should be placed; string dates are allowed.",
707
+ t.str_num,
708
+ )
709
+ par(
710
+ "color",
711
+ "the color code of the line, accessible with the colors() method.",
712
+ t.color,
713
+ "black",
714
+ )
381
715
  past("xside", "scatter")
382
716
 
383
717
 
384
- method("horizontal_line", "hline")
718
+ method("horizontal_line", "hline")
385
719
  doc("It plots an horizontal line, spanning the entire canvas range, along the y axis.")
386
- par("coordinate", "the y coordinate where the horizontal line should be placed; string dates are allowed.", t.str_num)
720
+ par(
721
+ "coordinate",
722
+ "the y coordinate where the horizontal line should be placed; string dates are allowed.",
723
+ t.str_num,
724
+ )
387
725
  past("color", "vertical_line")
388
726
  past("yside", "scatter")
389
727
 
390
728
 
391
- method("text")
729
+ method("text")
392
730
  doc("It adds a text label to the plot at the given coordinate.")
393
- par("label", "The text to add to the plot; the new line character \\n will return multiple sub strings with the same alignment.", t.str)
731
+ par(
732
+ "label",
733
+ "The text to add to the plot; the new line character \\n will return multiple sub strings with the same alignment.",
734
+ t.str,
735
+ )
394
736
  par("x", "the x coordinate of the text; date strings are accepted.", t.str_num)
395
737
  par("y", "the y coordinate of the text; date strings are accepted.", t.str_num)
396
- par("color", "the color code of the text, accessible with the colors() method.", t.color, 'green+')
397
- par("background", "the text background color code, accessible with the colors() method.", t.color, 'white')
398
- par("style", "the style code of the text, accessible with the styles() method.", t.str, 'default')
399
- past("orientation", "bar", 'horizontal')
400
- par("alignment", "the text alignment, which could be either 'left', 'center', and 'right' (for horizontal orientation) or 'top', 'center' and 'bottom' (for vertical orientation).", t.str, "center")
738
+ par(
739
+ "color",
740
+ "the color code of the text, accessible with the colors() method.",
741
+ t.color,
742
+ "green+",
743
+ )
744
+ par(
745
+ "background",
746
+ "the text background color code, accessible with the colors() method.",
747
+ t.color,
748
+ "white",
749
+ )
750
+ par(
751
+ "style",
752
+ "the style code of the text, accessible with the styles() method.",
753
+ t.str,
754
+ "default",
755
+ )
756
+ past("orientation", "bar", "horizontal")
757
+ par(
758
+ "alignment",
759
+ "the text alignment, which could be either 'left', 'center', and 'right' (for horizontal orientation) or 'top', 'center' and 'bottom' (for vertical orientation).",
760
+ t.str,
761
+ "center",
762
+ )
401
763
  past("xside", "scatter")
402
764
  past("yside", "scatter")
403
765
 
404
766
 
405
-
406
- method("rectangle")
767
+ method("rectangle")
407
768
  doc("It creates a rectangle with the given coordinates.")
408
769
  par("x", "the two x coordinates of the rectangle.", t.list_str(2))
409
770
  par("y", "the two y coordinates of the rectangle.", t.list_str(2))
410
- par("marker", "the marker used to identify the shape plotted, which could be a single character or the available marker codes, accessible with the markers() method,", t.marker, 'hd')
411
- par("color", "the color code of shape plotted, accessible with the colors() method", t.color, 'blue+')
412
- par("lines", "If True, the shape borders will be shown, otherwise just its vertices.", t.bool, True)
413
- par("fill" , "if True, the body of the shape will be filled with colored markers.", t.bool, True)
771
+ par(
772
+ "marker",
773
+ "the marker used to identify the shape plotted, which could be a single character or the available marker codes, accessible with the markers() method,",
774
+ t.marker,
775
+ "hd",
776
+ )
777
+ par(
778
+ "color",
779
+ "the color code of shape plotted, accessible with the colors() method",
780
+ t.color,
781
+ "blue+",
782
+ )
783
+ par(
784
+ "lines",
785
+ "If True, the shape borders will be shown, otherwise just its vertices.",
786
+ t.bool,
787
+ True,
788
+ )
789
+ par(
790
+ "fill",
791
+ "if True, the body of the shape will be filled with colored markers.",
792
+ t.bool,
793
+ True,
794
+ )
414
795
  past("xside", "scatter")
415
796
  past("yside", "scatter")
416
797
  past("label", "scatter")
417
798
 
418
799
 
419
- method("polygon")
800
+ method("polygon")
420
801
  doc("It creates a polygon centered at the given coordinates.")
421
802
  par("x", "the polygon center x coordinate.")
422
803
  par("y", "the polygon center y coordinate.")
423
- par("radius", "the distance of the polygon vertices to the center; for a circle, it corresponds to its actual radius, hence the name.", 'number', 1)
424
- par("sides", "the number of sides of the polygon. To simulate a circle, input a high number (> 50).", t.int, 3)
804
+ par(
805
+ "radius",
806
+ "the distance of the polygon vertices to the center; for a circle, it corresponds to its actual radius, hence the name.",
807
+ "number",
808
+ 1,
809
+ )
810
+ par(
811
+ "sides",
812
+ "the number of sides of the polygon. To simulate a circle, input a high number (> 50).",
813
+ t.int,
814
+ 3,
815
+ )
425
816
  past("marker", "rectangle")
426
817
  past("color", "rectangle")
427
818
  past("lines", "rectangle")
428
- past("fill" , "rectangle")
819
+ past("fill", "rectangle")
429
820
  past("xside", "scatter")
430
821
  past("yside", "scatter")
431
822
  past("label", "scatter")
432
823
 
433
824
 
434
- method("confusion_matrix", "cmatrix")
435
- doc("It plots the confusion matrix correspondent to the actual and predicted data sets provided.")
825
+ method("confusion_matrix", "cmatrix")
826
+ doc(
827
+ "It plots the confusion matrix correspondent to the actual and predicted data sets provided."
828
+ )
436
829
  par("actual", "the real data", t.list_num_bool())
437
- par("predicted", "the predicted data, of same size as the 'actual' data", t.list_num_bool())
438
- par("color", "the color code of any writing on the plot, including the axes; this will affects the canvas colors, which are automatic levels of gray-scale; access the colors() method for the available color codes.", t.color, 'orange+')
439
- par("style", "the style code of any writing on the plot; access the styles() method for the available style codes.", t.str, 'bold')
440
- par("labels", "a list of labels, one for each unique and sorted data value; the labels will automatically appear on both axes.", t.list_str())
441
-
442
-
443
- method("indicator")
444
- doc("It creates a simple widget indicator, which occupies the entire plot and could be conveniently used in a matrix of subplots.")
830
+ par(
831
+ "predicted",
832
+ "the predicted data, of same size as the 'actual' data",
833
+ t.list_num_bool(),
834
+ )
835
+ par(
836
+ "color",
837
+ "the color code of any writing on the plot, including the axes; this will affects the canvas colors, which are automatic levels of gray-scale; access the colors() method for the available color codes.",
838
+ t.color,
839
+ "orange+",
840
+ )
841
+ par(
842
+ "style",
843
+ "the style code of any writing on the plot; access the styles() method for the available style codes.",
844
+ t.str,
845
+ "bold",
846
+ )
847
+ par(
848
+ "labels",
849
+ "a list of labels, one for each unique and sorted data value; the labels will automatically appear on both axes.",
850
+ t.list_str(),
851
+ )
852
+
853
+
854
+ method("indicator")
855
+ doc(
856
+ "It creates a simple widget indicator, which occupies the entire plot and could be conveniently used in a matrix of subplots."
857
+ )
445
858
  par("value", "the value to be displayed at the center of the plot.", t.str_num)
446
859
  par("label", "the label describing the value, appearing a plot title.", t.str)
447
860
  past("color", "confusion_matrix")
@@ -449,168 +862,294 @@ past("style", "confusion_matrix")
449
862
 
450
863
 
451
864
  method("matrix_plot")
452
- doc("It creates a two dimensional plot of a matrix. The intensity of each element in the plot (a gray-scale level) is proportional to the correspondent element in the matrix (whiter for higher values). If a matrix of RGB colors is provided, each like (13, 45, 176), the color of each pixel will be the actual RGB color code provided.")
865
+ doc(
866
+ "It creates a two dimensional plot of a matrix. The intensity of each element in the plot (a gray-scale level) is proportional to the correspondent element in the matrix (whiter for higher values). If a matrix of RGB colors is provided, each like (13, 45, 176), the color of each pixel will be the actual RGB color code provided."
867
+ )
453
868
  par("matrix", "the matrix of data to be plotted", t.matrix)
454
- par("marker", "the marker used to identify the data points, which could be a single character or the available marker codes, accessible with the markers() method; note that higher resolution markers ('hd', 'fhd' and 'braille') will not result in an improved spatial resolution, as the color resolution is limited by a full character in all cases.", t.marker, 'sd')
869
+ par(
870
+ "marker",
871
+ "the marker used to identify the data points, which could be a single character or the available marker codes, accessible with the markers() method; note that higher resolution markers ('hd', 'fhd' and 'braille') will not result in an improved spatial resolution, as the color resolution is limited by a full character in all cases.",
872
+ t.marker,
873
+ "sd",
874
+ )
455
875
  past("style", "scatter")
456
- par("fast", "if True, the plot will be rendered faster but most setting methods - like plot_size() or canvas_color() etc... - will not have any effect and the plot could not be nested in a matrix of subplots.",t.bool, False)
457
-
458
-
459
- method("image_plot")
460
- doc("It plots an image from file. \n\nIt is recommended to call the plot_size() method before this one, especially for larger images, to reduce the image size and so the computational load.")
876
+ par(
877
+ "fast",
878
+ "if True, the plot will be rendered faster but most setting methods - like plot_size() or canvas_color() etc... - will not have any effect and the plot could not be nested in a matrix of subplots.",
879
+ t.bool,
880
+ False,
881
+ )
882
+
883
+
884
+ method("image_plot")
885
+ doc(
886
+ "It plots an image from file. \n\nIt is recommended to call the plot_size() method before this one, especially for larger images, to reduce the image size and so the computational load."
887
+ )
461
888
  par("path", "the file path of the image", t.str)
462
889
  past("marker", "matrix_plot")
463
890
  past("style", "matrix_plot")
464
891
  past("fast", "matrix_plot")
465
- par("grayscale", "If True, the image will be rendered in gray-scale levels.", t.bool, False)
466
-
467
-
468
- method("play_gif")
469
- doc("It plays a GIF on terminal. The images will adapt to the screen size unless plot_size() method is used before.\n\nNote: this feature may require further development.")
892
+ par(
893
+ "grayscale",
894
+ "If True, the image will be rendered in gray-scale levels.",
895
+ t.bool,
896
+ False,
897
+ )
898
+
899
+
900
+ method("play_gif")
901
+ doc(
902
+ "It plays a GIF on terminal. The images will adapt to the screen size unless plot_size() method is used before.\n\nNote: this feature may require further development."
903
+ )
470
904
  par("path", "image_plot")
471
905
 
472
906
 
473
- method("play_video")
474
- doc("It plays a video, with audio, from file. The frames will adapt to the screen size unless plot_size() is used before.\n\nNote: this feature may require further development.")
907
+ method("play_video")
908
+ doc(
909
+ "It plays a video, with audio, from file. The frames will adapt to the screen size unless plot_size() is used before.\n\nNote: this feature may require further development."
910
+ )
475
911
  par("path", "the file path of the video", t.str)
476
- par("from_youtube", "set this parameter to True, if the video was downloaded from YouTube.",t.bool, False)
912
+ par(
913
+ "from_youtube",
914
+ "set this parameter to True, if the video was downloaded from YouTube.",
915
+ t.bool,
916
+ False,
917
+ )
477
918
 
478
919
 
479
920
  method("play_youtube")
480
- doc("It plays a YouTube video, with audio, from url.\n\nNote: this feature may require further development.")
921
+ doc(
922
+ "It plays a YouTube video, with audio, from url.\n\nNote: this feature may require further development."
923
+ )
481
924
  par("url", "the url link of the YouTube video", t.str)
482
925
 
483
926
 
484
927
  path_message = " If only the file name is provided, the parent folder will be automatically set to the user home directory."
485
928
 
486
- method("get_youtube")
929
+ method("get_youtube")
487
930
  doc("It downloads a youtube video.")
488
931
  past("url", "play_youtube")
489
932
  par("path", "The location where the video should be saved." + path_message, t.str)
490
- par("log", "if True, a simple confirmation or warning message will appear on terminal.", t.bool, True)
491
-
492
-
493
- method("show")
494
- doc("It builds and prints the final figure on terminal.\n\nIf interactive(True) has been previously called, the show() method will not be necessary.")
495
-
496
- method("build")
497
- doc("It created and returns the final figure canvas in string form, without actually printing it.\n\nTo build and print, use the show() method instead.")
498
- out('The plot canvas in string form', t.str)
499
-
500
- method("sleep")
501
- doc("It adds a sleeping time to the computation and it is generally useful when plotting a continuous stream of data, in order to reduce undesired screen flickering effects. Manually tweak this value to reduce the flickering.")
933
+ par(
934
+ "log",
935
+ "if True, a simple confirmation or warning message will appear on terminal.",
936
+ t.bool,
937
+ True,
938
+ )
939
+
940
+
941
+ method("show")
942
+ doc(
943
+ "It builds and prints the final figure on terminal.\n\nIf interactive(True) has been previously called, the show() method will not be necessary."
944
+ )
945
+
946
+ method("build")
947
+ doc(
948
+ "It created and returns the final figure canvas in string form, without actually printing it.\n\nTo build and print, use the show() method instead."
949
+ )
950
+ out("The plot canvas in string form", t.str)
951
+
952
+ method("sleep")
953
+ doc(
954
+ "It adds a sleeping time to the computation and it is generally useful when plotting a continuous stream of data, in order to reduce undesired screen flickering effects. Manually tweak this value to reduce the flickering."
955
+ )
502
956
  par("time", "The sleeping time, in seconds.", t.float, 0)
503
957
 
504
958
 
505
- method("time")
506
- doc("It returns the computational time of the latest show() or build() method called.\n\nNote that functions, such as matrix_plot() or image_plot(), add a non-negligible computational time before the show() or build() methods are called.")
507
- par("show", "If True, the time is also printed in an easier to read format.", t.bool, True)
508
- out('The computation time of the latest show() or build() method called (in seconds).', t.float)
509
-
510
-
511
- method("save_fig", "savefig")
512
- doc("It saves the plot canvas as text or html. \n\nIt is recommended to use it after the show() or build() method.")
959
+ method("time")
960
+ doc(
961
+ "It returns the computational time of the latest show() or build() method called.\n\nNote that functions, such as matrix_plot() or image_plot(), add a non-negligible computational time before the show() or build() methods are called."
962
+ )
963
+ par(
964
+ "show",
965
+ "If True, the time is also printed in an easier to read format.",
966
+ t.bool,
967
+ True,
968
+ )
969
+ out(
970
+ "The computation time of the latest show() or build() method called (in seconds).",
971
+ t.float,
972
+ )
973
+
974
+
975
+ method("save_fig", "savefig")
976
+ doc(
977
+ "It saves the plot canvas as text or html. \n\nIt is recommended to use it after the show() or build() method."
978
+ )
513
979
  par("path", "The file path where the plot should be saved." + path_message, t.str)
514
- par("append", "If True, the final figure is appended to the text file, instead of replacing it.", t.bool, False)
515
- par("keep_colors", "If True, the ansi color codes will be preserved. Note that if the path file extension is '.html', the colors will be preserved automatically.", t.bool, False)
516
-
517
-
518
- method("from_matplotlib")
519
- doc("It takes a matplotlib figure and turns it into a plotext one.\n\nNote: this feature may require further development.")
520
- par("fig", 'The matplotlib figure to turn into a plotext one.', 'a matplotlib figure')
521
- past('marker', 'bar')
522
-
980
+ par(
981
+ "append",
982
+ "If True, the final figure is appended to the text file, instead of replacing it.",
983
+ t.bool,
984
+ False,
985
+ )
986
+ par(
987
+ "keep_colors",
988
+ "If True, the ansi color codes will be preserved. Note that if the path file extension is '.html', the colors will be preserved automatically.",
989
+ t.bool,
990
+ False,
991
+ )
992
+
993
+
994
+ method("from_matplotlib")
995
+ doc(
996
+ "It takes a matplotlib figure and turns it into a plotext one.\n\nNote: this feature may require further development."
997
+ )
998
+ par("fig", "The matplotlib figure to turn into a plotext one.", "a matplotlib figure")
999
+ past("marker", "bar")
523
1000
 
524
1001
 
525
1002
  iso_message = " It uses the standard Python ISO string forms, except '%' symbol is removed for simplicity. "
526
1003
  global_message = "Use the date_form() method to set this parameter globally. "
527
1004
 
528
1005
 
529
- method("date_form")
530
- doc("It sets how to interpret string as datetime objects.\n\nNote that most methods that deal with string dates, have an internal 'input_form' or 'output_form' parameter for further flexibility.")
531
- par("input_form", "The string form used to interpret input strings as dates." + iso_message, t.str, 'd/m/Y')
532
- par("output_form", "The string form used to print dates as an output string. By default, it corresponds to the input one." + iso_message + global_message, t.str, 'd/m/Y')
533
-
534
-
535
- method("set_time0")
536
- doc("It sets the origin of time using the string provided. \n\nThis method is useful with logarithmic scale in date plots, in order to avoid 'hitting' the 0 timestamp.")
537
- par("string", "The string identifying the 0 time mark.", t.str, '01/01/1900')
538
- par("input_form", "The string form used to interpret the input string as a date." + iso_message + global_message, t.str, 'd/m/Y')
539
-
540
-
541
- method("today_datetime")
1006
+ method("date_form")
1007
+ doc(
1008
+ "It sets how to interpret string as datetime objects.\n\nNote that most methods that deal with string dates, have an internal 'input_form' or 'output_form' parameter for further flexibility."
1009
+ )
1010
+ par(
1011
+ "input_form",
1012
+ "The string form used to interpret input strings as dates." + iso_message,
1013
+ t.str,
1014
+ "d/m/Y",
1015
+ )
1016
+ par(
1017
+ "output_form",
1018
+ "The string form used to print dates as an output string. By default, it corresponds to the input one."
1019
+ + iso_message
1020
+ + global_message,
1021
+ t.str,
1022
+ "d/m/Y",
1023
+ )
1024
+
1025
+
1026
+ method("set_time0")
1027
+ doc(
1028
+ "It sets the origin of time using the string provided. \n\nThis method is useful with logarithmic scale in date plots, in order to avoid 'hitting' the 0 timestamp."
1029
+ )
1030
+ par("string", "The string identifying the 0 time mark.", t.str, "01/01/1900")
1031
+ par(
1032
+ "input_form",
1033
+ "The string form used to interpret the input string as a date."
1034
+ + iso_message
1035
+ + global_message,
1036
+ t.str,
1037
+ "d/m/Y",
1038
+ )
1039
+
1040
+
1041
+ method("today_datetime")
542
1042
  doc("It returns today's date and time as a datetime object.")
543
1043
  out("Today's date time.", t.datetime)
544
1044
 
545
1045
 
546
- method("today_string")
1046
+ method("today_string")
547
1047
  doc("It returns today's date and time in string form.")
548
- par("output_form", "The string form used to print the today's date as an output string." + iso_message + global_message, t.str, 'd/m/Y')
1048
+ par(
1049
+ "output_form",
1050
+ "The string form used to print the today's date as an output string."
1051
+ + iso_message
1052
+ + global_message,
1053
+ t.str,
1054
+ "d/m/Y",
1055
+ )
549
1056
  out("Today's date time.", t.str)
550
1057
 
551
1058
 
552
- method("datetime_to_string")
1059
+ method("datetime_to_string")
553
1060
  doc("It turns a datetime object to a string.")
554
1061
  par("datetime", "A datetime object.", t.datetime)
555
- par("output_form", "The string form used to print the datetime object as an output string." + iso_message + global_message, t.str, 'd/m/Y')
556
- out('the correspondent date time string', t.str)
1062
+ par(
1063
+ "output_form",
1064
+ "The string form used to print the datetime object as an output string."
1065
+ + iso_message
1066
+ + global_message,
1067
+ t.str,
1068
+ "d/m/Y",
1069
+ )
1070
+ out("the correspondent date time string", t.str)
557
1071
 
558
1072
 
559
1073
  method("datetimes_to_strings")
560
1074
  doc("It turns a list of datetime objects to a list of strings.")
561
1075
  par("datetimes", "A list of datetime objects.", t.list_datetime)
562
- par("output_form", "The string form used to print the datetime objects as output strings." + iso_message + global_message, t.str, 'd/m/Y')
563
- out('A correspondent list of date time strings', t.list_str())
564
-
1076
+ par(
1077
+ "output_form",
1078
+ "The string form used to print the datetime objects as output strings."
1079
+ + iso_message
1080
+ + global_message,
1081
+ t.str,
1082
+ "d/m/Y",
1083
+ )
1084
+ out("A correspondent list of date time strings", t.list_str())
565
1085
 
566
1086
 
567
1087
  method("string_to_datetime")
568
1088
  doc("It turns a string into a datetime object.")
569
1089
  par("string", "The string to convert to a datetime object.", t.str)
570
1090
  past("input_form", "set_time0")
571
- out('The datetime object corresponded to the string provided.', t.datetime)
572
-
1091
+ out("The datetime object corresponded to the string provided.", t.datetime)
573
1092
 
574
1093
 
575
1094
  method("script_folder")
576
- doc("It returns the parent folder (in string form) of the script where this method is run from.")
577
- out('The script folder', t.str)
1095
+ doc(
1096
+ "It returns the parent folder (in string form) of the script where this method is run from."
1097
+ )
1098
+ out("The script folder", t.str)
578
1099
 
579
1100
 
580
- method("parent_folder")
1101
+ method("parent_folder")
581
1102
  doc("It returns the parent folder of the path provided.")
582
1103
  par("path", "The file path.")
583
- par("level", "The numbers of levels above the current one, in the folder structure, used to identify the parent folder.", int, 1)
584
- out('The parent folder', t.str)
1104
+ par(
1105
+ "level",
1106
+ "The numbers of levels above the current one, in the folder structure, used to identify the parent folder.",
1107
+ int,
1108
+ 1,
1109
+ )
1110
+ out("The parent folder", t.str)
585
1111
 
586
1112
  path_message = " Note that the symbol '~', is interpreted as the user home folder and if no folder is specified, the home folder is considered by default. "
587
1113
 
588
1114
 
589
- method("join_paths")
590
- doc("It turns a sequence of strings into a properly formatted file or folder path, dependent on the operating system used.\n\nFor example, the strings \"/\", \"home\" and \"file.txt\" would be properly joined into \"/home/file.txt\" in Unix systems.")
1115
+ method("join_paths")
1116
+ doc(
1117
+ 'It turns a sequence of strings into a properly formatted file or folder path, dependent on the operating system used.\n\nFor example, the strings "/", "home" and "file.txt" would be properly joined into "/home/file.txt" in Unix systems.'
1118
+ )
591
1119
  par("args", "The list of strings to turn into a path." + path_message, t.list_str())
592
- out('The joined paths.', t.str)
593
-
1120
+ out("The joined paths.", t.str)
594
1121
 
595
1122
 
596
- method("save_text")
1123
+ method("save_text")
597
1124
  doc("It saves some text to file.")
598
1125
  par("text", "The string to save", t.str)
599
1126
  par("path", "The path location where the text should be saved." + path_message, t.str)
600
- past("log", "get_youtube")
1127
+ past("log", "get_youtube")
601
1128
 
602
1129
 
603
- method("read_data")
1130
+ method("read_data")
604
1131
  doc("It reads and properly interprets the tabular data from the path selected.")
605
1132
  par("path", "The path location of the data." + path_message, t.str)
606
- par("delimiter", "The character used to separate data columns in the text file.", t.str, ' ')
607
- par("columns", 'The list of column indexes to consider (starting from 0); if None, all columns will be included.', t.list_int(), None)
608
- par("first_row", "The first row from which to acquire data (counting from 0).", t.int, 0)
1133
+ par(
1134
+ "delimiter",
1135
+ "The character used to separate data columns in the text file.",
1136
+ t.str,
1137
+ " ",
1138
+ )
1139
+ par(
1140
+ "columns",
1141
+ "The list of column indexes to consider (starting from 0); if None, all columns will be included.",
1142
+ t.list_int(),
1143
+ None,
1144
+ )
1145
+ par(
1146
+ "first_row", "The first row from which to acquire data (counting from 0).", t.int, 0
1147
+ )
609
1148
  past("log", "save_text")
610
- out('The data read.', 'a matrix of numbers or strings')
1149
+ out("The data read.", "a matrix of numbers or strings")
611
1150
 
612
1151
 
613
- method("write_data")
1152
+ method("write_data")
614
1153
  doc("It writes a tabular data to file.")
615
1154
  par("data", "The data to write to file.", t.data)
616
1155
  past("path", "save_text")
@@ -619,87 +1158,119 @@ past("columns", "read_data")
619
1158
  past("log", "read_data")
620
1159
 
621
1160
 
622
- method("download")
1161
+ method("download")
623
1162
  doc("It downloads an image/gif/video (or other) from the given URL to file.")
624
1163
  par("url", "The URL to download.", t.str)
625
- par("path", "The path location where the content should be saved." + path_message, t.str)
1164
+ par(
1165
+ "path", "The path location where the content should be saved." + path_message, t.str
1166
+ )
626
1167
  past("log", "read_data")
627
1168
 
628
1169
 
629
- method("delete_file")
1170
+ method("delete_file")
630
1171
  doc("It deletes the file selected, if it exists.")
631
1172
  par("path", "The file path to delete." + path_message, t.str)
632
1173
  past("log", "read_data")
633
1174
 
634
1175
 
635
- method("colorize")
1176
+ method("colorize")
636
1177
  doc("It adds colors and styles to a string.")
637
1178
  par("string", "The string to add colors and styles to", t.str)
638
- par("color", "the fullground color code: access the colors() method for the available codes.", t.color)
639
- par("style", "the style code: access the styles() method for the available codes.", t.str)
640
- par("background", "the background color code: access the colors() method for the available codes.", t.color)
1179
+ par(
1180
+ "color",
1181
+ "the fullground color code: access the colors() method for the available codes.",
1182
+ t.color,
1183
+ )
1184
+ par(
1185
+ "style",
1186
+ "the style code: access the styles() method for the available codes.",
1187
+ t.str,
1188
+ )
1189
+ par(
1190
+ "background",
1191
+ "the background color code: access the colors() method for the available codes.",
1192
+ t.color,
1193
+ )
641
1194
  par("show", "If True, the string is also directly printed.", t.bool, False)
642
- out('The colorized and stylized string.', t.str)
1195
+ out("The colorized and stylized string.", t.str)
643
1196
 
644
1197
 
645
1198
  method("uncolorize")
646
1199
  doc("It removes any coloring codes from a string.")
647
1200
  par("string", "The string to remove color codes from.", t.str)
648
- out('The string with no color or style ansi codes.', t.str)
1201
+ out("The string with no color or style ansi codes.", t.str)
649
1202
 
650
1203
 
651
- method("terminal_size", "ts")
1204
+ method("terminal_size", "ts")
652
1205
  doc("It returns the terminal size.")
653
- out('The terminal width and height (in character units)', t.list_int(2))
1206
+ out("The terminal width and height (in character units)", t.list_int(2))
654
1207
 
655
1208
 
656
1209
  method("terminal_width", "tw")
657
1210
  doc("It returns the terminal width.")
658
- out('The terminal width (in character units)', t.int)
1211
+ out("The terminal width (in character units)", t.int)
659
1212
 
660
1213
 
661
1214
  method("terminal_height", "th")
662
1215
  doc("It returns the terminal height.")
663
- out('The terminal height (in character units)', t.int)
1216
+ out("The terminal height (in character units)", t.int)
664
1217
 
665
1218
 
666
- method("sin")
667
- doc("It returns a sinusoidal signal useful, for example, to quickly test some plotext plotting methods.")
1219
+ method("sin")
1220
+ doc(
1221
+ "It returns a sinusoidal signal useful, for example, to quickly test some plotext plotting methods."
1222
+ )
668
1223
  par("periods", "The number of periods in the signal.", t.float, 2)
669
1224
  par("length", "The number of data points.", t.int, 200)
670
1225
  par("amplitude", "The amplitude of the signal.", t.float, 1)
671
- par("phase", "The relative phase of the sinusoidal (in pi units); 0.5 returns a cosine signal, while 1 a negative sinusoidal.", t.float, 0)
672
- par("decay", "The relative decay rate of the signal, independent on the number of data points.", t.float, 0)
673
- out('the sinusoidal signal', t.list_num())
674
-
675
-
676
- method("square")
677
- doc("It returns a square wave signal useful, for example, to quickly test some plotext plotting methods.")
1226
+ par(
1227
+ "phase",
1228
+ "The relative phase of the sinusoidal (in pi units); 0.5 returns a cosine signal, while 1 a negative sinusoidal.",
1229
+ t.float,
1230
+ 0,
1231
+ )
1232
+ par(
1233
+ "decay",
1234
+ "The relative decay rate of the signal, independent on the number of data points.",
1235
+ t.float,
1236
+ 0,
1237
+ )
1238
+ out("the sinusoidal signal", t.list_num())
1239
+
1240
+
1241
+ method("square")
1242
+ doc(
1243
+ "It returns a square wave signal useful, for example, to quickly test some plotext plotting methods."
1244
+ )
678
1245
  past("periods", "sin")
679
1246
  past("length", "sin")
680
1247
  past("amplitude", "sin")
681
- out('the square signal', t.list_num())
1248
+ out("the square signal", t.list_num())
682
1249
 
683
1250
 
684
- method("transpose")
1251
+ method("transpose")
685
1252
  doc("It transposes a matrix of data.")
686
1253
  past("data", "write_data")
687
- out('The transpose data', 'A list of lists')
1254
+ out("The transpose data", "A list of lists")
688
1255
 
689
1256
 
690
- method("colors")
691
- doc("It displays the available string, integer and RGB color codes available in plotext.")
1257
+ method("colors")
1258
+ doc(
1259
+ "It displays the available string, integer and RGB color codes available in plotext."
1260
+ )
692
1261
 
693
1262
 
694
- method("styles")
1263
+ method("styles")
695
1264
  doc("It displays the available string style codes available in plotext.")
696
1265
 
697
1266
 
698
- method("markers")
699
- doc("It displays the available marker codes available in plotext. Note that any other single character is a valid marker.")
1267
+ method("markers")
1268
+ doc(
1269
+ "It displays the available marker codes available in plotext. Note that any other single character is a valid marker."
1270
+ )
700
1271
 
701
1272
 
702
- method("themes")
1273
+ method("themes")
703
1274
  doc("It displays the available plot themes available in plotext.")
704
1275
 
705
1276