-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathspecify_names.py
More file actions
47 lines (34 loc) · 1.1 KB
/
specify_names.py
File metadata and controls
47 lines (34 loc) · 1.1 KB
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
"""
Specify IDs with subplot names
==============================
Provide a list of tuples where each tuple has subplot names. The same controller will be used for the subplots
indicated by each of these tuples
"""
# test_example = false
# sphinx_gallery_pygfx_docs = 'screenshot'
import numpy as np
import fastplotlib as fpl
xs = np.linspace(0, 2 * np.pi, 100)
ys = np.sin(xs)
# create some subplots names
names = ["subplot_0", "subplot_1", "subplot_2", "subplot_3", "subplot_4", "subplot_5"]
# list of tuples of subplot names
# subplots within each tuple will use the same controller.
ids = [
("subplot_0", "subplot_3"),
("subplot_1", "subplot_2", "subplot_4"),
]
figure = fpl.Figure(
shape=(2, 3),
controller_ids=ids,
names=names,
size=(700, 560),
)
for subplot in figure:
subplot.add_line(np.column_stack([xs, ys + np.random.normal(scale=0.1, size=100)]))
figure.show(maintain_aspect=False)
# NOTE: fpl.loop.run() should not be used for interactive sessions
# See the "JupyterLab and IPython" section in the user guide
if __name__ == "__main__":
print(__doc__)
fpl.loop.run()