plot3D in subplot

Hello,
Could anyone tell me how to use plot3D in a subplot?
I looked at the examples at
http://www.scipy.org/Cookbook/Matplotlib/mplot3D
But seems to me that matplotlib.axes3d.Axes3D can

be only constructed from a Figure instance but
not from a Subplot instance.

Thanks,
Bing

You should be able to set the rect keyword argument of the Axes3D constructor:

  fig=p.figure()
  ax = pylab.Axes3D(fig, rect=[0.2, 0.6, 0.7, 0.3])

where rect is [left, bottom, width, height] in fractions of the figure 0..1

A subplot is just an axes with a rect set so that it lives on a regular grid.

Note though that the 3D stuff is experimental, slow, somewhat buggy
and not supported, so we won't be able to help much with real
problems.

JDH

···

On Sat, May 24, 2008 at 4:08 PM, Bing <bing.jian@...287...> wrote:

Hello,
   Could anyone tell me how to use plot3D in a subplot?
I looked at the examples at
  http://www.scipy.org/Cookbook/Matplotlib/mplot3D
But seems to me that matplotlib.axes3d.Axes3D can
be only constructed from a Figure instance but
not from a Subplot instance.

Hi John,
Thanks for the hint. I am able to pass the rect returned by Subplot.get_position().

Bing

···

On Sat, May 24, 2008 at 9:27 PM, John Hunter <jdh2358@…287…> wrote:

On Sat, May 24, 2008 at 4:08 PM, Bing <bing.jian@…287…> wrote:

Hello,

Could anyone tell me how to use plot3D in a subplot?

I looked at the examples at

http://www.scipy.org/Cookbook/Matplotlib/mplot3D

But seems to me that matplotlib.axes3d.Axes3D can

be only constructed from a Figure instance but

not from a Subplot instance.

You should be able to set the rect keyword argument of the Axes3D constructor:

fig=p.figure()

ax = pylab.Axes3D(fig, rect=[0.2, 0.6, 0.7, 0.3])

where rect is [left, bottom, width, height] in fractions of the figure 0…1

A subplot is just an axes with a rect set so that it lives on a regular grid.

Note though that the 3D stuff is experimental, slow, somewhat buggy

and not supported, so we won’t be able to help much with real

problems.

JDH