The final step in the tutorial that we’re trying to create, is to have brushing and linking functionality between different plots. This is actually the reason why we ended up going for panel.
What we are looking for in the end is to have brushing/linking between a node-link network diagram and a scatterplot of some metadata of the nodes. Brushing/linking is easy in VegaLite but you can’t create node-link diagrams in it; you can create these in Vega, but then brushing/linking is very complicated.
So it is my hope to be able to do this via panel: one pane with a Vega node-link diagram, and one pane with a VegaLite or Vega scatterplot. Hovering over a point in the scatterplot should highlight the corresponding node and vice versa.
I have created what I think is a minimal script for brushing/linking 2 scatterplots, by creating a simple version in VegaLite, taking the compiled Vega and removing as much as possible without it braking:
In order to make this work with the left plot being a force-directed node-link diagram, I can’t approach this in exactly the same way as with 2 scatterplots (my_selection_Miles_per_Gallon wouldn’t work, for example).
From this code, there are some things that I can’t find a lot of documentation about but which I think are crucial:
line 25: what does vlSelectionResolve do exactly?
line 149-153: why does this signal need the "channel": "x", "type": "R"? And what does the R stand for?
line 200: "modify(\"my_selection_store\", my_selection_tuple, true)" What does modify do exactly?
line 258: "vlSelectionTest(\"my_selection_store\", datum). This obviously tests if the datapoint is in my_selection_store. But how does it do that exactly? Looking at what my_selection_store looks like, it something like this: