From: <jr...@us...> - 2008-10-31 14:54:45
|
Revision: 6360 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6360&view=rev Author: jrevans Date: 2008-10-31 14:54:42 +0000 (Fri, 31 Oct 2008) Log Message: ----------- Added unit handling for axhspan and axvspan. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-10-31 13:06:59 UTC (rev 6359) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-10-31 14:54:42 UTC (rev 6360) @@ -2876,9 +2876,16 @@ .. plot:: mpl_examples/pylab_examples/axhspan_demo.py """ - # convert y axis units trans = mtransforms.blended_transform_factory( self.transAxes, self.transData) + + # process the unit information + self._process_unit_info( [xmin, xmax], [ymin, ymax], **kwargs ) + + # first we need to strip away the units + xmin, xmax = self.convert_xunits( [xmin, xmax] ) + ymin, ymax = self.convert_yunits( [ymin, ymax] ) + verts = (xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin) p = mpatches.Polygon(verts, **kwargs) p.set_transform(trans) @@ -2923,9 +2930,16 @@ :meth:`axhspan`: for example plot and source code """ - # convert x axis units trans = mtransforms.blended_transform_factory( self.transData, self.transAxes) + + # process the unit information + self._process_unit_info( [xmin, xmax], [ymin, ymax], **kwargs ) + + # first we need to strip away the units + xmin, xmax = self.convert_xunits( [xmin, xmax] ) + ymin, ymax = self.convert_yunits( [ymin, ymax] ) + verts = [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)] p = mpatches.Polygon(verts, **kwargs) p.set_transform(trans) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |