figure aspect ratio

Hi

I would like to have a bar plot twice as heigh as it is wide. It seems though that setting the aspect ratio is nontrivial. I tried this:

   w, h = fig.figaspect (2.0)
   plt.figure().set_figheight (h)
   plt.figure().set_figwidth (w)

but then axis labels or even numbering gets cut off. On the other hand playing with:

plt.axes().set_aspect (2.0)

does amazingly strange things. The explanation about what the number in the set_aspect function should be is quite vogue in the documentation. Hence my questions:

How to specify the aspect ratio of a figure (in my case containing some bar plots) so that all remaining things (like axis labels) are respected in the final result?

Regards
Tomek

but then axis labels or even numbering gets cut off. On the other hand
playing with:

You need to manually adjust subplot parameters

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

plt.axes().set_aspect (2.0)

does amazingly strange things. The explanation about what the number
in the set_aspect function should be is quite vogue in the
documentation. Hence my questions:

The aspect in axes is a aspect ratio of unit rectangle in the data
coordinate. It is similar to a pixel aspec ratio
(Pixel aspect ratio - Wikipedia).
And, to me, the documentation makes sense. Let us know if you have
any suggestion to improve the documentation though.

How to specify the aspect ratio of a figure (in my case containing
some bar plots) so that all remaining things (like axis labels) are
respected in the final result?

As I said, you need to manually adjust the subplot parameters (or
location of the axes). I guess this is more like a design decision.

You may try to automate things, as in the example below.

http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels

While it only makes a room for ticklabels, you can extend this to axis
labels and etc.

Regards,

-JJ

···

On Fri, Feb 12, 2010 at 1:48 PM, Tomasz Koziara <t.koziara@...2967...> wrote: