[graph-tool] inline and output

Pietro Battiston ml at pietrobattiston.it
Fri Mar 21 15:37:03 CET 2014


Hi Tiago,

Il giorno ven, 21/03/2014 alle 00.01 +0100, Tiago de Paula Peixoto ha
scritto:
> On 03/20/2014 06:24 PM, Pietro Battiston wrote:
> > I saw - and happily tested - the new possibility of having inline
> > figures in the ipython notebooks.
> >
> > Unfortunately (for my typical usage, in which I both save figures and
> > show them in the notebook, which is easy with matplotlib and networkx),
> > it seems like setting the "inline" argument makes the "ouput" argument
> > irrelevant.
> >
> > Am I wrong? Is this an intended behaviour?
> 
> I didn't realize anyone would actually be doing this, but I see no
> reason not to. I've changed it now in the git version, so that the
> output is no longer ignored with inline == True.
> 

There was only a small problem for my typical workflow: I usually
produce figures in pdf, which however raises an error if I set
"inline=True", because it cannot be embedded in the webpage.

I solved this with a patch, that you may want to accept:
https://github.com/count0/graph-tool/pull/5


Another minor annoyance that I found with the inline ability is that it
is different from matplotlib and networkx in the fact that it must be
run as last.

That is, if you run a cell with the following content:

import networkx
g = networkx.random_graphs.complete_graph(5)
networkx.draw(g)
print "ciao"

... in the output you see both "ciao" and the network. If instead you
try

from graph_tool.all import *
g = complete_graph(5)
graph_draw(g, inline=True)
print("ciao")

... in the output you will only see "ciao".

I'm not expert in IPython internals, but I guess it should be simple to
solve.

Pietro




More information about the graph-tool mailing list