john_helt
john_helt•3mo ago

Interactive plots with Plotly

I'm looking for a way to generate a plot based on a plotly canvas. I want to create a surface, by clicking on the canvas so that vertices of that surface can be defined. Later, I want to extract the vertices, to be able to fine tune them in my UI. Is that something I could do with Marimo?
Solution:
For mo.ui.plotly_chart, the only interaction we support out-of-the-box is selecting groups of points. See the docs for a demo/usage: https://docs.marimo.io/guides/plotting.html#plotly
Jump to solution
8 Replies
Solution
Akshay
Akshay•3mo ago
For mo.ui.plotly_chart, the only interaction we support out-of-the-box is selecting groups of points. See the docs for a demo/usage: https://docs.marimo.io/guides/plotting.html#plotly
Akshay
Akshay•3mo ago
You might be able to achieve what you want using Plotly's click event API directly. I haven't worked with it before, so YMMV. https://plotly.com/python/click-events/
Click
Click
roost
roost•3mo ago
Ahhh! I just spent about two hours trying to make an interactive plotly bar chart work. Any way this could be added to the documentation more explicitly? For the dumb folks like me 🙂
Akshay
Akshay•3mo ago
Ah, sorry about that! Yes, I can improve the documentation to make that more clear. Thanks for the suggestion If it helps, altair bar charts should be selectable
Akshay
Akshay•3mo ago
We're improving our docs. Thanks again for the suggestion, and sorry you lost a couple hours! https://github.com/marimo-team/marimo/pull/2510
GitHub
docs: mo.ui.plotly only supports selecting scatter plots by akshayk...
Address confusion from users, who suggested we improve our docs.
roost
roost•3mo ago
@Akshay I'm absolutely loving the tool. You've got a new promoter with me! The SQL integration is a game changer.
Akshay
Akshay•3mo ago
Woohoo! Thank you so much! I’m in the process of building out more bite size examples for SQL. Realize it’s not totally obvious how to connect to postgres, etc
roost
roost•3mo ago
Csv import was exactly what I needed. Everything else regarding duckdb and the handoffs to pythonwas straightforward for me!