Skip to content

Update Plotly to 3.3.1 and add heatmap click event - #8255

Merged
mscolnick merged 5 commits into
marimo-team:mainfrom
nojaf:update-plotly
Feb 10, 2026
Merged

Update Plotly to 3.3.1 and add heatmap click event#8255
mscolnick merged 5 commits into
marimo-team:mainfrom
nojaf:update-plotly

Conversation

@nojaf

@nojaf nojaf commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

📝 Summary

Add support for click events on plotly heatmaps and upgrade plotly.js to v3.

🔍 Description of Changes

This PR has two parts:

Step 1: Upgrade plotly.js from v2 to v3

Updated plotly.js from ^2.35.3 to ^3.3.1. This builds on top of #8238 which replaced react-plotly.js with a vendored Plot component. The v3 upgrade results in a smaller bundle (plotly chunk went from ~11 MB to ~4.8 MB) and no longer produces any buffer-related build warnings.

Step 2: Add heatmap click support

Heatmaps don't support box/lasso selection (onSelected), so clicking a cell previously did nothing. This adds:

  • A plotly_click event listener in the vendored Plot component (Plot.tsx).
  • An onClick handler in PlotlyPlugin.tsx, guarded to only process heatmap traces so it doesn't interfere with the existing onSelected flow for scatter/bar/line charts.
  • A fallback in extractPoints that picks standard point keys (x, y, z, etc.) directly from the point data for heatmaps, instead of relying on the hovertemplate parser. The parser doesn't work for heatmaps because they either have no hovertemplate or use a format (e.g. Day: %{x}) that the parser's key=%{selector} regex doesn't match.

A heatmap section was added to the existing plotly_example.py smoke test for manual QA.

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Tests have been added for the changes made.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Pull request title is a good summary of the changes - it will be used in the release notes.

//cc @mscolnick

@vercel

vercel Bot commented Feb 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Feb 10, 2026 9:26am

Request Review

@mscolnick
mscolnick merged commit 1e0240b into marimo-team:main Feb 10, 2026
39 checks passed
@nojaf nojaf mentioned this pull request Feb 10, 2026
5 tasks
@ubertidavide

Copy link
Copy Markdown

Hello, I've opened an upstream PR on Plotly.js that natively solves the missing heatmap event payload issue at the core library level: #7920 - fix(heatmap): add eventData handler for proper click event data
Once merged in Plotly.js, plotly_click events will natively expose 2D matrix coordinates pointNumber: [row, col] and z values, eliminating the need for custom frontend extractPoints workarounds!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants