Skip to content

Commit 341ddd0

Browse files
committed
changing example
1 parent 75e5b2e commit 341ddd0

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

docs/uplot_ex17.jpg

23.4 KB
Loading

examples/uplot_umap.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# SPDX-License-Identifier: MIT
44

55
import time
6+
from random import choice
67
import board
78
from ulab import numpy as np
89
from circuitpython_uplot.uplot import Uplot
@@ -16,21 +17,13 @@
1617
plot = Uplot(0, 0, display.width, display.height, show_box=False)
1718

1819
# Setting some date to plot
19-
x = np.array(
20-
[
21-
[1, 3, 9, 25],
22-
[12, 8, 4, 2],
23-
[18, 3, 7, 5],
24-
[2, 10, 9, 22],
25-
[8, 8, 14, 12],
26-
[3, 13, 17, 15],
27-
],
28-
dtype=np.int16,
29-
)
20+
x = np.linspace(-4, 4, num=100)
21+
y = 2.0 / np.sqrt(2 * np.pi) * np.exp((-(x**2)) / 4.0)
22+
b = [choice(y) for _ in y]
23+
y1 = np.array(b).reshape((10, 10))
3024

3125
# Plotting and showing the plot
32-
umap(plot, x, 0xFF0000, 0x0000FF)
33-
26+
umap(plot, y1, 0xFF0044, 0x4400FF)
3427
# Plotting and showing the plot
3528
display.show(plot)
3629

0 commit comments

Comments
 (0)