Replies: 5 comments 1 reply
-
Hi Dylan, Altair works on https://py.cafe already, because we support solara, which can render anything Jupyter can, e.g.: I wonder if an editor like you describe could be build using Solara/AnyWidget. We could also consider making a special Altair tile on our landing page (like we did with vizro), which would hide some of the wrapper code for setting up the editor. What is also interesting to know, is that PyCafe can store a preview image: These are visible from the user profile as well, e.g.: https://py.cafe/maartenbreddels/ We are also discussing with the Vizro developers to integrate into their docs. For instance, having an embedded code editor and embedded output in the documenation.
Let us know what you think, we are open to suggestions and feedback. Regards, Maarten |
Beta Was this translation helpful? Give feedback.
-
I wonder if this would make sense as a standalone PyScript app. See Altair example at https://pyscript.com/@examples/altair/latest. PyScript can interact with the dom directly (like in https://pyscript.com/@examples/d3-visualization/latest), so it should be possible to access the Vega view from Python in order to implement something like the data and signal explorers in the Vega editor. |
Beta Was this translation helpful? Give feedback.
-
Exciting idea! I would love to see something like the Vega editor for altair code, I think that would be useful also for the docs so that learners can interact with the code directly if there is something they want to try out. Panel's has set up their docs like that via pyodide and I tried to get it started previously in #2593, but the approaches here sound more promising, particularly the ability to inspect the transformed data. |
Beta Was this translation helpful? Give feedback.
-
Indeed, Jon, PyCafe does not allow you to interact directly with the DOM. It behaves nearly identically to a Python app, as if it did not run in pyodide/browser, including a normal To access the vega signals, you'd have to follow the usual route if you want to build this for Jupyter or Solara. This means adding support for signals in the JupyterChart widget. But then, it would run on any platform (Jupyter, Solara, Google Colab, etc.) including PyCafe. I did a simple proof of concept Altair Editor at: (PS: I just added a signals trait to the JupyterChart, and render only the signals using ipydatagrid - only now do I see there is some feature to read off the signals in the existing widget.) |
Beta Was this translation helpful? Give feedback.
-
Still a work-in-progress, but we're using https://github.com/pyscript/pyscript to interact with the DOM from the docs in #3630 (comment) 2024-10-14.15-08-04.WIP.Functional.PyScript.mp4It is a much simpler use-case, but may be helpful if anyone pursues that route |
Beta Was this translation helpful? Give feedback.
-
I would love the ability to share links to altair code + charts in a similar way to how we can with the vega editor.
This is particularly helpful when prototyping new visualizations as I can save the current version of a chart in a shareable way that others can remix. Could also be an easy way for people to get started writing altair code through an online editor that we can link to from the example galleries.
Some initial options could be a pyodide based editor like py cafe or a jupyterlite approach used by nblink. However, these approaches won't necessarily support altair-specific features likes showing signal or dataset values (re discussions with @jonmmease at SciPy). I find these feature instrumental when creating complex visualizations, and right now my workflow is to build the chart in the vega editor and then translate the syntax into altair after I'm finished.
Beta Was this translation helpful? Give feedback.
All reactions