ipycytoscape icon indicating copy to clipboard operation
ipycytoscape copied to clipboard

Ability to export/save graphs

Open ianhi opened this issue 4 years ago • 5 comments

It would be great to implement the cytoscape functions for saving the current view as an image https://js.cytoscape.org/#core/export

This may be tricky because if there are multiple views of the object that have diverged it's not clear which one should be used.

Related: I've now used this widget to create a graph I thought justified saving!

ianhi avatar May 19 '20 04:05 ianhi

This may be tricky because if there are multiple views of the object that have diverged it's not clear which one should be used.

Yeah, I just tested it and I had never noticed this. For some reason it only updates the first instance of the graph. I'm thinking if this was a regression of something we done recently, because afai remember we had all the instances of a graph synchronized. Maybe @wolfv knows why this kind of problem is happening? I created a screen recording of the problem: yell As you can see only the first instance updates. This shouldn't happen right? If I rerender the second instance than it also turns yellow.

Regarding adding the ability to do that, if this is an expected behavior we could just save the image of the first instance. (But I don't think it is).

marimeireles avatar Jun 24 '20 11:06 marimeireles

For saving: https://stackoverflow.com/a/39173400/835607

ianhi avatar Jul 08 '20 03:07 ianhi

Did you find a solution? I'm searching for a way to export images too. Additionally to PNG, it'd be great to have PDF or SVG for higher quality.

fpom avatar May 24 '22 12:05 fpom

@fpom have you taken a look into the different ways you can export a notebook? Not sure if it's useful for you as I imagine you want just the one output of a cell, correct? And sorry I haven't looked into it yet.

If you find some alternative in the "expanded universe" of Jupyter Widgets I'll be happy to hear about it and think about ways of integrating it! :)

marimeireles avatar May 24 '22 19:05 marimeireles

@fpom have you taken a look into the different ways you can export a notebook? Not sure if it's useful for you as I imagine you want just the one output of a cell, correct? And sorry I haven't looked into it yet.

Unfortunately, I need to export just one graph. Typically to be included in a paper.

If you find some alternative in the "expanded universe" of Jupyter Widgets I'll be happy to hear about it and think about ways of integrating it! :)

So far, screenshot remains the best solution. I've experimented with getting PNG directly from the canvas in JavaScript, but it does not give a better resolution than a simple screenshot.

fpom avatar May 25 '22 06:05 fpom