Hi Daniel,

Ok, so it works as expected? Great.

No real need to also bring it up on mpl devel, since I'm the
maintainer of mplot3d anyway ;-)

If you can send me the working code for contourf when you have that
I'll add all of it soon.

Cheers,
Reinier

On Tue, Jul 20, 2010 at 5:41 PM, Daniel Welling <dantwell...@gmail.com> wrote:
> Reinier -
> This is exactly what I was looking for!  Thank you.
> I will try to get this to work with tricontourf now that I have your
> example; you should strongly consider bringing this up in the devel mailing
> list as including the tri- commands in the 3D kit may be useful to others as
> well (I can do so if you do not wish to spend any more time on this, but I
> will of course credit the fix to you.)
> To give you a better idea why this is useful, see the attached plot.  On the
> y=125, z=125 planes, I plot 2D slices of number density from a large scale
> fluid dynamics simulation.  In 3D, I will add 3D stream traces to
> characterize the flow around the obstacle.  Combining the 3D traces with the
> 2D slices is extremely useful; being able to make these kinds of plots
> quickly through MPL before going to something more powerful, such as Mayavi,
> is very convenient.
> -dw
>
> On Tue, Jul 20, 2010 at 6:32 AM, Reinier Heeres <rein...@heeres.eu> wrote:
>>
>> Hi Daniel,
>>
>> If you're using the mpl 1.0 or the svn version, you can try to
>> overwrite this file of mplot3d and run the attached modified version
>> of the example you sent. Can you tell me if this is the expected
>> result? For the projection on the planes normal to 'x' and 'y' it
>> doesn't look very appealing to me! (so I'm not sure it's correct)
>>
>> Cheers,
>> Reinier
>>
>> On Mon, Jul 19, 2010 at 11:06 PM, Daniel Welling <dantwell...@gmail.com>
>> wrote:
>> > Greetings, MPL Users.
>> > I have been experimenting with Axes3D with the hopes that I could create
>> > some 3d lines and then project some contours on different planes in the
>> > 3D
>> > axes object, much like the contour3d_demo3.py example (but with lines
>> > instead of the 3d wireframe.)  The catch, however, is creating the
>> > contour
>> > objects using tricontour instead of a regular contour.  Being that I
>> > typically use irregular grids for my research, the triangulate module
>> > has
>> > been a tremendous feature, but it doesn't seem to work with Axes3D
>> > objects.
>> > For example, this quick script:
>> > import matplotlib.pyplot as plt
>> > #import matplotlib.tri as tri
>> > import numpy as np
>> > from numpy.random import uniform, seed
>> > from mpl_toolkits.mplot3d import Axes3D
>> > seed(0)
>> > npts = 200
>> > ngridx = 100
>> > ngridy = 200
>> > x = uniform(-2,2,npts)
>> > y = uniform(-2,2,npts)
>> > z = x*np.exp(-x**2-y**2)
>> > # tricontour.
>> > fig = plt.figure()
>> > ax = Axes3D(fig)
>> > ax.tricontour(x, y, z, 15, zdir=x, offset=-2)
>> > plt.show()
>> > creates a huge traceback, listed below.
>> > Is it possible to combine tricontour with Axes3D?  It would appear that
>> > they
>> > are just incompatible, but perhaps there is a way to force it to work?
>> > Thanks for your help.
>> > tricont3d.py in <module>()
>> >      20 ax.tricontour(x, y, z, 15, zdir=x, offset=-2)
>> >      21
>> > ---> 22 plt.show()
>> >      23
>> >      24
>> > python2.6/site-packages/matplotlib/backends/backend_qt4.pyc in show()
>> >      69     figManager =  Gcf.get_active()
>> >      70     if figManager != None:
>> > ---> 71         figManager.canvas.draw()
>> >      72
>> >      73     if _create_qApp.qAppCreatedHere:
>> > python2.6/site-packages/matplotlib/backends/backend_qt4agg.pyc in
>> > draw(self)
>> >     128         if DEBUG: print "FigureCanvasQtAgg.draw", self
>> >     129         self.replot = True
>> > --> 130         FigureCanvasAgg.draw(self)
>> >     131         self.update()
>> >     132
>> > site-packages/matplotlib/backends/backend_agg.pyc in draw(self)
>> >     392
>> >     393         self.renderer = self.get_renderer()
>> > --> 394         self.figure.draw(self.renderer)
>> >     395
>> >     396     def get_renderer(self):
>> > python2.6/site-packages/matplotlib/artist.pyc in draw_wrapper(artist,
>> > renderer, *args, **kwargs)
>> >      53     def draw_wrapper(artist, renderer, *args, **kwargs):
>> >      54         before(artist, renderer)
>> > ---> 55         draw(artist, renderer, *args, **kwargs)
>> >      56         after(artist, renderer)
>> >      57
>> > python2.6/site-packages/matplotlib/figure.pyc in draw(self, renderer)
>> >     796         dsu.sort(key=itemgetter(0))
>> >     797         for zorder, func, args in dsu:
>> > --> 798             func(*args)
>> >     799
>> >     800         renderer.close_group('figure')
>> > python2.6/site-packages/mpl_toolkits/mplot3d/axes3d.pyc in draw(self,
>> > renderer)
>> >     152         # Calculate projection of collections and zorder them
>> >     153         zlist = [(col.do_3d_projection(renderer), col) \
>> > --> 154                  for col in self.collections]
>> >     155         zlist.sort()
>> >     156         zlist.reverse()
>> > AttributeError: 'LineCollection' object has no attribute
>> > 'do_3d_projection'
>> > WARNING: Failure executing file: <tricont3d.py>
>> >
>> > ------------------------------------------------------------------------------
>> > 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
>> >
>> >
>>
>>
>>
>> --
>> Reinier Heeres
>> Tel: +31 6 10852639
>
>



-- 
Reinier Heeres
Tel: +31 6 10852639

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

Reply via email to