John Hunter wrote:
On Thu, Jul 17, 2008 at 10:28 PM, Ryan May <[EMAIL PROTECTED]> wrote:

I helped Eric out with this offline, and obviously set_array is for the
colors, but the only solution we could come up with was to directly
reset the PolyCollection._offsets member.  This seems a little hacky.
Is there any reason that there is not an set_offsets() (or something
like it)?  Any reason why I shouldn't code up a patch?

No, I can't thing of any reason why this attribute should not be
publicly settable, so patch away.

Here's an updated version of the patch so that the doctring actually makes sense.

Ryan

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
--- collections.py	(revision 5792)
+++ collections.py	(working copy)
@@ -222,6 +222,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* should be a
+        sequence.
+        
+        ACCEPTS: a sequence of pairs 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 SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to