Allow outsourcing graph creation from `.dag.graph` plot

Currently, the .dag.graph plot function requires a GraphGroup to be supplied to it and performs the graph creation itself. Sometimes, one has a more complex graph creation routine, which cannot be done within the plot function or by registering custom edge or node properties to it.

Proposal

  • Allow supplying a nx.Graph object directly to the plot function, thus skipping graph creation and property registration.
  • Stretch goal: if supplying not a single graph but an object-dtype xr.DataArray filled with nx.Graphs, perform an animation over each graph in that array.
    • We could restrict this to 1D, but it would be nice if it is not restricted to the time dimension.

Given the potentially large changes to the plot function itself, I'd propose to change the modularisation in draw_graph such that ...

  • Graph creation and graph drawing are separate functions
  • .dag.graph points to a wrapper function which either creates the graph and draws it (i.e.: the existing plot function) or takes the given graph objects and draws them (the new plot function)

Related

!203 (merged) #240 (closed)