From: <jo...@us...> - 2007-08-23 06:58:13
|
Revision: 3731 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3731&view=rev Author: jouni Date: 2007-08-22 23:58:10 -0700 (Wed, 22 Aug 2007) Log Message: ----------- Fix a buglet affecting getp: if a numpy object has shape==(), you cannot take its length. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2007-08-22 20:11:18 UTC (rev 3730) +++ trunk/matplotlib/lib/matplotlib/artist.py 2007-08-23 06:58:10 UTC (rev 3731) @@ -588,7 +588,7 @@ if self.is_alias(func): continue try: val = func() except: continue - if hasattr(val, 'shape') and len(val)>6: + if getattr(val, 'shape', ()) != () and len(val)>6: s = str(val[:6]) + '...' else: s = str(val) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-08-28 20:29:39
|
Revision: 3749 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3749&view=rev Author: mdboom Date: 2007-08-28 13:29:37 -0700 (Tue, 28 Aug 2007) Log Message: ----------- Sped up get_valid_values to improve startup time. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2007-08-28 20:28:46 UTC (rev 3748) +++ trunk/matplotlib/lib/matplotlib/artist.py 2007-08-28 20:29:37 UTC (rev 3749) @@ -1,5 +1,5 @@ from __future__ import division -import sys +import sys, re from cbook import iterable, flatten from transforms import identity_transform import matplotlib.units as units @@ -484,6 +484,7 @@ aliases[fullname[4:]] = name[4:] return aliases + _get_valid_values_regex = re.compile(r"\n\s*ACCEPTS:\s*(.*)\n") def get_valid_values(self, attr): """ get the legal arguments for the setter associated with attr @@ -505,10 +506,10 @@ if docstring.startswith('alias for '): return None - for line in docstring.split('\n'): - line = line.lstrip() - if not line.startswith('ACCEPTS:'): continue - return line[8:].strip() + + match = self._get_valid_values_regex.search(docstring) + if match is not None: + return match.group(1) return 'unknown' def get_setters(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-06-19 19:53:55
|
Revision: 5600 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5600&view=rev Author: mdboom Date: 2008-06-19 12:53:12 -0700 (Thu, 19 Jun 2008) Log Message: ----------- docstring formatting fixes. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2008-06-19 19:24:45 UTC (rev 5599) +++ trunk/matplotlib/lib/matplotlib/artist.py 2008-06-19 19:53:12 UTC (rev 5600) @@ -23,7 +23,8 @@ class Artist(object): """ - Abstract base class for someone who renders into a FigureCanvas + Abstract base class for someone who renders into a + :class:`FigureCanvas`. """ aname = 'Artist' @@ -52,12 +53,15 @@ def remove(self): """ - Remove the artist from the figure if possible. The effect will not - be visible until the figure is redrawn, e.g., with ax.draw_idle(). - Call ax.relim() to update the axes limits if desired. + Remove the artist from the figure if possible. The effect + will not be visible until the figure is redrawn, e.g., with + :meth:`matplotlib.axes.Axes.draw_idle`. Call + :meth:`matplotlib.axes.Axes.relim` to update the axes limits + if desired. - Note: relim() will not see collections even if the collection - was added to axes with autolim=True. + Note: :meth:`~matplotlib.axes.Axes.relim` will not see + collections even if the collection was added to axes with + *autolim* = True. Note: there is no support for removing the artist's legend entry. """ @@ -134,16 +138,18 @@ def set_transform(self, t): """ - set the Transformation instance used by this artist - - ACCEPTS: a matplotlib.transform transformation instance + Set the :class:`~matplotlib.transforms.Transform` instance + used by this artist. """ self._transform = t self._transformSet = True self.pchanged() def get_transform(self): - 'return the Transformation instance used by this artist' + """ + Return the :class:`~matplotlib.transforms.Transform` + instance used by this artist. + """ if self._transform is None: self._transform = IdentityTransform() return self._transform @@ -228,26 +234,26 @@ None - picking is disabled for this artist (default) boolean - if True then picking will be enabled and the - artist will fire a pick event if the mouse event is over - the artist + artist will fire a pick event if the mouse event is over + the artist float - if picker is a number it is interpreted as an - epsilon tolerance in points and the the artist will fire - off an event if it's data is within epsilon of the mouse - event. For some artists like lines and patch collections, - the artist may provide additional data to the pick event - that is generated, eg the indices of the data within - epsilon of the pick event + epsilon tolerance in points and the the artist will fire + off an event if it's data is within epsilon of the mouse + event. For some artists like lines and patch collections, + the artist may provide additional data to the pick event + that is generated, eg the indices of the data within + epsilon of the pick event function - if picker is callable, it is a user supplied - function which determines whether the artist is hit by the - mouse event. + function which determines whether the artist is hit by the + mouse event:: hit, props = picker(artist, mouseevent) - to determine the hit test. if the mouse event is over the - artist, return hit=True and props is a dictionary of - properties you want added to the PickEvent attributes + to determine the hit test. if the mouse event is over the + artist, return hit=True and props is a dictionary of + properties you want added to the PickEvent attributes. ACCEPTS: [None|float|boolean|callable] """ @@ -288,17 +294,18 @@ """ Set the artist's clip path, which may be: - a) a Patch (or subclass) instance + a) a :class:`~matplotlib.patches.Patch` (or subclass) instance - b) a Path instance, in which cas aoptional transform may - be provided, which will be applied to the path before using it - for clipping. + b) a :class:`~matplotlib.path.Path` instance, in which case + an optional :class:`~matplotlib.transforms.Transform` + instance may be provided, which will be applied to the + path before using it for clipping. - c) None, to remove the clipping path + c) *None*, to remove the clipping path For efficiency, if the path happens to be an axis-aligned rectangle, this method will set the clipping box to the - corresponding rectangle and set the clipping path to None. + corresponding rectangle and set the clipping path to *None*. ACCEPTS: a Path instance and a Transform instance, a Patch instance, or None This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |