Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: ramirodsl <ramirosimoeslopes@gm...>  20081218 23:05:46

Can someone explain to me how/why the figure normalized [0,1] coordinates 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 want. I want to have square plots placed without spacing between them and with a little margin on the left and top. So I tried: s=0.4 axes([0.01, 0.99s, s, s],aspect='equal') axes([0.01+s, 0.99s, s, s],aspect='equal') axes([0.01, 0.992*s, s, s],aspect='equal') axes([0.01+s, 0.992*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 behavior. Now if I add: figure(figsize=(5,5)) 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 horizontal 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 Ramiro  View this message in context: http://www.nabble.com/axesplacementdependsonfigsizetp21082730p21082730.html Sent from the matplotlib  users mailing list archive at Nabble.com. 
From: Eric Firing <efiring@ha...>  20081219 00:29:13

ramirodsl wrote: > Can someone explain to me how/why the figure normalized [0,1] coordinates > 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 > want. > > I want to have square plots placed without spacing between them and with a > little margin on the left and top. So I tried: > > s=0.4 > axes([0.01, 0.99s, s, s],aspect='equal') > axes([0.01+s, 0.99s, s, s],aspect='equal') > axes([0.01, 0.992*s, s, s],aspect='equal') > axes([0.01+s, 0.992*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 behavior. 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. Eric > > Now if I add: > figure(figsize=(5,5)) > 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 horizontal > 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 > > Ramiro 
From: Eric Firing <efiring@ha...>  20081219 18:38:43

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? > > Ramiro Ramiro, (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. Eric > > > > 2008/12/18 Eric Firing <efiring@... <mailto:efiring@...>> > > ramirodsl wrote: > > Can someone explain to me how/why the figure normalized [0,1] > coordinates > 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 > want. > > I want to have square plots placed without spacing between them > and with a > little margin on the left and top. So I tried: > > s=0.4 > axes([0.01, 0.99s, s, s],aspect='equal') > axes([0.01+s, 0.99s, s, s],aspect='equal') > axes([0.01, 0.992*s, s, s],aspect='equal') > axes([0.01+s, 0.992*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 > behavior. > > > 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. > > Eric > > > Now if I add: > figure(figsize=(5,5)) > 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 > horizontal > 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 > > Ramiro > > > 
Sign up for the SourceForge newsletter:
No, thanks