Spaces:
Sleeping
Sleeping
Commit History
-
Use if/else instead of early return in chart cells
melihorhanyilmazmarimo cell bodies treat 'return' as the export marker — only valid at the tail of the cell. The previous commit's early-return pattern crashed the notebook with 'invalid-syntax: return outside function'. Refactor the empty-filtered guards in Visual 2 and Visual 3 to use if/else with a single tail return.8b81992 -
Skip chart_selection on empty filtered dataframes
melihorhanyilmazRoot cause of intermittent HTTP 500 from /api/kernel/set_ui_element_value on Hugging Face Spaces: when the user drags slider handles to the same position (e.g. 0.81/0.81) the filter produces 0 rows, and building mo.ui.altair_chart with chart_selection / legend_selection on empty data crashes the marimo kernel. - Visual 1: skip selections when filtered is empty (kept as plain chart) - Visual 2: render placeholder markdown if filtered is empty; guard transform_regression when xmin == xmax - Visual 3: render placeholder markdown if filtered is emptyebd976a -
Pin Visual 1 axes to full-data extent; guard median lines on empty filter
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)The Vega 'Infinite extent for field total_richness: [Infinity, -Infinity]' warning was the trigger for marimo's HTTP 500 on slider moves: at narrow slider windows (e.g. Region=Ge with dominance 0.91-1) intermediate filter states briefly produce an empty filtered dataframe, so Vega can't compute axis extents and the spec compile blows up. Two defensive changes: - Pin scatter x and y to the full df's max (yield 0..max*1.05, richness 0..max*1.10) so axes never depend on the filtered subset. - Skip the median rules and quadrant labels when filtered is empty — median()/min()/max() return NaN on empty Series and that NaN flows into alt.datum() and breaks the spec. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>e63502a -
Use ASCII hyphen in dominance bucket labels
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)The en-dash in '0.80–0.90' / '0.90–0.95' was a strong suspect for the HTTP 500 the chart cell threw on every slider movement on Hugging Face Spaces — likely a JSON/serialization issue between marimo's backend and the embedded Vega-Lite spec when DOMINANCE_LABELS round-trips through the cell return. Swap to plain ASCII '-' to remove the variable from the equation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>3744991 -
Use transform_regression with explicit extent for Visual 2 trend
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)The numpy-based pre-compute introduced an internal/JS error on the Spaces deploy (likely from layering a second data source under a faceted chart). Roll back to Altair's transform_regression but pass extent=[xmin, xmax] explicitly so the regression line spans the full panel x-range — that was the original bug, not the regression itself. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>23730eb -
Pre-compute Visual 2 trend lines instead of transform_regression
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)transform_regression with groupby on faceted small-multiples was collapsing each line to a single tick — the regression's auto-extent didn't span the panel x-range. Replace it with an explicit numpy polyfit per group; build a small dataframe of (mean_yield, richness, group) regression points and overlay it as a regular dashed line. The output spans the full x-axis of each facet and is deterministic. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>4c37bd1
-
Sort site dropdown by region+number; rename placeholder
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)The dropdown was inheriting the dataframe's yield-rank ordering, so the list jumped Ge1 → Ge14 → Ge3 → Ge28 → Ge8 → Go27 → Ge23 — impossible to scan. Sort by (region, numeric site number) instead so it reads Ge1, Ge2, ... Ge30, Go1, ... Go30. Also drop the stale '(click a point in Visual 1)' placeholder for '(pick a site)' since point click was removed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>f20f878 -
Make dropdown the canonical site picker; remove broken click hint
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)Marimo's auto-attached chart_selection on a layered chart with multiple data sources doesn't reliably surface clicked rows in chart1.value, so the linked-detail panel never opened from a scatter click — only the dropdown actually works. Stop telling the user to click a point: the header text and the empty/multi-selection prompts now point to the dropdown only. Legend bucket clicks (which do work) keep their callout. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>3efa3c5 -
Suppress detail panel when multiple sites are filter-selected
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)Legend clicks (region or dominance bucket) populate chart1.value with every matching row, and the detail cell was blindly grabbing iloc[0]. Because the dataframe is sorted by yield_rank, that meant clicking 'Go' always surfaced the lowest-yield Go site, etc. — a misleading 'sample representative' that users mistook for something meaningful. Branch on selection size: 1 row → render the species bars; >1 row → tell the user how many sites the filter matches and prompt for a single pick. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>dd0a6a7 -
Revert encoding to dominance, keep the bucketed-legend pattern
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)Density's correlation with total richness is essentially zero (Pearson +0.03), while dominance carries the actual signal (-0.54, woody-richness Spearman -0.79) — and Finding 3 of the report depends on that signal. Switching back to dominance, but keeping the same fix that made the density legend work: pre-bin into <0.80 / 0.80-0.90 / 0.90-0.95 / >0.95 and encode the bucket as size, so the legend stays clickable for filtering. The slider still does fine-grained range filtering on the raw value. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>a9a4415
-
Bin coffee density into 4 buckets so legend clicks actually filter
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)Continuous density + legend_selection never matched a single site, and the stretched size scale made the outliers visually dominant. Pre-bin into <200 / 200–350 / 350–500 / >500, encode the bucket as size with a tight range (50–180), and include the bucket in legend_selection so clicking a legend entry filters to that density range. The slider at the top still does fine-grained range filtering on the raw value. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>6b59dec -
Restrict legend click-selection to region only
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)Clicking a coffee-density value in the size legend (e.g. 400) made every point fade, because legend_selection on a continuous encoding tries to match the exact value and no site hits it precisely. Region is the only categorical legend here, so scope selection to that field — size legend becomes purely informative, which is what it should be for a quantitative scale. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>b521064 -
Make size legend symbols opaque and stroke-free
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)The white 0.5px stroke and 0.75 opacity make small legend symbols look faded, even though the corresponding data points render fine. Override the legend's symbol style (solid mid-grey, no stroke, full opacity) so the four size steps read clearly; keep the in-plot marks unchanged so overlapping points stay distinguishable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>5b1b6c8 -
Tighten coffee-density size scale to make bubbles legible
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)Raw range (107–1101) is dominated by two outliers (Ge1=1101, Ge9=804). A linear scale on that range squashed the 95% of sites in 100–500 into near-uniform small dots. Cap the size scale at the 95th percentile (~700), switch to sqrt (area-proportional), and enumerate legend ticks at 100/200/400/600 so the visible gradient matches where the data lives. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>558a6e8 -
Replace coffee dominance with coffee density (better dynamic range)
melihorhanyilmaz +1: Claude Opus 4.7 (1M context)Dominance values cluster in 0.90–1.00 (85% of sites), making the slider and bubble-size channel visually uninformative. Coffee density per 30x30m plot spans 107–1101 with clear inter-region separation, so it encodes management intensity more legibly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>b2466cc
-
Add site-picker dropdown as robust fallback for click selection
melihorhanyilmaz58c3ee5 -
Deploy marimo notebook — Remote Group 2 coffee agroforests visualisation
melihorhanyilmaz50bab12