default axes rect

Anyone know how the default axes rectangle is set? The

    > default width and height are apparently not the same

    >>>> from pylab import * ax=axes() ax.get_position()
    > [0.125, 0.099999999999999978, 0.77500000000000002,
    > 0.80000000000000004]

    > I'd like the last two numbers to be identical (say 0.8),
    > that way I can be sure that a plot will have a certain
    > aspect ratio if the figure dimensions have that aspect
    > ratio.

If no args are passed to axes, a subplot(111) is created. If you want
to control the rectangle, just pass in the l,b,w,h args

  ax = axes([0.1, 0.1, 0.8, 0.8])

If you want to see how the default subplots are created, see
axes.Subplot and the subplot params

    left : 0.125 # the left side of the subplots of the figure
    right : 0.9 # the right side of the subplots of the figure
    bottom : 0.1 # the bottom of the subplots of the figure
    top : 0.9 # the top of the subplots of the figure
    wspace : 0.2 # the amount of width reserved for blank space between subplots
    hspace : 0.2 # the amount of height reserved for white space between subplots

JDH

PS: thanks for the basemap notes -- I presented them at scipy and
there appeared to be a fair amount of interest in it.

John Hunter wrote:

"Jeff" == Jeff Whitaker <jswhit@...196...> writes:
           
   > Anyone know how the default axes rectangle is set? The
   > default width and height are apparently not the same

   >>>> from pylab import * ax=axes() ax.get_position()
   > [0.125, 0.099999999999999978, 0.77500000000000002,
   > 0.80000000000000004]

   > I'd like the last two numbers to be identical (say 0.8),
   > that way I can be sure that a plot will have a certain
   > aspect ratio if the figure dimensions have that aspect
   > ratio.

If no args are passed to axes, a subplot(111) is created. If you want
to control the rectangle, just pass in the l,b,w,h args

ax = axes([0.1, 0.1, 0.8, 0.8])

If you want to see how the default subplots are created, see
axes.Subplot and the subplot params

   left : 0.125 # the left side of the subplots of the figure
   right : 0.9 # the right side of the subplots of the figure
   bottom : 0.1 # the bottom of the subplots of the figure
   top : 0.9 # the top of the subplots of the figure
   wspace : 0.2 # the amount of width reserved for blank space between subplots
   hspace : 0.2 # the amount of height reserved for white space between subplots

JDH

PS: thanks for the basemap notes -- I presented them at scipy and
there appeared to be a fair amount of interest in it.

John: Thanks - I knew about setting the rect manually, but I didn't know the defaults were in subplot.params. I want to override those defaults in basemap so that the width and height are both 0.8 (they are 0.775 and 0.8 now). That way the map will have the right aspect ratio without the user having to set the axes rect manually. I've set it up so that rcParams['subplot.params.left'] is set to 0.1 when basemap is imported (a warning is printed notifying the user that the defaults have been changed, and rcdefaults() can be used to get the old ones back).

Thanks a lot for presenting that material at SciPy - I've noticed an upswing in downloads since your talk.

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/CDC R/CDC1 Email : Jeffrey.S.Whitaker@...236...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg