Resolve "Modularize Graph Plotting"

What does this MR do?

This MR implements the GraphPlot class.

Summary & Features:
  • GraphPlot handles the drawing of a single networkx graph (a reference is stored as class attribute).
  • The data is set at initialization, drawing kwargs may be updated later either using the public parse_* methods or by providing drawing kwargs to the drawing method. The configuration updates in GraphPlot.draw are only temporary, the original (initialization) drawing configuration is restored afterwards.
  • The graph argument of the draw_graph plot function can either be a nx.Graph or a xr.DataArray. In the case of the latter, this array can be used for animations. But if animation is not enabled (and for the single plot which is performed before the animation generator is entered), the first graph in the DataArray is drawn automatically.
  • All animation-related things (e.g. generating the different frames) are done in the plot functions:
    • Animations can be defined either by directly passing a DataArray of graphs or by using a GraphGroup and providing selectors. The latter are no longer restricted to the time dimension, but any sel and isel selector can be given (the Cartesian product is then taken). The animation_kwargs.times argument is deprecated.
    • With the more general selection interface, the suptitle format string which can be provided via suptitle_kwargs.title now has to contain placeholders without keys and has to contain one placeholder for each dimension in the selectors.
  • As follow-up: facet grid graph plotting. Perhaps two options/functions: (1) select different graphs from the graph group (different coordinates on different axes), (2) plot the same graph with different drawing kwargs.

Is there something that needs to be double checked?

  • Check the output plots and ensure that all features work as desired

Can this MR be accepted?

  • Implemented the changes
  • Added or extended tests
    • Extend/Adapt existing plotting tests
    • Perhaps add new test file to test the individual parts of the GraphPlot class?
  • Checked test code coverage on new and adjusted code
  • Added or updated documentation
    • Update graph.rst (not extended, just fixed)
  • Reasonably up-to-date with current master
  • Pipeline passing without warnings
  • Squash option set
  • Set labels to pick this MR into support branches
  • Approved by @blsqr and/or @herdeanu

Related issues

Closes #240 (closed)

Edited by Utopia Developers

Merge request reports

Loading