Saving GraphMakie figure

I have a question about GraphMakie.jl. I have created a graph using Graphs.jl with Interaction Interface on jupyter notebook and i want to save the figure by protecting interaction. How can i handle that problem?

What do you mean by “protecting interaction”? You can save the file as png, svg or pdf at the current state after interactively changing it, but the resulting saved fields wouldn’t be interactive anymore. In that sense, you cannot “save” the figure while protecting the interactivity.

Or did you “fine tune” the graphics, for example the node positions, manually, and now want to bake those into the jupyter notebook? In that case you’d need to hardcode the state after the manual transformation to alter the initial plot.
For example lets say you change the node positions interactively:

fig, ax, p = graphplot(...)
# add interactions
# change figures interactively
# print out the final "node position" after interaction
p[:node_pos][] # prints out the current positions

And the hardcode those positions in the notebooke, i.e.

nodepos = [(..,..), (..,..), ...]
fig, ax, p = graphplot(... ; layout = nodepos)
1 Like

or serialize the Figure using JLD2. Not future proof, but at least you will be able to load the interactive figure in a new julia session.

2 Likes