fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
4.92k stars 284 forks source link

Integrating Makie's new SpecApi #2706

Open SimonDanisch opened 8 months ago

SimonDanisch commented 8 months ago

Makie is getting a declarative API in https://github.com/MakieOrg/Makie.jl/pull/3113, which should work much better with the way Pluto creates animations. From Makie's side everything is there to make for a nice integration, but it's still an open question how to hook it up with Pluto. To render the following efficiently:

begin 
    @bind markersize PlutoUI.Slider(5:15)
end
begin
   S.Figure([ S.Axis(plots = [S.scatter(1:4; markersize=markersize)] )])
end

I need something like this in pseydo code:

obs = Observable(S.Figure([ S.Axis(plots = [S.scatter(1:4; markersize=markersize)] )]))
display(plot(obs)) # display on first cell invokation

on(cell_update) do cell_content
     obs[] = cell_content
end
# dont display anything again, just update the internal object

In other words, I need to be able to display my plot only one time, and after that only update an Makie "internal" object with the new values of that cell.

Is this possible in any way?

fonsp commented 8 months ago

That's awesome! A declarative API is really helpful, I'm sure we can make something work.

What happens when you set obs[] = ..., is that update sent with a separate JSServe connection to the frontend? It is important that the cell does not re-render the HTML and Githubissues.

  • Githubissues is a development platform for aggregating issues.