Matching 3D axes size to 2D in mixed subplot

Hi,

I'm using the new mixed axes feature in matplotlib 1.0.0 to combine 3D and 2D plots in a single figure. The problem is that the 3D axes have a lot of extra white space around them that prevents the plot to line up flush with the 2D plot. Here is an example image of this:

using matplotlib: http://www.u.arizona.edu/~jjberry/matplotlib.png

vs. matlab of the same thing: http://www.u.arizona.edu/~jjberry/matlab.png

Is there any way of changing the space on the 3D axis to look more like the matlab figure?

Thanks,
Jeff Berry

Hi,

I’m using the new mixed axes feature in matplotlib 1.0.0 to combine 3D and 2D plots in a single figure. The problem is that the 3D axes have a lot of extra white space around them that prevents the plot to line up flush with the 2D plot. Here is an example image of this:

using matplotlib: http://www.u.arizona.edu/~jjberry/matplotlib.png

vs. matlab of the same thing: http://www.u.arizona.edu/~jjberry/matlab.png

Is there any way of changing the space on the 3D axis to look more like the matlab figure?

Thanks,

Jeff Berry

Jeff, thanks for pointing this out. An inadvertant side-effect of using add_subplot() for 3d axes seems to be that the creation process greatly restricts the available space for the 3d figure to be plotted. Whereas doing the old Axes3D() approach (albeit for non-subplots) would allow the 3D figure to use all the available space.

I am currently examining this issue right now and might be tied to another bug that has been reported recently.

Ben Root

···

On Thu, Jul 15, 2010 at 9:13 PM, Jeff Berry <jjberry@…920…28…> wrote:


This SF.net email is sponsored by Sprint

What will you do first with EVO, the first 4G phone?

Visit sprint.com/firsthttp://p.sf.net/sfu/sprint-com-first


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Jeff,

Sorry for taking so long to get back to you. I have found a sort of workaround that should help you out.

You can use subplots_adjust(left=0.0, bottom=0.0, right=1.0, top=1.0), before creating the axes to specify that the axes objects should use all the space available to them. Note, this will still allow for a buffer between the graphs, which can be adjusted using wspace and hspace keywords.

http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.subplots_adjust

I hope that helps,

Ben Root

···

On Sun, Jul 18, 2010 at 1:17 PM, Benjamin Root <ben.root@…3146…4…> wrote:

On Thu, Jul 15, 2010 at 9:13 PM, Jeff Berry <jjberry@…828…> wrote:

Hi,

I’m using the new mixed axes feature in matplotlib 1.0.0 to combine 3D and 2D plots in a single figure. The problem is that the 3D axes have a lot of extra white space around them that prevents the plot to line up flush with the 2D plot. Here is an example image of this:

using matplotlib: http://www.u.arizona.edu/~jjberry/matplotlib.png

vs. matlab of the same thing: http://www.u.arizona.edu/~jjberry/matlab.png

Is there any way of changing the space on the 3D axis to look more like the matlab figure?

Thanks,

Jeff Berry

Jeff, thanks for pointing this out. An inadvertant side-effect of using add_subplot() for 3d axes seems to be that the creation process greatly restricts the available space for the 3d figure to be plotted. Whereas doing the old Axes3D() approach (albeit for non-subplots) would allow the 3D figure to use all the available space.

I am currently examining this issue right now and might be tied to another bug that has been reported recently.

Ben Root