Hello,

I am new to matplotlib and am having trouble understanding how to set
the size of a subplot when a figure contains multiple subplots. In
particular, I have been playing around with the scatter_hist.py demo
at http://matplotlib.sourceforge.net/examples/axes_grid/scatter_hist.html.
A simplified version of this code is given below:

*****************

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid import make_axes_locatable

fig = plt.figure(1, figsize=(4,4))

axScatter = plt.subplot(111)
divider = make_axes_locatable(axScatter)
axHisty = divider.new_horizontal(1.2, pad=0.5, sharey=axScatter)
fig.add_axes(axHisty)

x = np.random.randn(1000)
y = np.random.randn(1000)
axScatter.scatter(x, y)
axHisty.hist(x, orientation='horizontal')

plt.draw()
plt.show()

*****************

I'd like to have direct control over the size of the scatter plot in
this figure. As it stands, I can 'sort of' control its size by
changing the figsize property of the figure. I say 'sort of' since the
size of any labels also come into play here. Is it possible to
directly make the scatter plot a certain size (say, 3 x 2 inches), set
the figure size independently (say, 5 x 4 inches), and have the
histogram size be set based on the scatter plot height and width set
in divider.new_horizontal (in this case to 3 x 1.2 inches)?

I realize that in this example, it probably seems silly to not just
change figsize, but I am working with a more complicated plot in
reality where I'd like precise control over the size of the initial
subplot since the aspect ratio is important to me. I can then adjust
the figsize to make sure all the labels fit in nicely.

Thanks for any and all help.

Cheers,
Donovan

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to