When you use matplolib you should use the pylab APIs. this is because they assume a persistant state to emulate a matlab notebook. This persistance is a problem in web applications. First of all you have many concurrent requests and they may interere with each other (not sure but I do not know how pylab is implemented) and if you use it in a module the state may be lost. Use the matplotlib API instead.
On Thursday, 4 April 2013 10:49:05 UTC-5, software.ted wrote: > > I have installed matplotlib but when i try: > > from pylab import * > > > am having this error: > > >>> from pylab import * > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File > "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pylab.py", > > line 1, in <module> > from matplotlib.pylab import * > File > "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pylab.py", > > line 222, in <module> > from matplotlib import mpl # pulls in most modules > File > "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/mpl.py", > > line 1, in <module> > from matplotlib import artist > File > "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py", > > line 7, in <module> > from transforms import Bbox, IdentityTransform, TransformedBbox, \ > File > "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/transforms.py", > > line 35, in <module> > from matplotlib._path import (affine_transform, > count_bboxes_overlapping_bbox, > ImportError: > dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so, > > 2): no suitable image found. Did find: > /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so: > > no matching architecture in universal wrapper > > > I am trying to use it to draw a pie chart as in this example > > from pylab import * > # make a square figure and axesfigure(1, figsize=(6,6))ax = axes([0.1, 0.1, > 0.8, 0.8]) > # The slices will be ordered and plotted counter-clockwise.labels = 'Frogs', > 'Hogs', 'Dogs', 'Logs'fracs = [15, 30, 45, 10]explode=(0, 0.05, 0, 0) > pie(fracs, explode=explode, labels=labels, > autopct='%1.1f%%', shadow=True, startangle=90) > # The default startangle is 0, which would start > # the Frogs slice on the x-axis. With startangle=90, > # everything is rotated counter-clockwise by 90 degrees, > # so the plotting starts on the positive y-axis. > title('Raining Hogs and Dogs', bbox={'facecolor':'0.8', 'pad':5}) > show() > > -- > > ....................................................................................... > Teddy Lubasi Nyambe > Opensource Zambia > Lusaka, ZAMBIA > > Cell: +260 97 7760473 > website: http://www.opensource.org.zm > > ~/ > Human Knowledge belongs to the world! - AntiTrust > > Man is a tool-using animal. Without tools he is nothing, with tools he is > all - Thomas Carlyle 1795-1881 > > /~ > -- --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.