Skip to content

Commit 76f78ae

Browse files
committed
adding uboxplot example
1 parent e8243db commit 76f78ae

File tree

4 files changed

+85
-0
lines changed

4 files changed

+85
-0
lines changed

docs/examples.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,13 @@ example of ufillbetween plot
120120
:caption: examples/uplot_ufillbetween.py
121121
:linenos:
122122
.. image:: ../docs/uplot_ex15.jpg
123+
124+
Uboxplot Example
125+
---------------------------
126+
127+
example of uboxplot integration with uplot
128+
129+
.. literalinclude:: ../examples/uplot_uboxplot.py
130+
:caption: examples/uplot_uboxplot.py
131+
:linenos:
132+
.. image:: ../docs/uplot_ex16.jpg

docs/uplot_ex16.jpg

7.8 KB
Loading

docs/uplot_ex16.jpg.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2023 Jose David M.
2+
3+
SPDX-License-Identifier: MIT

examples/uplot_uboxplot.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2023 Jose D. Montoya
2+
#
3+
# SPDX-License-Identifier: MIT
4+
"""
5+
Simple test to display boxplot using uplot
6+
"""
7+
8+
import board
9+
from uboxplot import Boxplot
10+
from circuitpython_uplot.uplot import Uplot
11+
12+
13+
display = board.DISPLAY
14+
15+
plot = Uplot(0, 0, display.width, display.height)
16+
17+
plot.tick_params(tickheight=10, tickcolor=0x440008, tickgrid=True)
18+
19+
a = [1, 1, 4, 5, 6, 7, 7, 7, 8, 9, 10, 15, 16, 17, 24, 56, 76, 87, 87]
20+
my_box = Boxplot(a, x=50, y=50, height=100, line_color=0xFF00FF)
21+
my_box.draw()
22+
23+
b = [1, 1, 4, 5, 6, 7, 7, 7, 8, 9, 10, 15, 16, 17, 24]
24+
my_box2 = Boxplot(b, x=90, y=90, height=100, line_color=0x0000FF)
25+
my_box2.draw()
26+
27+
c = [
28+
1,
29+
1,
30+
4,
31+
5,
32+
6,
33+
7,
34+
7,
35+
7,
36+
8,
37+
9,
38+
9,
39+
9,
40+
9,
41+
9,
42+
9,
43+
9,
44+
9,
45+
9,
46+
9,
47+
10,
48+
15,
49+
15,
50+
15,
51+
15,
52+
16,
53+
16,
54+
17,
55+
23,
56+
28,
57+
39,
58+
41,
59+
41,
60+
41,
61+
43,
62+
]
63+
my_box3 = Boxplot(c, x=150, y=50, height=100, line_color=0x1CFF11)
64+
my_box3.draw()
65+
66+
plot.append(my_box)
67+
plot.append(my_box2)
68+
plot.append(my_box3)
69+
display.show(plot)
70+
71+
while True:
72+
pass

0 commit comments

Comments
 (0)