From: <md...@us...> - 2008-10-23 17:35:24
|
Revision: 6312 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6312&view=rev Author: mdboom Date: 2008-10-23 17:35:14 +0000 (Thu, 23 Oct 2008) Log Message: ----------- Fix duplicate aliases. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2008-10-23 17:21:49 UTC (rev 6311) +++ trunk/matplotlib/lib/matplotlib/artist.py 2008-10-23 17:35:14 UTC (rev 6312) @@ -651,7 +651,7 @@ if not self.is_alias(func): continue docstring = func.__doc__ fullname = docstring[10:] - aliases.setdefault(fullname[4:], []).append(name[4:]) + aliases.setdefault(fullname[4:], {})[name[4:]] = None return aliases _get_valid_values_regex = re.compile(r"\n\s*ACCEPTS:\s*((?:.|\n)*?)(?:$|(?:\n\n))") @@ -731,7 +731,7 @@ """ if s in self.aliasd: - aliases = ''.join([' or %s' % x for x in self.aliasd[s]]) + aliases = ''.join([' or %s' % x for x in self.aliasd[s].keys()]) else: aliases = '' return ':meth:`%s <%s>`%s' % (s, target, aliases) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-11-07 13:31:31
|
Revision: 6371 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6371&view=rev Author: mdboom Date: 2008-11-07 13:31:25 +0000 (Fri, 07 Nov 2008) Log Message: ----------- Minor docstring fix. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2008-11-07 12:36:37 UTC (rev 6370) +++ trunk/matplotlib/lib/matplotlib/artist.py 2008-11-07 13:31:25 UTC (rev 6371) @@ -569,8 +569,8 @@ pyplot signature: findobj(o=gcf(), match=None) - recursively find all :class:matplotlib.artist.Artist instances - contained in self + Recursively find all :class:matplotlib.artist.Artist instances + contained in self. *match* can be @@ -812,16 +812,16 @@ def findobj(self, match=None): """ - recursively find all :class:matplotlib.artist.Artist instances - contained in self + Recursively find all :class:`matplotlib.artist.Artist` + instances contained in *self*. - if *match* is not None, it can be + If *match* is not None, it can be - function with signature ``boolean = match(artist)`` - - class instance: eg Line2D + - class instance: eg :class:`~matplotlib.lines.Line2D` - used to filter matches + used to filter matches. """ if match is None: # always return True @@ -861,7 +861,6 @@ getp(o) # get all the object properties getp(o, 'linestyle') # get the linestyle property - *o* is a :class:`Artist` instance, eg :class:`~matplotllib.lines.Line2D` or an instance of a :class:`~matplotlib.axes.Axes` or :class:`matplotlib.text.Text`. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-11 20:45:27
|
Revision: 6572 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6572&view=rev Author: mdboom Date: 2008-12-11 20:45:23 +0000 (Thu, 11 Dec 2008) Log Message: ----------- Add docstring clarification. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2008-12-11 20:45:12 UTC (rev 6571) +++ trunk/matplotlib/lib/matplotlib/artist.py 2008-12-11 20:45:23 UTC (rev 6572) @@ -340,6 +340,8 @@ * None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center + + Only supported by the Agg backends. """ return self._snap @@ -353,6 +355,8 @@ * None: (auto) If the path contains only rectilinear line segments, round to the nearest pixel center + + Only supported by the Agg backends. """ self._snap = snap This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-05-25 17:39:51
|
Revision: 7141 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7141&view=rev Author: jdh2358 Date: 2009-05-25 17:39:45 +0000 (Mon, 25 May 2009) Log Message: ----------- only forward pick events to children with the same axes instance as the pick event inaxes method Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2009-05-25 17:38:09 UTC (rev 7140) +++ trunk/matplotlib/lib/matplotlib/artist.py 2009-05-25 17:39:45 UTC (rev 7141) @@ -24,13 +24,13 @@ -def allow_rasterization(draw): +def allow_rasterization(draw): """ Decorator for Artist.draw method. Provides routines that run before and after the draw call. The before and after functions are useful for changing artist-dependant renderer attributes or making other setup function calls, such as starting and flushing a mixed-mode - renderer. + renderer. """ def before(artist, renderer): if artist.get_rasterized(): @@ -42,7 +42,7 @@ # the axes class has a second argument inframe for its draw method. def draw_wrapper(artist, renderer, *kl): - before(artist, renderer) + before(artist, renderer) draw(artist, renderer, *kl) after(artist, renderer) @@ -52,8 +52,8 @@ draw_wrapper.__doc__ = draw.__doc__ draw_wrapper._supports_rasterization = True return draw_wrapper - + class Artist(object): """ Abstract base class for someone who renders into a @@ -308,7 +308,10 @@ # Pick children for a in self.get_children(): - a.pick(mouseevent) + # make sure the event happened in the same axes + ax = getattr(a, 'axes', None) + if mouseevent.inaxes==ax: + a.pick(mouseevent) def set_picker(self, picker): """ @@ -543,16 +546,16 @@ else: gc.set_clip_rectangle(None) gc.set_clip_path(None) - + def get_rasterized(self): return self._rasterized - + def set_rasterized(self, rasterized): """ Force rasterized (bitmap) drawing in vector backend output. - + Defaults to None, which implies the backend's default behavior - + ACCEPTS: [True | False | None] """ if rasterized and not hasattr(self.draw, "_supports_rasterization"): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-06-06 14:16:41
|
Revision: 7186 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7186&view=rev Author: jdh2358 Date: 2009-06-06 14:16:40 +0000 (Sat, 06 Jun 2009) Log Message: ----------- added a properties method to the artist and inspector to return a dict mapping property name -> value; see sf feature request 2792183 Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2009-06-06 13:26:49 UTC (rev 7185) +++ trunk/matplotlib/lib/matplotlib/artist.py 2009-06-06 14:16:40 UTC (rev 7186) @@ -672,6 +672,12 @@ self.pchanged() + def properties(self): + """ + return a dictionary mapping property name -> value for all Artist props + """ + return ArtistInspector(self).properties() + def set(self, **kwargs): """ A tkstyle set command, pass *kwargs* to set properties @@ -876,6 +882,7 @@ return ':meth:`%s <%s>`%s' % (s, target, aliases) + def pprint_setters(self, prop=None, leadingspace=2): """ If *prop* is *None*, return a list of strings of all settable properies @@ -954,24 +961,39 @@ lines.append('%s%s: %s' %(pad, name, accepts)) return lines - def pprint_getters(self): + + def properties(self): """ - Return the getters and actual values as list of strings. + return a dictionary mapping property name -> value """ - o = self.oorig getters = [name for name in dir(o) if name.startswith('get_') and callable(getattr(o, name))] #print getters getters.sort() - lines = [] + d = dict() for name in getters: func = getattr(o, name) if self.is_alias(func): continue try: val = func() except: continue + else: d[name[4:]] = val + + return d + + def pprint_getters(self): + """ + Return the getters and actual values as list of strings. + """ + + d = self.properties() + names = d.keys() + names.sort() + lines = [] + for name in names: + val = d[name] if getattr(val, 'shape', ()) != () and len(val)>6: s = str(val[:6]) + '...' else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <as...@us...> - 2009-10-06 15:42:26
|
Revision: 7853 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7853&view=rev Author: astraw Date: 2009-10-06 15:42:19 +0000 (Tue, 06 Oct 2009) Log Message: ----------- trivial: delete trailing whitespace from source code lines (This is really an excuse to make an SVN commit to trigger the buildbot.) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2009-10-06 15:13:44 UTC (rev 7852) +++ trunk/matplotlib/lib/matplotlib/artist.py 2009-10-06 15:42:19 UTC (rev 7853) @@ -88,7 +88,7 @@ self._contains = None self._rasterized = None self._agg_filter = None - + self.eventson = False # fire events only if eventson self._oid = 0 # an observer id self._propobservers = {} # a dict from oids to funcs @@ -581,7 +581,7 @@ def set_agg_filter(self, filter_func): """ set agg_filter fuction. - + """ self._agg_filter = filter_func This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2010-02-01 22:46:37
|
Revision: 8106 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8106&view=rev Author: jdh2358 Date: 2010-02-01 22:46:30 +0000 (Mon, 01 Feb 2010) Log Message: ----------- support picking of axes objects outside their bounding box Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2010-01-29 18:03:13 UTC (rev 8105) +++ trunk/matplotlib/lib/matplotlib/artist.py 2010-02-01 22:46:30 UTC (rev 8106) @@ -320,7 +320,11 @@ for a in self.get_children(): # make sure the event happened in the same axes ax = getattr(a, 'axes', None) - if mouseevent.inaxes==ax: + if mouseevent.inaxes is None or mouseevent.inaxes==ax: + # we need to check if mouseevent.inaxes is None + # because some objects associated with an axes (eg a + # tick label) can be outside the bounding box of the + # axes and inaxes will be None a.pick(mouseevent) def set_picker(self, picker): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-06-14 01:17:30
|
Revision: 8430 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8430&view=rev Author: efiring Date: 2010-06-14 01:17:23 +0000 (Mon, 14 Jun 2010) Log Message: ----------- [1474254] getp, setp: minor clarifications Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2010-06-14 00:54:41 UTC (rev 8429) +++ trunk/matplotlib/lib/matplotlib/artist.py 2010-06-14 01:17:23 UTC (rev 8430) @@ -1082,25 +1082,25 @@ -def getp(o, property=None): +def getp(obj, property=None): """ - Return the value of handle property. property is an optional string + Return the value of object's property. *property* is an optional string for the property you want to return Example usage:: - getp(o) # get all the object properties - getp(o, 'linestyle') # get the linestyle property + getp(obj) # get all the object properties + getp(obj, 'linestyle') # get the linestyle property - *o* is a :class:`Artist` instance, eg + *obj* is a :class:`Artist` instance, eg :class:`~matplotllib.lines.Line2D` or an instance of a :class:`~matplotlib.axes.Axes` or :class:`matplotlib.text.Text`. If the *property* is 'somename', this function returns - o.get_somename() + obj.get_somename() :func:`getp` can be used to query all the gettable properties with - ``getp(o)``. Many properties have aliases for shorter typing, e.g. + ``getp(obj)``. Many properties have aliases for shorter typing, e.g. 'lw' is an alias for 'linewidth'. In the output, aliases and full property names will be listed as: @@ -1111,21 +1111,20 @@ linewidth or lw = 2 """ - insp = ArtistInspector(o) if property is None: + insp = ArtistInspector(obj) ret = insp.pprint_getters() print '\n'.join(ret) return - func = getattr(o, 'get_' + property) - + func = getattr(obj, 'get_' + property) return func() # alias get = getp -def setp(h, *args, **kwargs): +def setp(obj, *args, **kwargs): """ matplotlib supports the use of :func:`setp` ("set property") and :func:`getp` to set and get object properties, as well as to do @@ -1160,7 +1159,7 @@ >>> lines = plot(x, y1, x, y2) >>> setp(lines, linewidth=2, color='r') - :func:`setp` works with the matlab(TM) style string/value pairs or + :func:`setp` works with the matlab style string/value pairs or with python kwargs. For example, the following are equivalent:: >>> setp(lines, 'linewidth', 2, 'color', r') # matlab style @@ -1168,7 +1167,7 @@ >>> setp(lines, linewidth=2, color='r') # python style """ - insp = ArtistInspector(h) + insp = ArtistInspector(obj) if len(kwargs)==0 and len(args)==0: print '\n'.join(insp.pprint_setters()) @@ -1178,8 +1177,10 @@ print insp.pprint_setters(prop=args[0]) return - if not cbook.iterable(h): h = [h] - else: h = cbook.flatten(h) + if not cbook.iterable(obj): + objs = [obj] + else: + objs = cbook.flatten(obj) if len(args)%2: @@ -1191,11 +1192,11 @@ funcvals.extend(kwargs.items()) ret = [] - for o in h: + for o in objs: for s, val in funcvals: s = s.lower() funcName = "set_%s"%s - func = getattr(o,funcName) + func = getattr(o, funcName) ret.extend( [func(val)] ) return [x for x in cbook.flatten(ret)] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ry...@us...> - 2010-10-06 16:00:33
|
Revision: 8729 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8729&view=rev Author: ryanmay Date: 2010-10-06 16:00:27 +0000 (Wed, 06 Oct 2010) Log Message: ----------- Move import of traceback to only occur in the event of an exception. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2010-10-04 19:22:32 UTC (rev 8728) +++ trunk/matplotlib/lib/matplotlib/artist.py 2010-10-06 16:00:27 UTC (rev 8729) @@ -239,13 +239,13 @@ """ List the children of the artist which contain the mouse event *event*. """ - import traceback L = [] try: hascursor,info = self.contains(event) if hascursor: L.append(self) except: + import traceback traceback.print_exc() print "while checking",self.__class__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |