Eric, list -

Here is the new aspect function for possible inclusion in pylab.
It works great and with the default values for the kwargs, it works exactly
the way I think it is useful for a combination of contouring and plotting.

What do you think, should we include this?

Mark

def aspect(*args, **kwargs):
   """
   Set/Get the aspect ratio (ylength/xlength) of the current axis

   Aspect ratio is defined as unit-length-along-y-axis /
unit-length-along-x-axis
   If no arguments are passed, the current aspect ratio is returned
   Aspect ratio may be met by changing size of axes while keeping data
limits fixed (called 'box'),
   or by changing data limits while keeping the lengths of the axes fixed
(called 'datalim')
   One point remains fixed, which is called the anchor, for example the
center (called 'C')
   Autoscaling may be turned on (limits may change upon next plotting
command)
   or off (limits will remain fixed)
   Keyword arguments:
   adjustable: 'box' (default), 'datalim'
   anchor: 'C' (default), 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'
   fixlim: True (default), False
   """

   ax = gca()
   if len(args)==0:
       aspect = ax.get_aspect()
   elif len(args)==1:
       aspect = args[0]
   adjustable = popd(kwargs,'adjustable','box')
   anchor = popd(kwargs,'anchor','C')
   fixlim = popd(kwargs,'fixlim',True)
   ax.set_aspect(aspect,adjustable,anchor)
   if fixlim:
       ax.set_autoscale_on(False)
   else:
       ax.set_autoscale_on(True)
       ax.autoscale_view()
   draw_if_interactive()
   return aspect
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to