-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathscatterplot_remote.mo.py
More file actions
100 lines (83 loc) · 2.55 KB
/
Copy pathscatterplot_remote.mo.py
File metadata and controls
100 lines (83 loc) · 2.55 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
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
import marimo
__generated_with = "0.18.4"
app = marimo.App(width="medium")
@app.cell
def _():
from pluot import render_to_image, render_to_svg
import numpy as np
import marimo as mo
import json
import zarr
return mo, render_to_image, zarr
@app.cell
def _():
from obstore.store import HTTPStore
return (HTTPStore,)
@app.cell
def _(HTTPStore, zarr):
obs_store = HTTPStore.from_url("https://pub-adb3658c8ed642caa534fdc612cd1c0c.r2.dev/gaussian_quantiles.zarr")
store = zarr.storage.ObjectStore(obs_store, read_only=True)
return (store,)
@app.cell
def _(store, zarr):
arr = zarr.open_array(store=store, mode='r', path="/n_1000000/x_coords")
arr.shape
return
@app.cell
def _():
camera_view = [
0.15, 0.0, 0.0, 0.0,
0.0, 0.15, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
]
return (camera_view,)
@app.cell
async def _(camera_view, point_radius_slider, render_to_image, store):
await render_to_image(
camera_view=camera_view, width=600, height=600, plot_id="test_store_instance", plot_type="LayeredPlot",
margin_left=100,
margin_bottom=100,
store=store,
plot_params=dict(
layers=[
dict(
layer_type="ZarrPointLayer",
layer_params=dict(
layer_id="zarr_layer",
data_unit_mode_x="Data",
data_unit_mode_y="Data",
point_radius_unit_mode_x="Pixels",
point_radius_unit_mode_y="Pixels",
point_shape_mode="Circle",
x_key="/n_1000000/x_coords",
y_key="/n_1000000/y_coords",
color_key="/n_1000000/class_labels",
point_radius=point_radius_slider.value,
)
),
dict(
layer_type="AxisLinearLayer",
layer_params=dict(
layer_id="left_axis",
position="Left"
)
),
dict(
layer_type="AxisLinearLayer",
layer_params=dict(
layer_id="bottom_axis",
position="Bottom"
)
)
]
),
)
return
@app.cell
def _(mo):
point_radius_slider = mo.ui.slider(start=1.0, stop=20.0, value=10.0)
point_radius_slider
return (point_radius_slider,)
if __name__ == "__main__":
app.run()