axes placement depends on figsize?

Ramiro Simões Lopes wrote:

Thanks, it works.
But I also found out that I was setting figsize to a smaller size than the plot was occupying thus it wasn't working. The anchor kwarg isn't needed if the figure is big enough.

I still don't understand why the axes aspect ratio should depend on figsize though.
I mean, if I set figsize=(10,10) and plot everything, it works. But if I set it to like (10,15) then the axes have spacing between them in the vertical direction, even though I'm very specific about the coordinates.
How can 0.01 mean one thing in the horizontal direction and other in the vertical direction?



(When corresponding on the list, please use "reply to all" so that everything stays on the list.)

First, the 0.01 is 0.01 times the figure width for the horizontal, and 0.01 times the figure height for the vertical, so they are different physical dimensions if the figure aspect ratio is not 1:1. Second, setting the aspect='equal' tells mpl to *adjust* the axes box so that it has a 1:1 aspect ratio *regardless* of the figure dimensions. It can only do this by adding space, either on the sides or top and bottom.



2008/12/18 Eric Firing <efiring@...202... <mailto:efiring@…202…>>

    ramirodsl wrote:

        Can someone explain to me how/why the figure normalized [0,1]
        depends on the figsize property? At least this is what it looks
        like to me.
        This affects axes placement and so far I haven't been able to do
        what I

        I want to have square plots placed without spacing between them
        and with a
        little margin on the left and top. So I tried:

        axes([0.01, 0.99-s, s, s],aspect='equal')
        axes([0.01+s, 0.99-s, s, s],aspect='equal')
        axes([0.01, 0.99-2*s, s, s],aspect='equal')
        axes([0.01+s, 0.99-2*s, s, s],aspect='equal')

        The vertical positioning works as I expected but the x
        positioning does not
        work. The axes have spacing between them - which means that 0.1
        represents a
        different size in x or in y - and I just can't understand that

    The problem is that you are giving conflicting instructions. Your
    axes command is initially saying to make the boxes with the given
    proportions of the figure, regardless of the dimensions or aspect
    ratio of that figure; but setting the aspect is overriding that by
    requiring the boxes to be square. You can still get the behavior
    you want, however, by adding an anchor kwarg to each axes call. To
    make sure the
    boxes cluster together, add anchor='SE' to the upper left axes,
    anchor='SW' to the upper right, and 'NE' and 'NW' to the lower left
    and right, respectively.


        Now if I add:
        it works

        But this is not the solution I need because the real plot I'm
        trying to do
        is a 6x5 (6 axes per 5 axes, subplots if you mean) plot with
        spacing only between the 3rd and 4th axes. There is no way I
        could now the
        correct aspect ratio that I should set figsize to, to get it right.

        How could I manage this?

        Thank you