On Sun, Jul 18, 2010 at 1:40 PM, Benjamin Root <ben.r...@ou.edu> wrote:
> On Sun, Jul 18, 2010 at 12:05 PM, Benjamin Root <ben.r...@ou.edu> wrote:
>
>>
>>
>> On Sun, Jul 18, 2010 at 8:56 AM, João Luís Silva <jsi...@fc.up.pt> wrote:
>>
>>> On 07/18/2010 04:58 AM, H Mike Duan wrote:
>>> > Hi,
>>> >
>>> > There seems to be a problem in how 3D surfaces and lines are rendered
>>> > in mplot3d. The following is a simple script that plots a yellow
>>> > sphere, a blue wireframe on the surface of the sphere, and a red
>>> > wireframe outside the sphere. The semi-transparent yellow sphere is
>>> > rendered beautifully. The blue wireframe can only be seen with certain
>>> > viewing angles. The red wireframe is seen all the time, but its part
>>> > that is supposedly behind the sphere appears in front of the sphere.
>>> > Did I do something wrong or is it a bug of mplot3d? I am using
>>> > matplotlib 1.0.0 on Mac OS X 10.6. Thanks!
>>> >
>>> > -Mike
>>>
>>> Additionally the presented example (after adding a plt.show()) will give
>>> the appended traceback if the sphere is panned around. That won't happen
>>> if the line
>>>
>>> ax = fig.gca(projection='3d')
>>>
>>> is replaced with:
>>>
>>> ax = Axes3D(fig)
>>>
>>> Latest mpl svn (r8565), OS: Debian testing.
>>>
>>> Regards,
>>> João Luís
>>>
>>>
>>>
>>> Traceback (most recent call last):
>>> File
>>>
>>> "/usr/local/lib/python2.6/dist-packages/matplotlib/backends/backend_gtk.py",
>>> line 253, in button_release_event
>>> FigureCanvasBase.button_release_event(self, x, y, event.button,
>>> guiEvent=event)
>>> File
>>> "/usr/local/lib/python2.6/dist-packages/matplotlib/backend_bases.py",
>>> line 1603, in button_release_event
>>> self.callbacks.process(s, event)
>>> File "/usr/local/lib/python2.6/dist-packages/matplotlib/cbook.py",
>>> line 262, in process
>>> proxy(*args, **kwargs)
>>> File "/usr/local/lib/python2.6/dist-packages/matplotlib/cbook.py",
>>> line 188, in __call__
>>> return mtd(*args, **kwargs)
>>> File
>>> "/usr/local/lib/python2.6/dist-packages/matplotlib/backend_bases.py",
>>> line 2575, in release_pan
>>> a.end_pan()
>>> File "/usr/local/lib/python2.6/dist-packages/matplotlib/axes.py",
>>> line 2788, in end_pan
>>> del self._pan_start
>>> AttributeError: _pan_start
>>>
>>>
>>>
>> Joao,
>>
>> Yes, there is a known issue with objects not properly rendering when
>> viewed at certain angles. How to go about solving this seems to be a
>> difficult one to figure out.
>>
>> Also, thanks for pointing out the difference between calling gca() and
>> creating the Axes3D object directly. I am not sure exactly why there would
>> be a difference, but I will look into it right away.
>>
>> Ben Root
>>
>
> Ok, it appears that the .add_subplot() or .gca() approach to creating 3D
> axes appears to be adding the axes twice to the figure's canvas. Therefore,
> while the callback to press_pan() is connected only once, the function loops
> over all the axes in the figure, and connecting end_pan() twice.
>
> The end_pan() function deletes _pan_start, so the second subsequent call is
> trying to delete something that doesn't exist, thereby causing the
> traceback.
>
> So, now the question remains, why is the Axes3D object added twice to the
> figure?
>
> Ben Root
>
Further investigation reveals that this actually isn't all that unusual. If
one were to do the same thing, but for a 2d plot, one would find that a
figure's self.axes list would contain a SubplotAxes object, and a regular
Axes object. However, in our 3d case, it appears that instead of the
SubplotAxes object being placed, the regular object is being placed instead.
Hmmm, curiouser, and curiouser...
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-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel