Not sure but look into https://github.com/mdipierro/canvas
On Saturday, 12 April 2014 04:10:42 UTC-5, Luis Fontes wrote: > > I am trying to plot a graph using NetworkX draw function but > using cStringIO.StringIO(). I have read > how to do it in web2py Application Development Cookbook. > > Let's say I have something like: > > import matplotlib.pyplot as plt > import networkx as nx > > G = nx.path_graph(8) > nx.draw(G) > plt.show() > > This code plots and shows the graph. Now, to place it in a web2py view I > should use a function like: > > > def mygraph() > fig=Figure() > > ..... > ..... > ..... > > canvas=FigureCanvas(fig) > stream=cStringIO.StringIO() > canvas.print_png(stream) > return stream.getvalue() > > The problem is how to place the plot generated by nx.path_graph(8) and > nx.draw(G) in the code in > blue in order to make it work. > > I am learning web2py and I am nor expert in NetworkX or matplotlib > packages. Sorry if my question > is stupid. > > Thank you. > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

