Skip to content

Commit 1d548b2

Browse files
koaningclaude
andauthored
Add configurable class count to ScatterWidget (#33)
* Add configurable class count to ScatterWidget Allow users to set n_classes (1-4) to configure the number of available classes. When n_classes=1, the class buttons are automatically hidden since they're unnecessary for single-class mode. Improve grid visibility in light mode. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * Relax altair version constraint for WASM compatibility Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * Remove ruff and altair from runtime dependencies These are dev/demo-only tools, not runtime dependencies. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * Remove uv.lock to avoid constraining downstream dependencies Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * Remove pandas from dependencies - it's a lazy import Users install pandas/polars/numpy if they want those features. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * Remove uv.lock again * Add uv.lock to .gitignore * Rebuild docs with updated marimo * cleanup * Bump version to 0.5.0 --------- Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent c90a855 commit 1d548b2

File tree

211 files changed

+102
-1488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

211 files changed

+102
-1488
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,5 @@ cython_debug/
158158
# and can be added to the global gitignore or merged into this file. For a more nuclear
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160160
esbuild
161-
.DS_Stores
161+
.DS_Stores
162+
uv.lock

CLAUDE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Development Notes
2+
3+
## Setup
4+
5+
Run `make install` to install esbuild (for bundling JavaScript) and project dependencies.
6+
7+
## Building JavaScript
8+
9+
After modifying files in `js/`, rebuild the bundles:
10+
11+
```bash
12+
./esbuild --bundle --format=esm --outfile=drawdata/static/scatter_widget.js js/scatter_widget.js
13+
```
14+
15+
Or use `make js` for watch mode during development.
16+
17+
## Dependencies
18+
19+
**NEVER add dev tools (ruff, pytest, etc.) or demo-only dependencies (altair, etc.) to the main `dependencies` list in pyproject.toml.** The library should only depend on what it actually needs at runtime: anywidget. Pandas, polars, and numpy are lazy imports - users install them if they want those features.

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ clean:
1818

1919

2020
docs:
21-
marimo -y export html-wasm --output docs --mode edit demo.py
21+
rm -rf docs
22+
uv run marimo -y export html-wasm --output docs --mode edit demo.py

demo.py

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import marimo
1212

13-
__generated_with = "0.13.6"
13+
__generated_with = "0.19.6"
1414
app = marimo.App(width="medium")
1515

1616

@@ -24,19 +24,17 @@ def _():
2424

2525
@app.cell(hide_code=True)
2626
def _(mo):
27-
mo.md(
28-
r"""
27+
mo.md(r"""
2928
# Drawing a `ScatterChart`
3029
3130
This notebook contains a demo of the `ScatterWidget` inside of the [drawdata](https://github.com/koaning/drawdata) library. You should see that as you draw data, that the chart below updates.
32-
"""
33-
)
31+
""")
3432
return
3533

3634

3735
@app.cell(hide_code=True)
3836
def _(ScatterWidget, mo):
39-
widget = mo.ui.anywidget(ScatterWidget(height=350))
37+
widget = mo.ui.anywidget(ScatterWidget(height=400, width=400))
4038
widget
4139
return (widget,)
4240

@@ -62,32 +60,23 @@ def _(mo, widget):
6260
color="color",
6361
)
6462

65-
top_hist = (
66-
base_bar
67-
.encode(
68-
alt.X("x:Q")
69-
# when using bins, the axis scale is set through
70-
# the bin extent, so we do not specify the scale here
71-
# (which would be ignored anyway)
72-
.bin(maxbins=30, extent=xscale.domain).stack(None).title(""),
73-
alt.Y("count()").stack(None).title(""),
74-
alt.Color("color:N", scale=colscale),
75-
)
76-
.properties(height=60)
77-
)
78-
79-
right_hist = (
80-
base_bar
81-
.encode(
82-
alt.Y("y:Q")
83-
.bin(maxbins=30, extent=yscale.domain)
84-
.stack(None)
85-
.title(""),
86-
alt.X("count()").stack(None).title(""),
87-
alt.Color("color:N"),
88-
)
89-
.properties(width=60)
90-
)
63+
top_hist = base_bar.encode(
64+
alt.X("x:Q")
65+
# when using bins, the axis scale is set through
66+
# the bin extent, so we do not specify the scale here
67+
# (which would be ignored anyway)
68+
.bin(maxbins=30, extent=xscale.domain)
69+
.stack(None)
70+
.title(""),
71+
alt.Y("count()").stack(None).title(""),
72+
alt.Color("color:N", scale=colscale),
73+
).properties(height=60)
74+
75+
right_hist = base_bar.encode(
76+
alt.Y("y:Q").bin(maxbins=30, extent=yscale.domain).stack(None).title(""),
77+
alt.X("count()").stack(None).title(""),
78+
alt.Color("color:N"),
79+
).properties(width=60)
9180

9281
out = top_hist & (points | right_hist)
9382

docs/assets/ConnectedDataExplorerComponent-FS-m-lCY.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/assets/VegaLite-D07JSyC_.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/assets/__vite-browser-external-CIEyP2s7.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/assets/_baseEach-DHNYGtOc.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/assets/_baseMap-BXW0_SVK.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/assets/_baseUniq-BlNMZyiw.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)