I'm trying to annotate a graph plot with associated data and analysis.
To do this, I'd like to use graph_plot as a subplot within a matplotlib
graphic, ideally inline within a Jupyter notebook and "%matplotlib inline".
Inline graph_plot works great by itself within Jupyter, but the graphs lack
annotation or related content within the same output cell.
Is there a way to get a graph_plot as a subplot within a matplotlib object?
Or some equivalent approach that would allow for general graphical
annotations of graph-tool graph plots?
# matplotlib with gt.graph_draw -- order important here
import matplotlib as mpl
mpl.use('cairo')
# %matplotlib inline
import matplotlib.pyplot as plt
import graph_tool.all as gt # , graph_tool
But if I embed this code in a Jupyter notebook with the magic line
"%matplotlib inline" uncommented, I do not get inline graphics, -- only a
return object pointer.
I'd greatly appreciate your thoughts if this Jupyter notebook capability
would/should be possible.
Graph-tool uses cairo for drawing, and hence it only interplays with
matplotlib when a cairo-compatible backend is being used. I believe that
with Jupyter notebooks a HTML canvas backend is used, which is not cairo...
It may be possible to force matplotlib to use a cairo-based image backend
instead, but I'm not sure.