From: <ef...@us...> - 2008-07-21 19:39:15
|
Revision: 5803 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5803&view=rev Author: efiring Date: 2008-07-21 19:39:12 +0000 (Mon, 21 Jul 2008) Log Message: ----------- Add get_offsets, set_offsets to Collection (Ryan Kraus) Modified Paths: -------------- trunk/matplotlib/API_CHANGES trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/collections.py Modified: trunk/matplotlib/API_CHANGES =================================================================== --- trunk/matplotlib/API_CHANGES 2008-07-21 19:08:29 UTC (rev 5802) +++ trunk/matplotlib/API_CHANGES 2008-07-21 19:39:12 UTC (rev 5803) @@ -1,6 +1,9 @@ Changes for 0.98.x ================== +* Methods get_offsets and set_offsets added to Collections base + class. + * Figure.figurePatch renamed Figure.patch, Axes.axesPatch renamed Axes.patch, Axes.axesFrame renamed Axes.frame, Axes.get_frame, which returns Axes.patch, is deprecated. Examples and users guide updated Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-07-21 19:08:29 UTC (rev 5802) +++ trunk/matplotlib/CHANGELOG 2008-07-21 19:39:12 UTC (rev 5803) @@ -1,3 +1,6 @@ +2008-07-21 Committed patch by Ryan May to add get_offsets and + set_offsets to Collections base class - EF + 2008-07-21 Changed the "asarray" strategy in image.py so that colormapping of masked input should work for all image types (thanks Klaus Zimmerman) - EF Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2008-07-21 19:08:29 UTC (rev 5802) +++ trunk/matplotlib/lib/matplotlib/collections.py 2008-07-21 19:39:12 UTC (rev 5803) @@ -218,6 +218,32 @@ def set_pickradius(self,pickradius): self.pickradius = 5 def get_pickradius(self): return self.pickradius + def set_offsets(self, offsets): + """ + Set the offsets for the collection. *offsets* can be a scalar + or a sequence. + + ACCEPTS: float or sequence of floats + """ + offsets = np.asarray(offsets, np.float_) + if len(offsets.shape) == 1: + offsets = offsets[np.newaxis,:] # Make it Nx2. + #This decision is based on how they are initialized above + if self._uniform_offsets is None: + self._offsets = offsets + else: + self._uniform_offsets = offsets + + def get_offsets(self): + """ + Return the offsets for the collection. + """ + #This decision is based on how they are initialized above in __init__() + if self._uniform_offsets is None: + return self._offsets + else: + return self._uniform_offsets + def set_linewidths(self, lw): """ Set the linewidth(s) for the collection. *lw* can be a scalar This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |