-
Notifications
You must be signed in to change notification settings - Fork 23
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
How to handle errors due to changing the underlying graph with node/edge properties given as vectors? #92
Comments
Very good question! Short answer: no. Longer answer: changing the size of objects is often much more complicated because of the dependency graph between the observables. For example, if you change the number of edges that will trigger a replot of the graph which will read the I'd like this all to work but is very tedious to implement and to test because there are so many possible combinations. Feel free to make PRs or if you don't really now you can also post self contained test code here and i'll try to have a look on how to fix that. The error you just showed is a bit more complicated: if you use "curvy" lines, internally every edge is draw using a separat Line 557 in 061addf
The good news is: one would only need to update the MWE to start working on that error would be using GraphMakie
using GraphMakie: Line, beziersegments
pathes=Observable([Line(Point2f(0,0), Point2f(1,0)),
Line(Point2f(0,1), Point2f(1,1))])
fig, ax, p = beziersegments(pathes)
push!(pathes[], GraphMakie.Line(Point2f(0,.5), Point2f(0,.5)))
notify(pathes) # errors EDIT: A more pragmatic simpler solution might be to detect changes in the number and then delete ALL line plots and reinitialize the complete |
Thank you! This is really helpful. Actually, I have tried your approach on deleting the entire Now I know that GraphMakie does not support this kind of usage. Maybe I will try the most straightforwad way: replot and re-construct my whole control panel, as my graph is really small (no more than 1000 nodes, typical number of nodes is 5 - 20). |
I am trying to build a small app which supports user add/remove nodes and edges, or loading new graphs from somewhere else. Some node and edge properties are given as vectors. Meanwhile, I do not want to re-plot such that will invalidate all my controls (Sliders and Toggles).
In the docstring of
graphplot
recipe, it states thatDoes it mean I will encounter such errors when I change the underlying graphs. Indeed, when I simply do
GraphMakie emits errors. I notice that these errors are mainly caused by lines below
It seems that
disc
is not an Observable (N
is not). Therefore, whenp[:paths]
updates,disc
is still the old one, thus its length is wrong.Is there any simple way to avoid such errors? Or GraphMakie has to be rewritten in a fundamental way to support my use case?
The text was updated successfully, but these errors were encountered: