Giter VIP home page Giter VIP logo

Comments (2)

hexaeder avatar hexaeder commented on July 18, 2024

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 color value for every edge. So you need to change the color vector first. But when you change the color vector this will trigger a update of the graph which migh errors because now you have more colors than edges.

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 lines plot. If one changes the number of lines one needs to add one of those plots or remove it from the axis. Looking at the source again it seems like i was aware of that limitation but didn't bother :D

TODO: Beziersegments plot won't work if the number of pathes changes.

The good news is: one would only need to update the beziergraphs recipe. One would probably need keep track of all the line plots and delete! and push! according to the changes.

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 beziersegments plot. Or even more pragmatic: delete! the graphplot from the axis and create a new graphplop whenever you change the graph. You don't need to reopen the whole figure for that.

from graphmakie.jl.

liuyxpp avatar liuyxpp commented on July 18, 2024

Thank you! This is really helpful. Actually, I have tried your approach on deleting the entire graphplot object (say p) and re-plot it. However, as my controls depends on the p instance. When I replot, there is no way (as I know) to preserve p (inplace modification), but a new graphplot will be returned by the graphplot! method. Therefore, all my controls lose track of the new graphplot object.

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).

from graphmakie.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.