gorilla-repl icon indicating copy to clipboard operation
gorilla-repl copied to clipboard

Force directed graphs

Open paul-english opened this issue 10 years ago • 5 comments

Vega allows force-directed graphs, http://trifacta.github.io/vega/editor/index.html?spec=force

It would be nice to make use of these within gorilla-repl.

What needs to be done to add a new type of plot?

paul-english avatar Apr 21 '14 06:04 paul-english

Yes, this would be great. I think it's just a matter of coming up with some functions, probably in the gorilla-plot ns, which generate the appropriate vega data structures from clojure data. It kind of depends on what we want to be able to plot. I think Vega wants to work with nodes and edges - data in that format already would be very easy. Other data (say the adjacency matrix example you raised on #87) would need to be processed on the clojure side into node/edge lists.

JonyEpsilon avatar Apr 25 '14 11:04 JonyEpsilon

I had a chance to look at this a bit earlier in the week, and had something basic rendering. I'll improve it and see if I can get a pull request for you.

paul-english avatar Apr 25 '14 16:04 paul-english

That would be great, thanks!

JonyEpsilon avatar Apr 25 '14 23:04 JonyEpsilon

Just had a look at loom-gorilla it's great.

Here's a start to using vega's force layout just using example data.

http://viewer.gorilla-repl.org/view.html?source=github&user=log0ymxm&repo=gorilla-worksheets&path=src/drawing-graphs.clj

paul-english avatar Apr 27 '14 20:04 paul-english

That's really neat. It would definitely be good to have something like that in gorilla-plot.

I was doing some idle googling the other day, and came across this:

https://github.com/cpettitt/dagre-d3

It has a very OO interface, but looks pretty useful. In particular, it gives more control over the layout, which would be nice (I've been meaning to write a function to display sexprs as trees, and I don't think the force-directed layout would be very clear!)

JonyEpsilon avatar Apr 28 '14 10:04 JonyEpsilon