-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathtests.sh
356 lines (303 loc) · 15.1 KB
/
tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
#!/bin/bash
#choice of yes or no
fork(){
while true;
do
#read -n 1 -r -p "y/n? " response
read -n 1 -r -p "? " response
echo -e ""
if [[ $response =~ ^([yY])$ ]]
then
out=1
break
elif [[ $response =~ ^([nN][oO]|[nN])$ ]]
then
out=0
break
fi
done
}
echo -en "Command Line Tool: Scatter Plot"
fork
if test $out -eq 1
then
plotext scatter --path test --xcolumn 1 --ycolumns 2 --lines 5000 --title "Scatter Plot Test" --marker braille
fi
echo -en "Command line: Line Plot"
fork
if test $out -eq 1
then
plotext plot --path test --xcolumn 1 --ycolumns 2 --sleep 0.1 --lines 2500 --color magenta+ --title "Line Plot Test"
fi
echo -en "Command Line Tool: Plotter"
fork
if test $out -eq 1
then
plotext plotter --path test --xcolumn 1 --ycolumns 2 --sleep 0.1 --lines 120 --marker hd --title "Plotter Test"
fi
echo -en "Command Line Tool: Bar Plot"
fork
if test $out -eq 1
then
plotext bar --path test --xcolumn 1 --title "Bar Plot Test" --xlabel Animals --ylabel Count
fi
echo -en "Command Line Tool: Histogram Plot"
fork
if test $out -eq 1
then
plotext hist --path test --xcolumn 1 --ycolumns 2 --lines 5000 --title "Histogram Test"
fi
echo -en "Command Line Tool: Image Plot"
fork
if test $out -eq 1
then
plotext image --path test
fi
echo -en "Command Line Tool: GIF Plot"
fork
if test $out -eq 1
then
plotext gif --path test
fi
echo -en "Command Line Tool: Video Plot"
fork
if test $out -eq 1
then
plotext video --path test --from_youtube True
fi
echo -en "Command Line Tool: YouTube Plot"
fork
if test $out -eq 1
then
plotext youtube --url test
fi
echo -en "Scatter"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; y = plt.sin(); plt.scatter(y); plt.title('Scatter Plot'); plt.show()"
fi
echo -en "Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; y = plt.sin(); plt.plot(y); plt.title('Line Plot'); plt.show()"
fi
echo -en "Stem Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; y = plt.sin(length = 100); plt.plot(y, fillx = True); plt.title('Stem Plot'); plt.show()"
fi
echo -en "Multiple Data Set"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; y1 = plt.sin(); y2 = plt.sin(phase = -1); plt.plot(y1, label = 'plot'); plt.scatter(y2, label = 'scatter'); plt.title('Multiple Data Set'); plt.show()"
fi
echo -en "Multiple Axes Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; y1 = plt.sin(); y2 = plt.sin(2, phase = -1); plt.plot(y1, xside= 'lower', yside = 'left', label = 'lower left'); plt.plot(y2, xside= 'upper', yside = 'right', label = 'upper right'); plt.title('Multiple Axes Plot'); plt.show()"
fi
echo -en "Logarithmic Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; l = 10 ** 4; y = plt.sin(periods = 2, length = l); plt.plot(y); plt.xscale('log'); plt.yscale('linear'); plt.grid(0, 1); plt.title('Logarithmic Plot'); plt.xlabel('logarithmic scale'); plt.ylabel('linear scale'); plt.show();"
fi
echo -en "Streaming Data"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; l = 1000; frames = 200; plt.title('Streaming Data'); [(plt.cld(), plt.clt(), plt.plot(plt.sin(periods = 2, length = l, phase = 2 * i / frames)), plt.sleep(0.00), plt.show()) for i in range(frames)]"
fi
echo -en "Bar Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; pizzas = ['Sausage', 'Pepperoni', 'Mushrooms', 'Cheese', 'Chicken', 'Beef']; percentages = [14, 36, 11, 8, 7, 4]; plt.bar(pizzas, percentages); plt.title('Most Favored Pizzas in the World'); plt.show()"
fi
echo -en "Horizontal Bar Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; pizzas = ['Sausage', 'Pepperoni', 'Mushrooms', 'Cheese', 'Chicken', 'Beef']; percentages = [14, 36, 11, 8, 7, 4]; plt.bar(pizzas, percentages, orientation = 'h', width = 3 / 5); plt.title('Most Favored Pizzas in the World'); plt.show()"
fi
echo -en "Simple Bar Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; pizzas = ['Sausage', 'Pepperoni', 'Mushrooms', 'Cheese', 'Chicken', 'Beef']; percentages = [14, 36, 11, 8, 7, 4]; plt.simple_bar(pizzas, percentages, width = 100, title = 'Most Favored Pizzas in the World'); plt.show()"
fi
echo -en "Multiple Bar Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; pizzas = ['Sausage', 'Pepperoni', 'Mushrooms', 'Cheese', 'Chicken', 'Beef']; male_percentages = [14, 36, 11, 8, 7, 4]; female_percentages = [12, 20, 35, 15, 2, 1]; plt.multiple_bar(pizzas, [male_percentages, female_percentages], labels = ['men', 'women']); plt.title('Most Favored Pizzas in the World by Gender'); plt.show()"
fi
echo -en "Simple Multiple Bar Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; pizzas = ['Sausage', 'Pepperoni', 'Mushrooms', 'Cheese', 'Chicken', 'Beef']; male_percentages = [14, 36, 11, 8, 7, 4]; female_percentages = [12, 20, 35, 15, 2, 1]; plt.simple_multiple_bar(pizzas, [male_percentages, female_percentages], width = 100, labels = ['men', 'women'], title = 'Most Favored Pizzas in the World by Gender'); plt.show()"
fi
echo -en "Stacked Bar Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; pizzas = ['Sausage', 'Pepperoni', 'Mushrooms', 'Cheese', 'Chicken', 'Beef']; male_percentages = [14, 36, 11, 8, 7, 4]; female_percentages = [12, 20, 35, 15, 2, 1]; plt.stacked_bar(pizzas, [male_percentages, female_percentages], labels = ['men', 'women']); plt.title('Most Favored Pizzas in the World by Gender'); plt.show()"
fi
echo -en "Simple Stacked Bar Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; pizzas = ['Sausage', 'Pepperoni', 'Mushrooms', 'Cheese', 'Chicken', 'Beef']; male_percentages = [14, 36, 11, 8, 7, 4]; female_percentages = [12, 20, 35, 15, 2, 1]; plt.simple_stacked_bar(pizzas, [male_percentages, female_percentages], width = 100, labels = ['men', 'women'], title = 'Most Favored Pizzas in the World by Gender'); plt.show()"
fi
echo -en "Histogram Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; import random; l = 7 * 10 ** 4; data1 = [random.gauss(0, 1) for el in range(10 * l)]; data2 = [random.gauss(3, 1) for el in range(6 * l)]; data3 = [random.gauss(6, 1) for el in range(4 * l)]; bins = 60; plt.hist(data1, bins, label='mean 0'); plt.hist(data2, bins, label='mean 3'); plt.hist(data3, bins, label='mean 6'); plt.title('Histogram Plot'); plt.show()"
fi
echo -en "Datetime Plot"
fork
if test $out -eq 1
then
python3 -c "import yfinance as yf; import plotext as plt; plt.date_form('d/m/Y'); start = plt.string_to_datetime('11/04/2022'); end = plt.today_datetime(); data = yf.download('goog', start, end); prices = list(data['Close']); dates = plt.datetimes_to_strings(data.index); plt.plot(dates, prices); plt.title('Google Stock Price'); plt.xlabel('Date'); plt.ylabel('Stock Price $'); plt.show()"
fi
echo -en "Candlestick Plot"
fork
if test $out -eq 1
then
python3 -c "import yfinance as yf; import plotext as plt; plt.date_form('d/m/Y'); start = plt.string_to_datetime('11/04/2022'); end = plt.today_datetime(); data = yf.download('goog', start, end); dates = plt.datetimes_to_strings(data.index); plt.candlestick(dates, data); plt.title('Google Stock Price Candlesticks'); plt.xlabel('Date'); plt.ylabel('Stock Price $'); plt.show()"
fi
echo -en "Box Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; labels = ['apple', 'orange', 'banana', 'pear']; weights = [[1,2,3,5,10,8], [4,9,6,12,20,13], [1,2,3,4,5,6], [3,9,12,16,9,8,3,7,2]]; plt.box(labels, weights, width = 0.3); plt.title('The Weight of the Fruits'); plt.show();"
fi
echo -en "Error Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; plt.clf(); from random import random; l = 20; n = 1; ye = [random() * n for i in range(l)]; xe = [random() * n for i in range(l)]; y = plt.sin(length = l); plt.error(y, xerr = xe, yerr = ye); plt.title('Error Plot'); plt.show();"
fi
echo -en "Event Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; from random import randint; from datetime import datetime, timedelta; plt.date_form('H:M'); times = [datetime(2022, 3, 27, randint(0, 23), randint(0, 59), randint(0, 59)) for i in range(100)]; times = plt.datetimes_to_strings(times); plt.plotsize(None, 20); plt.eventplot(times); plt.show()"
fi
echo -en "Extra Lines"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; y = plt.sin(); plt.scatter(y); plt.title('Extra Lines'); plt.vline(100, 'magenta'); plt.hline(0.5, 'blue+'); plt.plotsize(100, 30); plt.show()"
fi
echo -en "Text Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; pizzas = ['Sausage', 'Pepperoni', 'Mushrooms', 'Cheese', 'Chicken', 'Beef']; percentages = [14, 36, 11, 8, 7, 4]; plt.bar(pizzas, percentages); plt.title('Labelled Bar Plot using Text()'); [plt.text(pizzas[i], i + 1, y = percentages[i] + 1.5, alignment = 'center', color = 'red') for i in range(len(pizzas))]; plt.ylim(0, 38); plt.plotsize(100, 30); plt.show()"
fi
echo -en "Shapes"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; plt.clf(); plt.title('Shapes'); plt.polygon(); plt.rectangle(); plt.polygon(sides = 100); plt.show()"
fi
echo -en "Indicator"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; plt.indicator(45.3, 'Price'); plt.plotsize(30, 10); plt.show()"
fi
echo -en "Settings Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; l, p = 300, 2; plt.plot(plt.sin(length = l, periods = p), label = 'My Signal'); plt.plotsize(100, 30); plt.title('Some Smart Title'); plt.xlabel('Time'); plt.ylabel('Movement'); plt.ticks_color('red'); plt.ticks_style('bold'); plt.xlim(-l//10, l + l//10); plt.ylim(-1.5, 1.5); xticks = [l * i / (2 * p) for i in range(2 * p + 1)]; xlabels = [str(i) + 'π' for i in range(2 * p + 1)]; plt.xticks(xticks, xlabels); plt.yfrequency(5); plt.show()"
fi
echo -en "Matrix Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; cols, rows = 200, 45; p = 1; matrix = [[(abs(r - rows / 2) + abs(c - cols / 2)) ** p for c in range(cols)] for r in range(rows)]; plt.matrix_plot(matrix); plt.plotsize(cols, rows); plt.title('Matrix Plot'); plt.show()"
fi
echo -en "Confusion Matrix"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; from random import randrange; l = 300; actual = [randrange(0, 4) for i in range(l)]; predicted = [randrange(0,4) for i in range(l)]; labels = ['Autumn', 'Spring', 'Summer', 'Winter']; plt.cmatrix(actual, predicted, labels); plt.show()"
fi
echo -en "Image Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; path = 'cat.jpg'; plt.download(plt.test_image_url, path); plt.image_plot(path); plt.title('A very Cute Cat'); plt.show(); plt.delete_file(path)"
fi
echo -en "GIF plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; path = 'homer.gif'; plt.download(plt.test_gif_url, path); plt.play_gif(path); plt.show(); plt.delete_file(path)"
fi
echo -en "Video Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; path = 'moonwalk.mp4'; plt.download(plt.test_video_url, path); plt.play_video(path, from_youtube = True); plt.delete_file(path)"
fi
echo -en "YouTube Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; plt.play_youtube(plt.test_youtube_url)"
fi
echo -en "Subplots"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; import random; import yfinance as yf; plt.date_form('d/m/Y'); start = plt.string_to_datetime('28/03/2022'); end = plt.today_datetime(); data = yf.download('goog', start, end); dates = plt.datetimes_to_strings(data.index); p = ['Sausage', 'Pepperoni', 'Mushrooms', 'Cheese', 'Chicken', 'Beef']; mp = [14, 36, 11, 8, 7, 4]; fp = [12, 20, 35, 15, 2, 1]; hd = [random.gauss(1, 1) for el in range(3 * 10 ** 5)]; path = 'cat.jpg'; plt.download(plt.test_image_url, path); plt.clf(); plt.subplots(1, 2); plt.subplot(1, 1).plotsize(plt.tw() // 2, None); plt.subplot(1, 1).subplots(3, 1); plt.subplot(1, 2).subplots(2, 1); plt.subplot(1, 1).ticks_style('bold'); plt.subplot(1, 1).subplot(1, 1); plt.theme('windows'); plt.candlestick(dates, data); plt.title('Google Stock Price CandleSticks'); plt.subplot(1, 1).subplot(2, 1); plt.theme('dreamland'); plt.stacked_bar(p, [mp, fp], labels = ['men', 'women']); plt.title('Most Favored Pizzas in the World by Gender'); plt.subplot(1, 1).subplot(3, 1); plt.theme('matrix'); bins = 18; plt.hist(hd, bins, label = 'Gaussian Noise Distribution', marker = 'fhd'); plt.yfrequency(0); plt.title('Histogram Plot'); plt.subplot(1, 2).subplot(1, 1).title('Default Theme'); plt.plot(plt.sin(periods = 3), marker = 'fhd', label = '3 periods'); plt.plot(plt.sin(periods = 2), marker = 'fhd', label = '2 periods'); plt.plot(plt.sin(periods = 1), marker = 'fhd', label = '1 period'); plt.subplot(1, 2).subplot(2, 1); plt.plotsize(2 * plt.tw() // 3, plt.th() // 2); plt.image_plot(path); plt.title('A very Cute Cat'); plt.show(); plt.delete_file(path);"
fi
echo -en "Test Plot"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; plt.test()"
fi
echo -en "Markers"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; plt.markers()"
fi
echo -en "Colors"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; plt.colors()"
fi
echo -en "Styles"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; plt.styles()"
fi
echo -en "Themes"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; plt.themes()"
fi
echo -en "Extreme Cases"
fork
if test $out -eq 1
then
python3 -c "import plotext as plt; plt.clf(); plt.subplots(5, 5); plt.subplot(1,1); plt.scatter(); plt.title('scatter()'); plt.subplot(1, 2); plt.scatter([]); plt.title('scatter([])'); plt.subplot(1, 3); plt.plot(); plt.title('plot()'); plt.subplot(1,4); plt.scatter([]); plt.title('scatter([])'); plt.subplot(1, 5); plt.candlestick([], []); plt.title('candlestick([], [])');
plt.subplot(2, 1); plt.bar(); plt.title('bar()'); plt.subplot(2, 2); plt.bar([]); plt.title('bar([])'); plt.subplot(2, 3); plt.bar([],[]); plt.title('bar([],[])'); plt.subplot(2, 4); plt.bar([0, 1]); plt.title('bar([0, 1])'); plt.subplot(2, 5); plt.bar([0,0]); plt.title('bar([0,0])'); plt.subplot(3, 1); plt.multiple_bar(); plt.title('multiple_bar()'); plt.subplot(3, 2); plt.multiple_bar([]); plt.title('multiple_bar([])'); plt.subplot(3, 3); plt.multiple_bar([], []); plt.title('multiple_bar([], [])');
plt.subplot(3, 4); plt.multiple_bar([[0,1],[0,1]]); plt.title('multiple_bar([[0,1],[0,1]])'); plt.subplot(3, 5); plt.multiple_bar([[0,0],[0,0]]); plt.title('multiple_bar([[0,0],[0,0]])'); plt.subplot(4, 1); plt.hist([]); plt.title('hist([])'); plt.subplot(4, 2); plt.error(); plt.title('error()'); plt.subplot(4, 3); plt.error([]); plt.title('error([])'); plt.subplot(4, 4); plt.event_plot([]); plt.title('event_plot([])'); plt.subplot(4, 5); plt.vline(0); plt.title('vline(0)'); plt.subplot(5, 1); plt.text('ciao bello!', 0, 0); plt.title('text(..., 0, 0)'); plt.subplot(5, 2); plt.rectangle(); plt.title('rectangle()'); plt.subplot(5, 3); plt.rectangle([], []); plt.title('rectangle([], [])'); plt.subplot(5, 4); plt.polygon(); plt.title('polygon()'); plt.subplot(5, 5); plt.matrix_plot([[]]); plt.title('matrix_plot([[]])'); plt.show()"
fi