Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new plots to a figure in MakieWidget #14

Open
ZegCricket opened this issue Dec 18, 2023 · 2 comments
Open

Add new plots to a figure in MakieWidget #14

ZegCricket opened this issue Dec 18, 2023 · 2 comments

Comments

@ZegCricket
Copy link

ZegCricket commented Dec 18, 2023

Hello! I was experimenting with the library and wanted to replicate the examples/interactive.jl (adding new random plots to the figure) but for the case where I want to use the MakieWidget.

I am able to empty the figure and to change xlims! and ylims! by pressing a button, but, for some reason, it is not possible to add a new plot to it.

Here you can see the example I was trying to run:

using Gtk4Makie

box = GtkBox(:v)
button = GtkButton("click me")
label  = GtkMakieWidget()
push!(box, button)
push!(box, label)
win = GtkWindow(box, "Callbacks")

f = Figure()
ax = Axis(f[1, 1])
lines!(ax, rand(10))

push!(label, f)

scatter!(ax, rand(100))

function button_cb(widgetptr::Ptr, user_data)
     xlims!(user_data, 0, 100)
     empty!(user_data)
     scatter!(user_data, rand(100))
     nothing                  
end

signal_connect(button_cb, button, "clicked", Nothing, (), false, (ax))```
@jwahlstrand
Copy link
Member

You're right, that's totally broken! I have been using Observable inputs to create dynamic plots, but that only lets you do so much. Changing the figure in the widget should be possible too. I'll fix it ASAP.

@ZegCricket
Copy link
Author

Thank you for the quick reply! I was hoping that I was doing something wrong, since I'm quite new at Julia and Gtk4. But in this case I'll wait for the fix.
Thank you once again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants