[web2py] Re: REF: Trying out matplotlib

2013-04-06 Thread Massimo Di Pierro
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 "", line 1, in 
>   File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pylab.py",
>  
> line 1, in 
> from matplotlib.pylab import *
>   File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pylab.py",
>  
> line 222, in 
> 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 
> from matplotlib import artist
>   File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py",
>  
> line 7, in 
> 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 
> 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.




Re: [web2py] Re: REF: Trying out matplotlib

2013-04-07 Thread Teddy Nyambe
Massimo, maybe to bring this issue to a close for me and others who may be
interested in using matplotlib in the shortest future, since you have
successfully used matplotlib could you post just a few lines of called
addressing challenges:

1. Installation of Matplotlib

On the Mac os x i did sudo pip install matplotlib it seemed to install well
the 1.2.1 version without a problem but import matplotlib is giving an error

2. After successful installation, how is matplot lib used in the web2py
controller modules what is the best practice...one or two lines of code
would surfice.

Kind regards,


On Sat, Apr 6, 2013 at 6:25 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> 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 "", line 1, in 
>>   File "/Library/Frameworks/Python.**framework/Versions/2.7/lib/**
>> python2.7/site-packages/pylab.**py", line 1, in 
>> from matplotlib.pylab import *
>>   File "/Library/Frameworks/Python.**framework/Versions/2.7/lib/**
>> python2.7/site-packages/**matplotlib/pylab.py", line 222, in 
>> 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 
>> from matplotlib import artist
>>   File "/Library/Frameworks/Python.**framework/Versions/2.7/lib/**
>> python2.7/site-packages/**matplotlib/artist.py", line 7, in 
>> 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 
>> 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.
>
>
>



-- 
...
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.