Re: [Matplotlib-users] Saving as eps file shifts image?

2010-07-27 Thread Jae-Joon Lee
I tried a simple array (see the code below) but cannot reproduce the
problem you reported.

import matplotlib.pyplot as plt
import numpy as np

arr = np.zeros((11, 11), dtype=d)
arr[3,3]=1
im = plt.imshow(arr, interpolation=nearest, origin=lower)
cont = plt.contour(arr, levels=[0.5])
plt.savefig(a.eps)

Do you still see the shift with the above example code?
And what version of matplotlib are you using?

If possible, please post a complete script with the data (use a
mock-up data if you want)?
Regards,

-JJ



On Fri, Jul 23, 2010 at 12:16 AM, Jenna Lemonias
je...@astro.columbia.edu wrote:
 No, I don't think the issue is a flip in the y-axis.  I have a number of
 different examples of this, and many in which the contour is an ellipse so I
 can tell that the overall positioning is correct.  It seems like something
 is going wrong only when I save the image...  Thanks for the suggestion
 though!

 Jenna

 On Wed, Jul 21, 2010 at 3:40 PM, Jenna Lemonias
 je...@astro.columbia.eduwrote:

 I am trying to save a matplotlib 2d array image with an overlaid contour
 as
 an eps file.  The contour appears to be shifted with respect to the image
 underneath in the eps file, particularly when I zoom in on the image.
 This
 shift is not noticeable in the plot within matplotlib.

 I am using imshow to display the image.  The contour is created by
 plotting
 a list of closely-spaced x,y coordinates.  The attached file
 matplotlib.png
 is a screenshot of the (zoomed-in) image as displayed by matplotlib.  The
 attached file epsfile.png is a screenshot of the (zoomed-in) eps file.
 When
 I save this image as an eps file, it is actually 1 of 20 subplots and the
 shift is noticeable in each subplot.

 Thanks in advance for your help!

 Jenna


 Just as a wild guess, could this actually be an issue with how imshow uses
 the upper-left corner for (0,0)?  I have seen 1-pixel shifts before, but
 this shift is a little dramatic and I am left wondering if what we are
 really seeing is that the contour that is desired should actually be fliped
 in the y-axis?

 Maybe you could try another example where you try to draw a contour further
 away from the center of the image and see if it still goes in the spot you
 expect it to be?

 Ben Root

 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Case stories of software including Matplotlib

2010-07-27 Thread German Ocampo
Good morning

Do you know where I could get examples of case stories about
commercial or open source software that has been developed using the
Matplotlib library?

Many Thanks

German

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] error AttributeError: 'module' object has no attribute 'use'

2010-07-27 Thread Jae-Joon Lee
On Sun, Jul 25, 2010 at 3:55 PM, Satish Raghunath qgu...@my.utsa.edu wrote:
   AttributeError: 'module' object has no attribute 'use' 

It means that the module object (matplotlib) has no attribute named use.
This kind of error is often encountered when wrong module is imported
as matplotlib.

Try

 import matplotlib
 print matplotlib.__file__

and see if the output correctly points the location where the
matplotlib is installed.

Regards,

-JJ

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] matplotlib subplot2grid and projection

2010-07-27 Thread bbarton

Hi Everyone,

I am working on a weather conditions plot containing wind speed and
direction. For that I use a custom polar projection. Now updated from
Matplotlib 0.99 to 1.0 to use the subplot2grid feature.

Now, after trying and searching for hours, I seem to be too dumb to combine
my custom projection and subplot2grid. Before it did this way:

ax1=plt.figure().add_subplot(111, projection='northpolar')

But now I need sth like:

ax2 = plt.subplot2grid((5,5), (2,3), colspan=2, rowspan=3)

subplot2grid doesn't like a projection keyword.
How can I implement my projection? 

Thanks!
BB





-- 
View this message in context: 
http://old.nabble.com/matplotlib-subplot2grid-and-projection-tp29268717p29268717.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib.test() no errors, but $nosetest matplotlib.tests - errors and failure?

2010-07-27 Thread Michael Droettboom
Of course, we'll prefer to see all of the tests pass...

I'm surprised the two modes of running the tests gives different 
results.  Are you sure they are running the same python?  Does

python `which nosetests` matplotlib.tests

give you the same result as

nosetests matplotlib.tests

?

There must be some environmental difference between the two to cause the 
different results.

Mike

On 07/24/2010 05:09 PM, Adam wrote:
 Hello, I have just updated to v1.0.0 and am trying to run the test
 suite to make sure everything is ok.  There seems to be two different
 suites and I am not sure which is correct/current:

 $python -c 'import matplotlib; matplotlib.test()'
 [...snipped output...]
 Ran 138 tests in 390.991s
 OK (KNOWNFAIL=2)

 $nosetests matplotlib.tests I get:
 [...snipped output]
 Ran 144 tests in 380.165s
 FAILED (errors=4, failures=1)

 Two of these errors are the known failures from above, and the other
 two are in matplotlib.tests.test_text.test_font_styles:
 ImageComparisonFailure: images not close:
 /home/adam/result_images/test_text/font_styles.png vs.
 /home/adam/result_images/test_text/expected-font_styles.png (RMS
 23.833)
 ImageComparisonFailure: images not close:
 /home/adam/result_images/test_text/font_styles_svg.png vs.
 /home/adam/result_images/test_text/expected-font_styles_svg.png (RMS
 12.961)

 The module that fails is:

 FAIL: matplotlib.tests.test_mlab.test_recarray_csv_roundtrip
 --
 Traceback (most recent call last):
   File 
 /usr/local/lib/python2.6/dist-packages/nose-0.11.4-py2.6.egg/nose/case.py,
 line 186, in runTest
 self.test(*self.arg)
   File /usr/local/lib/python2.6/dist-packages/matplotlib/tests/test_mlab.py,
 line 24, in test_recarray_csv_roundtrip
 assert np.allclose( expected['x'], actual['x'] )
 AssertionError



 I am not sure of the importance level of these - but I wanted to ask
 to see if I should do anything or if they can safely be ignored.

 Thanks,
 Adam.

 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Case stories of software including Matplotlib

2010-07-27 Thread Benjamin Root
On Tue, Jul 27, 2010 at 6:01 AM, German Ocampo geroca...@gmail.com wrote:

 Good morning

 Do you know where I could get examples of case stories about
 commercial or open source software that has been developed using the
 Matplotlib library?

 Many Thanks

 German


German,

Interesting idea.  Might be something nice to add to the project page,
maybe?

Ben Root
--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Case stories of software including Matplotlib

2010-07-27 Thread German Ocampo
Benjamin

In my case, I'm in the process of selling Matplotlib at the interior
of the company for that I work, and it will be a strong point if I
could get references or recommendations from  commercial software or
institutions that had success using Matplotlib.

In my point of view, the idea to add this to the webpage will be a
very good first impression of the software.

regards,

German



On Tue, Jul 27, 2010 at 3:05 PM, Benjamin Root ben.r...@ou.edu wrote:
 On Tue, Jul 27, 2010 at 6:01 AM, German Ocampo geroca...@gmail.com wrote:

 Good morning

 Do you know where I could get examples of case stories about
 commercial or open source software that has been developed using the
 Matplotlib library?

 Many Thanks

 German


 German,

 Interesting idea.  Might be something nice to add to the project page,
 maybe?

 Ben Root



--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib.test() no errors, but $nosetest matplotlib.tests - errors and failure?

2010-07-27 Thread Michael Droettboom
Hmm... surprisingly, I am actually able to reproduce this sort of 
behaviour here.  I'll look into it further.

Mike

On 07/27/2010 09:49 AM, Michael Droettboom wrote:
 Of course, we'll prefer to see all of the tests pass...

 I'm surprised the two modes of running the tests gives different
 results.  Are you sure they are running the same python?  Does

  python `which nosetests` matplotlib.tests

 give you the same result as

  nosetests matplotlib.tests

 ?

 There must be some environmental difference between the two to cause the
 different results.

 Mike

 On 07/24/2010 05:09 PM, Adam wrote:

 Hello, I have just updated to v1.0.0 and am trying to run the test
 suite to make sure everything is ok.  There seems to be two different
 suites and I am not sure which is correct/current:

 $python -c 'import matplotlib; matplotlib.test()'
 [...snipped output...]
 Ran 138 tests in 390.991s
 OK (KNOWNFAIL=2)

 $nosetests matplotlib.tests I get:
 [...snipped output]
 Ran 144 tests in 380.165s
 FAILED (errors=4, failures=1)

 Two of these errors are the known failures from above, and the other
 two are in matplotlib.tests.test_text.test_font_styles:
 ImageComparisonFailure: images not close:
 /home/adam/result_images/test_text/font_styles.png vs.
 /home/adam/result_images/test_text/expected-font_styles.png (RMS
 23.833)
 ImageComparisonFailure: images not close:
 /home/adam/result_images/test_text/font_styles_svg.png vs.
 /home/adam/result_images/test_text/expected-font_styles_svg.png (RMS
 12.961)

 The module that fails is:

 FAIL: matplotlib.tests.test_mlab.test_recarray_csv_roundtrip
 --
 Traceback (most recent call last):
File 
 /usr/local/lib/python2.6/dist-packages/nose-0.11.4-py2.6.egg/nose/case.py,
 line 186, in runTest
  self.test(*self.arg)
File 
 /usr/local/lib/python2.6/dist-packages/matplotlib/tests/test_mlab.py,
 line 24, in test_recarray_csv_roundtrip
  assert np.allclose( expected['x'], actual['x'] )
 AssertionError



 I am not sure of the importance level of these - but I wanted to ask
 to see if I should do anything or if they can safely be ignored.

 Thanks,
 Adam.

 --
 This SF.net email is sponsored by Sprint
 What will you do first with EVO, the first 4G phone?
 Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

  

 --
 The Palm PDK Hot Apps Program offers developers who use the
 Plug-In Development Kit to bring their C/C++ apps to Palm for a share
 of $1 Million in cash or HP Products. Visit us here for more details:
 http://ad.doubleclick.net/clk;226879339;13503038;l?
 http://clk.atdmt.com/CRS/go/247765532/direct/01/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib subplot2grid and projection

2010-07-27 Thread Jae-Joon Lee
Thanks for reporting.
This is now fixed in r8581(maint branch) and r8582(trunk).
Meanwhile, you may define your own subplot2grid function and use it instead.

from matplotlib.gridspec import GridSpec
from matplotlib.pyplot import gcf, draw_if_interactive, delaxes

def mysubplot2grid(shape, loc, rowspan=1, colspan=1, **kwargs):

fig = gcf()
s1, s2 = shape
subplotspec = GridSpec(s1, s2).new_subplotspec(loc,
   rowspan=rowspan,
   colspan=colspan)
a = fig.add_subplot(subplotspec, **kwargs)
bbox = a.bbox
byebye = []
for other in fig.axes:
if other==a: continue
if bbox.fully_overlaps(other.bbox):
byebye.append(other)
for ax in byebye: delaxes(ax)

draw_if_interactive()
return a


You can use this function as

 ax = mysubplot2grid((3,3), (0,0), colspan=2, rowspan=2, projection=polar)

Regards,

-JJ


On Tue, Jul 27, 2010 at 2:06 AM, bbarton bastian.bar...@gmx.de wrote:

 Hi Everyone,

 I am working on a weather conditions plot containing wind speed and
 direction. For that I use a custom polar projection. Now updated from
 Matplotlib 0.99 to 1.0 to use the subplot2grid feature.

 Now, after trying and searching for hours, I seem to be too dumb to combine
 my custom projection and subplot2grid. Before it did this way:

 ax1=plt.figure().add_subplot(111, projection='northpolar')

 But now I need sth like:

 ax2 = plt.subplot2grid((5,5), (2,3), colspan=2, rowspan=3)

 subplot2grid doesn't like a projection keyword.
 How can I implement my projection?

 Thanks!
 BB





 --
 View this message in context: 
 http://old.nabble.com/matplotlib-subplot2grid-and-projection-tp29268717p29268717.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.


 --
 The Palm PDK Hot Apps Program offers developers who use the
 Plug-In Development Kit to bring their C/C++ apps to Palm for a share
 of $1 Million in cash or HP Products. Visit us here for more details:
 http://ad.doubleclick.net/clk;226879339;13503038;l?
 http://clk.atdmt.com/CRS/go/247765532/direct/01/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] PolyCollection API

2010-07-27 Thread Mathew Yeates
why doesn't this work?
xs=[0,0,8,8]
ys=[0,8,8,0]
verts=zip(xs,ys)
poly = PolyCollection(verts)


I tried
poly = PolyCollection([verts]) but that doesn't work either

-Mathew

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Case stories of software including Matplotlib

2010-07-27 Thread ms
On 27/07/10 15:05, Benjamin Root wrote:
 On Tue, Jul 27, 2010 at 6:01 AM, German Ocampogeroca...@gmail.com  wrote:

 Good morning

 Do you know where I could get examples of case stories about
 commercial or open source software that has been developed using the
 Matplotlib library?

 Many Thanks

 German


 German,

 Interesting idea.  Might be something nice to add to the project page,
 maybe?

I have no ready case story about it, but I developed and published a 
MPL-based open source software here:

http://code.google.com/p/hooke

which has been presented in a peer-reviewed academic publication on 
Bioinformatics ( 
http://bioinformatics.oxfordjournals.org/cgi/content/abstract/btp180?ijkey=B9QGeobopuepKnZkeytype=ref
 
)

If you need information to build a case story, ask me -perhaps I can 
help you if it's not too much work.

cheers,
M.

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PolyCollection API

2010-07-27 Thread Mathew Yeates
I installed matplotlib 1.0 and now I get a different error
s=[0,0,8,8]
ys=[0,8,8,0]
verts=zip(xs,ys)
poly = PolyCollection(verts)

fails at line 587 in collections because
xy = array([0, 0]) # xy.shape = (2,)
and line 587 says xy = np.concatenate([xy, np.zeros((1,2))])

What do I do?

-Mathew


On Tue, Jul 27, 2010 at 9:51 AM, Mathew Yeates mat.yea...@gmail.com wrote:
 why doesn't this work?
 xs=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)


 I tried
 poly = PolyCollection([verts]) but that doesn't work either

 -Mathew


--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Documentation error/bug?

2010-07-27 Thread Friedrich Romstedt
2010/7/26 Benjamin Root ben.r...@ou.edu:
 After some reading of sphinx documentation, it appears to be a bug with
 sphinx (or actually, smartypants) because it should not be doing this sort
 of interpretation within a docstring.  Anyway, supposedly the workaround is
 to put double backticks around the part that needs to be treated literally:
 ``'--'``.  I tried this out and built the docs locally and it works... sort
 of.  The text that is surrounded by double backticks are getting a different
 background color.  This doesn't look great to me.  Maybe someone else has a
 thought?

How looks a backticked empty string like?  If it is just nothing, it
could be used in between of the two hyphens, to separate them by
nothing.  Still very hackish ... But it's just like LaTeX -{}-.

Friedrich

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fit a plane to a set of xyz points

2010-07-27 Thread Friedrich Romstedt
2010/7/26 Mathew Yeates mat.yea...@gmail.com:
 Is there a simple function call for this? And finding the distance of
 a point to the plane?

Hmm, when you are interested in the z distance alone, it should be a
matrix equation:

Z = X * m_x + Y * m_y + 1 * n

Meaning you can invert it with Moore-Penrose pseudoinversion, i.e.,
numpy.lstsq()?

When you have weights on Z, normalise first.

Friedrich

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PolyCollection API

2010-07-27 Thread Eric Firing
On 07/27/2010 08:14 AM, Mathew Yeates wrote:
 I installed matplotlib 1.0 and now I get a different error
 s=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)

 fails at line 587 in collections because
 xy = array([0, 0]) # xy.shape = (2,)
 and line 587 says xy = np.concatenate([xy, np.zeros((1,2))])

 What do I do?

With 1.0:

In [8]: verts
Out[8]: [(0, 0), (0, 8), (8, 8), (8, 0)]

In [9]: p = PolyCollection([verts])

Eric


 -Mathew


 On Tue, Jul 27, 2010 at 9:51 AM, Mathew Yeatesmat.yea...@gmail.com  wrote:
 why doesn't this work?
 xs=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)


 I tried
 poly = PolyCollection([verts]) but that doesn't work either

 -Mathew


 --
 The Palm PDK Hot Apps Program offers developers who use the
 Plug-In Development Kit to bring their C/C++ apps to Palm for a share
 of $1 Million in cash or HP Products. Visit us here for more details:
 http://ad.doubleclick.net/clk;226879339;13503038;l?
 http://clk.atdmt.com/CRS/go/247765532/direct/01/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PolyCollection API

2010-07-27 Thread Tony S Yu

On Jul 27, 2010, at 2:14 PM, Mathew Yeates wrote:

 I installed matplotlib 1.0 and now I get a different error
 s=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)
 
 fails at line 587 in collections because
 xy = array([0, 0]) # xy.shape = (2,)
 and line 587 says xy = np.concatenate([xy, np.zeros((1,2))])
 
 What do I do?
 
 -Mathew
 


I don't really use PolyCollection, but the docstring suggests you need to put 
your verts inside of a list:
 *verts* is a sequence of ( *verts0*, *verts1*, ...) where
 *verts_i* is a sequence of *xy* tuples of vertices, or an
 equivalent :mod:`numpy` array of shape (*nv*, 2).
It's a bit confusing, but the first argument, verts, is actually a sequence, 
of a sequence, of vertices (the repetition is intentional). For example:

square = [(0, 0), (0, 4), (4, 4), (4, 0)]
triangle = [(0, 4), (0, 7), (4, 4)]
verts = [square, triangle]

In other words, the verts you created in your description describes a single 
polygon, where as verts should be a list of polygons.

-Tony
--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Case stories of software including Matplotlib

2010-07-27 Thread Tony S Yu

On Jul 27, 2010, at 1:31 PM, ms wrote:

 On 27/07/10 15:05, Benjamin Root wrote:
 On Tue, Jul 27, 2010 at 6:01 AM, German Ocampogeroca...@gmail.com  wrote:
 
 Good morning
 
 Do you know where I could get examples of case stories about
 commercial or open source software that has been developed using the
 Matplotlib library?
 
 Many Thanks
 
 German
 
 
 German,
 
 Interesting idea.  Might be something nice to add to the project page,
 maybe?
 
 I have no ready case story about it, but I developed and published a 
 MPL-based open source software here:
 
 http://code.google.com/p/hooke
 
 which has been presented in a peer-reviewed academic publication on 
 Bioinformatics ( 
 http://bioinformatics.oxfordjournals.org/cgi/content/abstract/btp180?ijkey=B9QGeobopuepKnZkeytype=ref
  
 )
 
 If you need information to build a case story, ask me -perhaps I can 
 help you if it's not too much work.
 
 cheers,
 M.


German, 

You might be interested in CellProfiler Analyst (http://www.cellprofiler.org/). 
Also, matplotlib is an optional dependency for FiPy 
(http://www.ctcms.nist.gov/fipy/).

Best,
-Tony--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PolyCollection API

2010-07-27 Thread Mathew Yeates
I still get the error
ValueError: arrays must have same number of dimensions
at line 587 in collections.py

This is on Windows.


On Tue, Jul 27, 2010 at 11:42 AM, Eric Firing efir...@hawaii.edu wrote:
 On 07/27/2010 08:14 AM, Mathew Yeates wrote:
 I installed matplotlib 1.0 and now I get a different error
 s=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)

 fails at line 587 in collections because
 xy = array([0, 0]) # xy.shape = (2,)
 and line 587 says xy = np.concatenate([xy, np.zeros((1,2))])

 What do I do?

 With 1.0:

 In [8]: verts
 Out[8]: [(0, 0), (0, 8), (8, 8), (8, 0)]

 In [9]: p = PolyCollection([verts])

 Eric


 -Mathew


 On Tue, Jul 27, 2010 at 9:51 AM, Mathew Yeatesmat.yea...@gmail.com  wrote:
 why doesn't this work?
 xs=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)


 I tried
 poly = PolyCollection([verts]) but that doesn't work either

 -Mathew


 --
 The Palm PDK Hot Apps Program offers developers who use the
 Plug-In Development Kit to bring their C/C++ apps to Palm for a share
 of $1 Million in cash or HP Products. Visit us here for more details:
 http://ad.doubleclick.net/clk;226879339;13503038;l?
 http://clk.atdmt.com/CRS/go/247765532/direct/01/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


 --
 The Palm PDK Hot Apps Program offers developers who use the
 Plug-In Development Kit to bring their C/C++ apps to Palm for a share
 of $1 Million in cash or HP Products. Visit us here for more details:
 http://ad.doubleclick.net/clk;226879339;13503038;l?
 http://clk.atdmt.com/CRS/go/247765532/direct/01/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Axes3D depth problem

2010-07-27 Thread copyrights
Hallo,

I got a depth problem with Axes3D. I made a plot_surface and add 2 Circle 
object with add_patch and mpl_toolkits.mplot3d.art3d.patch_2d_to_3d.

The problem is that the circles are always in front. I upload a picture here 
http://yfrog.com/nd3dproblemp . The gui is rotatable, so I can't just remove 
the second Circle (like I did for the screenshot).  

How to get right order to the object?

greetz

Frank

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PolyCollection API

2010-07-27 Thread Eric Firing

On 07/27/2010 08:55 AM, Mathew Yeates wrote:

I still get the error
ValueError: arrays must have same number of dimensions
at line 587 in collections.py


I think you are not actually doing what you think you are doing, and 
what was explained by Tony.


Try the attached script.

Eric



This is on Windows.


On Tue, Jul 27, 2010 at 11:42 AM, Eric Firingefir...@hawaii.edu  wrote:

On 07/27/2010 08:14 AM, Mathew Yeates wrote:

I installed matplotlib 1.0 and now I get a different error
s=[0,0,8,8]
ys=[0,8,8,0]
verts=zip(xs,ys)
poly = PolyCollection(verts)

fails at line 587 in collections because
xy = array([0, 0]) # xy.shape = (2,)
and line 587 says xy = np.concatenate([xy, np.zeros((1,2))])

What do I do?


With 1.0:

In [8]: verts
Out[8]: [(0, 0), (0, 8), (8, 8), (8, 0)]

In [9]: p = PolyCollection([verts])

Eric



-Mathew


On Tue, Jul 27, 2010 at 9:51 AM, Mathew Yeatesmat.yea...@gmail.comwrote:

why doesn't this work?
xs=[0,0,8,8]
ys=[0,8,8,0]
verts=zip(xs,ys)
poly = PolyCollection(verts)


I tried
poly = PolyCollection([verts]) but that doesn't work either

-Mathew
from matplotlib.collections import PolyCollection
poly0_verts = [(0, 0), (0, 8), (8, 8), (8, 0)]
polys_verts = [poly0_verts] # only one poly in the collection
p = PolyCollection(polys_verts)
--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axes3D depth problem

2010-07-27 Thread Benjamin Root
On Tue, Jul 27, 2010 at 2:25 PM, copyrig...@gmx.de wrote:

 Hallo,

 I got a depth problem with Axes3D. I made a plot_surface and add 2 Circle
 object with add_patch and mpl_toolkits.mplot3d.art3d.patch_2d_to_3d.

 The problem is that the circles are always in front. I upload a picture
 here http://yfrog.com/nd3dproblemp . The gui is rotatable, so I can't just
 remove the second Circle (like I did for the screenshot).

 How to get right order to the object?

 greetz

 Frank


Frank,

Could you please include a script that reproduces this?  There have been
some issues like this reported before, but it would only occur at certain
viewing angles.  Is this problem occurring regardless of what viewing angle
you are looking at the plot?  It would be useful to have an example that
*always* looks bad for fixing purposes.

Ben Root
--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PolyCollection API

2010-07-27 Thread Mathew Yeates
I tried
xs=[0,0,8,8]
ys=[0,8,8,0]
verts=zip(xs,ys)
poly = PolyCollection([verts])

already but it doesn't work

on line 581 of collections.py

there is
for xy in verts:

but
verts=[[(0, 0), (0, 8), (8, 8), (8, 0)]] i.e. a list with a single element.
so the loop  happens only once

-Mathew


On Tue, Jul 27, 2010 at 12:29 PM, Eric Firing efir...@hawaii.edu wrote:
 On 07/27/2010 08:55 AM, Mathew Yeates wrote:

 I still get the error
 ValueError: arrays must have same number of dimensions
 at line 587 in collections.py

 I think you are not actually doing what you think you are doing, and what
 was explained by Tony.

 Try the attached script.

 Eric


 This is on Windows.


 On Tue, Jul 27, 2010 at 11:42 AM, Eric Firingefir...@hawaii.edu  wrote:

 On 07/27/2010 08:14 AM, Mathew Yeates wrote:

 I installed matplotlib 1.0 and now I get a different error
 s=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)

 fails at line 587 in collections because
 xy = array([0, 0]) # xy.shape = (2,)
 and line 587 says xy = np.concatenate([xy, np.zeros((1,2))])

 What do I do?

 With 1.0:

 In [8]: verts
 Out[8]: [(0, 0), (0, 8), (8, 8), (8, 0)]

 In [9]: p = PolyCollection([verts])

 Eric


 -Mathew


 On Tue, Jul 27, 2010 at 9:51 AM, Mathew Yeatesmat.yea...@gmail.com
  wrote:

 why doesn't this work?
 xs=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)


 I tried
 poly = PolyCollection([verts]) but that doesn't work either

 -Mathew

 --
 The Palm PDK Hot Apps Program offers developers who use the
 Plug-In Development Kit to bring their C/C++ apps to Palm for a share
 of $1 Million in cash or HP Products. Visit us here for more details:
 http://ad.doubleclick.net/clk;226879339;13503038;l?
 http://clk.atdmt.com/CRS/go/247765532/direct/01/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PolyCollection API

2010-07-27 Thread Eric Firing
On 07/27/2010 09:43 AM, Mathew Yeates wrote:
 I tried
 xs=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection([verts])

 already but it doesn't work

Yes, I saw you say that, but---did you actually try running the script I 
attached?

Please run it from the command line (python pctest.py), and if it 
fails, send the traceback.

Eric


 on line 581 of collections.py

 there is
 for xy in verts:

 but
 verts=[[(0, 0), (0, 8), (8, 8), (8, 0)]] i.e. a list with a single element.
 so the loop  happens only once

 -Mathew


 On Tue, Jul 27, 2010 at 12:29 PM, Eric Firingefir...@hawaii.edu  wrote:
 On 07/27/2010 08:55 AM, Mathew Yeates wrote:

 I still get the error
 ValueError: arrays must have same number of dimensions
 at line 587 in collections.py

 I think you are not actually doing what you think you are doing, and what
 was explained by Tony.

 Try the attached script.

 Eric


 This is on Windows.


 On Tue, Jul 27, 2010 at 11:42 AM, Eric Firingefir...@hawaii.eduwrote:

 On 07/27/2010 08:14 AM, Mathew Yeates wrote:

 I installed matplotlib 1.0 and now I get a different error
 s=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)

 fails at line 587 in collections because
 xy = array([0, 0]) # xy.shape = (2,)
 and line 587 says xy = np.concatenate([xy, np.zeros((1,2))])

 What do I do?

 With 1.0:

 In [8]: verts
 Out[8]: [(0, 0), (0, 8), (8, 8), (8, 0)]

 In [9]: p = PolyCollection([verts])

 Eric


 -Mathew


 On Tue, Jul 27, 2010 at 9:51 AM, Mathew Yeatesmat.yea...@gmail.com
   wrote:

 why doesn't this work?
 xs=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)


 I tried
 poly = PolyCollection([verts]) but that doesn't work either

 -Mathew

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PolyCollection API

2010-07-27 Thread John Hunter
On Tue, Jul 27, 2010 at 2:50 PM, Eric Firing efir...@hawaii.edu wrote:
 On 07/27/2010 09:43 AM, Mathew Yeates wrote:
 I tried
 xs=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection([verts])

 already but it doesn't work

 Yes, I saw you say that, but---did you actually try running the script I
 attached?

 Please run it from the command line (python pctest.py), and if it
 fails, send the traceback.

The reason Eric suggests running it from the command line is because
if you are running a persistent python session with a current
figure/axes, the old, bad collection may still be residing in your
axes.  Running from the command line will insure a clean environment.
To test whether this explanation is correct, run plt.close('all')
before rerunning your code.  But do take Eric's suggestion to run from
the shell and post output.

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axes3D depth problem

2010-07-27 Thread copyrights
Hallo Ben Root,

I put together some snippets 

#CODE
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
import mpl_toolkits.mplot3d.art3d as art3d
from mpl_toolkits.mplot3d import Axes3D
import numpy
import matplotlib

step = 0.04
maxval = 1.0

fig = plt.figure()
ax = Axes3D(fig,aspect='equal')

ri = 0.625
rj = 1.25
l = 5

##CONE
r = numpy.linspace(rj,rj,6)
r[0]= numpy.zeros(r[0].shape)
r[1] *= ri/rj
r[5] *= ri/rj
r[3]= numpy.zeros(r[3].shape)

p = numpy.linspace(0,2*numpy.pi,50)
R,P = numpy.meshgrid(r,p)

X,Y = R*numpy.cos(P),R*numpy.sin(P)

tmp=list()
for i in range(50):
  tmp.append([0,0,l,l,l,0])
Z = numpy.array(tmp)
ax.plot_surface(X, Z,Y, rstride=1, cstride=1, color=b)

##CIRCLES
p=Circle((0,0),rj,color=red)
ax.add_patch(p)
art3d.patch_2d_to_3d(p, z=l, zdir=y)

p=Circle((0,0),ri,color=red)
ax.add_patch(p)
art3d.patch_2d_to_3d(p, z=0, zdir=y)

ax.set_ylim3d(-0.5, l+.5)
ax.set_xlim3d(-l*0.5-0.5, l*0.5+0.5)
ax.set_zlim3d(-l*0.5-0.5, l*0.5+0.5)

plt.show()
#CODE

greetz

Frank
Am 27.07.2010 21:36, schrieb Benjamin Root:
 On Tue, Jul 27, 2010 at 2:25 PM, copyrig...@gmx.de
 mailto:copyrig...@gmx.de wrote:
 
 Hallo,
 
 I got a depth problem with Axes3D. I made a plot_surface and add 2
 Circle object with add_patch and
 mpl_toolkits.mplot3d.art3d.patch_2d_to_3d.
 
 The problem is that the circles are always in front. I upload a
 picture here http://yfrog.com/nd3dproblemp . The gui is rotatable,
 so I can't just remove the second Circle (like I did for the
 screenshot).
 
 How to get right order to the object?
 
 greetz
 
 Frank
 
 
 Frank,
 
 Could you please include a script that reproduces this?  There have been
 some issues like this reported before, but it would only occur at
 certain viewing angles.  Is this problem occurring regardless of what
 viewing angle you are looking at the plot?  It would be useful to have
 an example that *always* looks bad for fixing purposes.
 
 Ben Root

--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Fit a plane to a set of xyz points

2010-07-27 Thread Joe Kington
On Tue, Jul 27, 2010 at 1:37 PM, Friedrich Romstedt 
friedrichromst...@gmail.com wrote:

 2010/7/26 Mathew Yeates mat.yea...@gmail.com:
  Is there a simple function call for this? And finding the distance of
  a point to the plane?

 Hmm, when you are interested in the z distance alone, it should be a
 matrix equation:

 Z = X * m_x + Y * m_y + 1 * n

 Meaning you can invert it with Moore-Penrose pseudoinversion, i.e.,
 numpy.lstsq()?

 When you have weights on Z, normalise first.

 Friedrich


Just one quick note on this:

If you fit Z = aX + bY + c, you won't be able to resolve vertical planes.
 Likewise, if you fit x = aY + Bz + c or y = aX + bZ + c you won't be able
to resolve horizontal planes.

If you need to robustly fit a plane to a point cloud, you'll need to try all
three formulations. See here for a quick example of what Friedrich mentioned
using all three formulations and choosing the most robust result:
http://code.google.com/p/python-geoprobe/source/browse/geoprobe/common.py#198

As far as finding the distance of a given point (x0, y0, z0) to the plane
defined by 0 = ax + by + cz + d, the equation is just abs(a * x0 + b * y0
+ c * z0 + d) / sqrt(a**2 + b**2 + c**2).  See
herehttp://mathworld.wolfram.com/Point-PlaneDistance.html for
a more detailed explanation.

-Joe
--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PolyCollection API

2010-07-27 Thread Mathew Yeates
your code works fine. But I thought it wasnt working because when I do
zs=[0,0.1,0.2,0.3]
#pdb.set_trace()
poly = PolyCollection([verts])
ax.add_collection3d(poly,zs=zs)

I just get a flat plane.

On Tue, Jul 27, 2010 at 12:50 PM, Eric Firing efir...@hawaii.edu wrote:
 On 07/27/2010 09:43 AM, Mathew Yeates wrote:
 I tried
 xs=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection([verts])

 already but it doesn't work

 Yes, I saw you say that, but---did you actually try running the script I
 attached?

 Please run it from the command line (python pctest.py), and if it
 fails, send the traceback.

 Eric


 on line 581 of collections.py

 there is
 for xy in verts:

 but
 verts=[[(0, 0), (0, 8), (8, 8), (8, 0)]] i.e. a list with a single element.
 so the loop  happens only once

 -Mathew


 On Tue, Jul 27, 2010 at 12:29 PM, Eric Firingefir...@hawaii.edu  wrote:
 On 07/27/2010 08:55 AM, Mathew Yeates wrote:

 I still get the error
 ValueError: arrays must have same number of dimensions
 at line 587 in collections.py

 I think you are not actually doing what you think you are doing, and what
 was explained by Tony.

 Try the attached script.

 Eric


 This is on Windows.


 On Tue, Jul 27, 2010 at 11:42 AM, Eric Firingefir...@hawaii.edu    wrote:

 On 07/27/2010 08:14 AM, Mathew Yeates wrote:

 I installed matplotlib 1.0 and now I get a different error
 s=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)

 fails at line 587 in collections because
 xy = array([0, 0]) # xy.shape = (2,)
 and line 587 says xy = np.concatenate([xy, np.zeros((1,2))])

 What do I do?

 With 1.0:

 In [8]: verts
 Out[8]: [(0, 0), (0, 8), (8, 8), (8, 0)]

 In [9]: p = PolyCollection([verts])

 Eric


 -Mathew


 On Tue, Jul 27, 2010 at 9:51 AM, Mathew Yeatesmat.yea...@gmail.com
   wrote:

 why doesn't this work?
 xs=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)


 I tried
 poly = PolyCollection([verts]) but that doesn't work either

 -Mathew

 --
 The Palm PDK Hot Apps Program offers developers who use the
 Plug-In Development Kit to bring their C/C++ apps to Palm for a share
 of $1 Million in cash or HP Products. Visit us here for more details:
 http://ad.doubleclick.net/clk;226879339;13503038;l?
 http://clk.atdmt.com/CRS/go/247765532/direct/01/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Axes3D depth problem

2010-07-27 Thread Benjamin Root
On Tue, Jul 27, 2010 at 3:10 PM, copyrig...@gmx.de wrote:

 Hallo Ben Root,

 I put together some snippets

 #CODE
 import matplotlib.pyplot as plt
 from matplotlib.patches import Circle
 import mpl_toolkits.mplot3d.art3d as art3d
 from mpl_toolkits.mplot3d import Axes3D
 import numpy
 import matplotlib

 step = 0.04
 maxval = 1.0

 fig = plt.figure()
 ax = Axes3D(fig,aspect='equal')

 ri = 0.625
 rj = 1.25
 l = 5

 ##CONE
 r = numpy.linspace(rj,rj,6)
 r[0]= numpy.zeros(r[0].shape)
 r[1] *= ri/rj
 r[5] *= ri/rj
 r[3]= numpy.zeros(r[3].shape)

 p = numpy.linspace(0,2*numpy.pi,50)
 R,P = numpy.meshgrid(r,p)

 X,Y = R*numpy.cos(P),R*numpy.sin(P)

 tmp=list()
 for i in range(50):
  tmp.append([0,0,l,l,l,0])
 Z = numpy.array(tmp)
 ax.plot_surface(X, Z,Y, rstride=1, cstride=1, color=b)

 ##CIRCLES
 p=Circle((0,0),rj,color=red)
 ax.add_patch(p)
 art3d.patch_2d_to_3d(p, z=l, zdir=y)

 p=Circle((0,0),ri,color=red)
 ax.add_patch(p)
 art3d.patch_2d_to_3d(p, z=0, zdir=y)

 ax.set_ylim3d(-0.5, l+.5)
 ax.set_xlim3d(-l*0.5-0.5, l*0.5+0.5)
 ax.set_zlim3d(-l*0.5-0.5, l*0.5+0.5)

 plt.show()
 #CODE

 greetz

 Frank
 Am 27.07.2010 21:36, schrieb Benjamin Root:
  On Tue, Jul 27, 2010 at 2:25 PM, copyrig...@gmx.de
  mailto:copyrig...@gmx.de wrote:
 
  Hallo,
 
  I got a depth problem with Axes3D. I made a plot_surface and add 2
  Circle object with add_patch and
  mpl_toolkits.mplot3d.art3d.patch_2d_to_3d.
 
  The problem is that the circles are always in front. I upload a
  picture here http://yfrog.com/nd3dproblemp . The gui is rotatable,
  so I can't just remove the second Circle (like I did for the
  screenshot).
 
  How to get right order to the object?
 
  greetz
 
  Frank
 


Thanks,

At first glance, I am wondering if the problem is that the Circle objects
are not properly getting a zsort value when converted to a 3d object.  I
will see if there is an inconsistency in behavior between different types of
patches.

Ben Root
--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PolyCollection API

2010-07-27 Thread Mathew Yeates
My bad. Since I wanted to draw a plane, I thought I wanted to use a
polygon. Instead, using plot_surface I get what I want.

-Mathew

On Tue, Jul 27, 2010 at 1:40 PM, Mathew Yeates mat.yea...@gmail.com wrote:
 your code works fine. But I thought it wasnt working because when I do
 zs=[0,0.1,0.2,0.3]
 #pdb.set_trace()
 poly = PolyCollection([verts])
 ax.add_collection3d(poly,zs=zs)

 I just get a flat plane.

 On Tue, Jul 27, 2010 at 12:50 PM, Eric Firing efir...@hawaii.edu wrote:
 On 07/27/2010 09:43 AM, Mathew Yeates wrote:
 I tried
 xs=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection([verts])

 already but it doesn't work

 Yes, I saw you say that, but---did you actually try running the script I
 attached?

 Please run it from the command line (python pctest.py), and if it
 fails, send the traceback.

 Eric


 on line 581 of collections.py

 there is
 for xy in verts:

 but
 verts=[[(0, 0), (0, 8), (8, 8), (8, 0)]] i.e. a list with a single element.
 so the loop  happens only once

 -Mathew


 On Tue, Jul 27, 2010 at 12:29 PM, Eric Firingefir...@hawaii.edu  wrote:
 On 07/27/2010 08:55 AM, Mathew Yeates wrote:

 I still get the error
 ValueError: arrays must have same number of dimensions
 at line 587 in collections.py

 I think you are not actually doing what you think you are doing, and what
 was explained by Tony.

 Try the attached script.

 Eric


 This is on Windows.


 On Tue, Jul 27, 2010 at 11:42 AM, Eric Firingefir...@hawaii.edu    
 wrote:

 On 07/27/2010 08:14 AM, Mathew Yeates wrote:

 I installed matplotlib 1.0 and now I get a different error
 s=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)

 fails at line 587 in collections because
 xy = array([0, 0]) # xy.shape = (2,)
 and line 587 says xy = np.concatenate([xy, np.zeros((1,2))])

 What do I do?

 With 1.0:

 In [8]: verts
 Out[8]: [(0, 0), (0, 8), (8, 8), (8, 0)]

 In [9]: p = PolyCollection([verts])

 Eric


 -Mathew


 On Tue, Jul 27, 2010 at 9:51 AM, Mathew Yeatesmat.yea...@gmail.com
   wrote:

 why doesn't this work?
 xs=[0,0,8,8]
 ys=[0,8,8,0]
 verts=zip(xs,ys)
 poly = PolyCollection(verts)


 I tried
 poly = PolyCollection([verts]) but that doesn't work either

 -Mathew

 --
 The Palm PDK Hot Apps Program offers developers who use the
 Plug-In Development Kit to bring their C/C++ apps to Palm for a share
 of $1 Million in cash or HP Products. Visit us here for more details:
 http://ad.doubleclick.net/clk;226879339;13503038;l?
 http://clk.atdmt.com/CRS/go/247765532/direct/01/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users