From: <md...@us...> - 2008-07-17 18:27:03
|
Revision: 5778 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5778&view=rev Author: mdboom Date: 2008-07-17 18:27:00 +0000 (Thu, 17 Jul 2008) Log Message: ----------- Minor docstring fix. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2008-07-17 18:26:41 UTC (rev 5777) +++ trunk/matplotlib/lib/matplotlib/figure.py 2008-07-17 18:27:00 UTC (rev 5778) @@ -929,6 +929,10 @@ def text(self, x, y, s, *args, **kwargs): """ + Call signature: + + figtext(x, y, s, fontdict=None, **kwargs) + Add text to figure at location *x*, *y* (relative 0-1 coords). See :func:`~matplotlib.pyplot.text` for the meaning of the other arguments. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-10-24 17:35:26
|
Revision: 6323 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6323&view=rev Author: mdboom Date: 2008-10-24 17:35:23 +0000 (Fri, 24 Oct 2008) Log Message: ----------- Minor docstring fix. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2008-10-24 17:12:24 UTC (rev 6322) +++ trunk/matplotlib/lib/matplotlib/figure.py 2008-10-24 17:35:23 UTC (rev 6323) @@ -280,15 +280,18 @@ Add a centered title to the figure. kwargs are :class:`matplotlib.text.Text` properties. Using figure - coordinates, the defaults are:: + coordinates, the defaults are: - *x* = 0.5 + - *x* = 0.5 the x location of text in figure coords - *y* = 0.98 + + - *y* = 0.98 the y location of the text in figure coords - *horizontalalignment* = 'center' + + - *horizontalalignment* = 'center' the horizontal alignment of the text - *verticalalignment* = 'top' + + - *verticalalignment* = 'top' the vertical alignment of the text A :class:`matplotlib.text.Text` instance is returned. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-02 20:08:57
|
Revision: 6476 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6476&view=rev Author: mdboom Date: 2008-12-02 20:08:53 +0000 (Tue, 02 Dec 2008) Log Message: ----------- Replace axes when current one is of the wrong projection type. This lets "subplot(111); polar()" work. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2008-12-02 19:51:10 UTC (rev 6475) +++ trunk/matplotlib/lib/matplotlib/figure.py 2008-12-02 20:08:53 UTC (rev 6476) @@ -656,13 +656,8 @@ %(Axes)s """ - key = self._make_key(*args, **kwargs) - if key in self._seen: - ax = self._seen[key] - self.sca(ax) - return ax + kwargs = kwargs.copy() - if not len(args): return if isinstance(args[0], SubplotBase): @@ -680,8 +675,18 @@ projection = 'polar' projection_class = get_projection_class(projection) - a = subplot_class_factory(projection_class)(self, *args, **kwargs) + key = self._make_key(*args, **kwargs) + if key in self._seen: + ax = self._seen[key] + if isinstance(ax, projection_class): + self.sca(ax) + return ax + else: + self.axes.remove(ax) + self._axstack.remove(ax) + + a = subplot_class_factory(projection_class)(self, *args, **kwargs) self.axes.append(a) self._axstack.push(a) self.sca(a) @@ -891,7 +896,20 @@ %(Axes)s """ ax = self._axstack() - if ax is not None: return ax + if ax is not None: + ispolar = kwargs.get('polar', False) + projection = kwargs.get('projection', None) + if ispolar: + if projection is not None and projection != 'polar': + raise ValueError( + "polar=True, yet projection='%s'. " + + "Only one of these arguments should be supplied." % + projection) + projection = 'polar' + + projection_class = get_projection_class(projection) + if isinstance(ax, projection_class): + return ax return self.add_subplot(111, **kwargs) gca.__doc__ = dedent(gca.__doc__) % artist.kwdocd This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2009-10-07 16:03:19
|
Revision: 7856 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7856&view=rev Author: leejjoon Date: 2009-10-07 16:03:08 +0000 (Wed, 07 Oct 2009) Log Message: ----------- fix savefig not to raise an error when file object is given Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2009-10-06 15:53:34 UTC (rev 7855) +++ trunk/matplotlib/lib/matplotlib/figure.py 2009-10-07 16:03:08 UTC (rev 7856) @@ -16,7 +16,7 @@ import artist from artist import Artist, allow_rasterization from axes import Axes, SubplotBase, subplot_class_factory -from cbook import flatten, allequal, Stack, iterable +from cbook import flatten, allequal, Stack, iterable, is_string_like import _image import colorbar as cbar from image import FigureImage @@ -1038,7 +1038,7 @@ kwargs[key] = rcParams['savefig.%s'%key] extension = rcParams['savefig.extension'] - if args and '.' not in args[0] and extension != 'auto': + if args and is_string_like(args[0]) and '.' not in args[0] and extension != 'auto': fname = args[0] + '.' + extension args = (fname,) + args[1:] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-12-13 20:24:32
|
Revision: 8030 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8030&view=rev Author: jouni Date: 2009-12-13 20:24:23 +0000 (Sun, 13 Dec 2009) Log Message: ----------- Fix AttributeError in figure.draw when compositing images Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2009-12-13 19:59:15 UTC (rev 8029) +++ trunk/matplotlib/lib/matplotlib/figure.py 2009-12-13 20:24:23 UTC (rev 8030) @@ -755,11 +755,12 @@ # override the renderer default if self.suppressComposite # is not None - composite = renderer.option_image_nocomposite() + not_composite = renderer.option_image_nocomposite() if self.suppressComposite is not None: - composite = self.suppressComposite + not_composite = self.suppressComposite - if len(self.images)<=1 or composite or not allequal([im.origin for im in self.images]): + if len(self.images)<=1 or not_composite or \ + not allequal([im.origin for im in self.images]): for a in self.images: dsu.append( (a.get_zorder(), a.draw, [renderer])) else: @@ -783,8 +784,7 @@ renderer.draw_image(gc, l, b, im) gc.restore() - if len(ims): - dsu.append((ims[0].get_zorder(), draw_composite, [])) + dsu.append((self.images[0].get_zorder(), draw_composite, [])) # render the axes for a in self.axes: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-12-21 19:49:31
|
Revision: 8049 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8049&view=rev Author: efiring Date: 2009-12-21 19:49:17 +0000 (Mon, 21 Dec 2009) Log Message: ----------- zorder support in figure: use same sort idiom as in axes Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2009-12-21 03:49:59 UTC (rev 8048) +++ trunk/matplotlib/lib/matplotlib/figure.py 2009-12-21 19:49:17 UTC (rev 8049) @@ -33,6 +33,8 @@ import matplotlib.cbook as cbook from matplotlib import docstring +from operator import itemgetter + docstring.interpd.update(projection_names = get_projection_names()) class SubplotParams: @@ -742,8 +744,6 @@ # a list of (zorder, func_to_call, list_of_args) dsu = [] - - # todo: respect zorder for a in self.patches: dsu.append( (a.get_zorder(), a.draw, [renderer])) @@ -797,8 +797,7 @@ for a in self.legends: dsu.append( (a.get_zorder(), a.draw, [renderer])) - - dsu.sort(key=lambda x: x[0]) + dsu.sort(key=itemgetter(0)) for zorder, func, args in dsu: func(*args) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-05-30 21:31:26
|
Revision: 8347 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8347&view=rev Author: efiring Date: 2010-05-30 21:31:19 +0000 (Sun, 30 May 2010) Log Message: ----------- close 1287318; remove method deprecated in 2006; remove incorrect warning Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2010-05-30 21:15:47 UTC (rev 8346) +++ trunk/matplotlib/lib/matplotlib/figure.py 2010-05-30 21:31:19 UTC (rev 8347) @@ -411,11 +411,6 @@ self.images.append(im) return im - def set_figsize_inches(self, *args, **kwargs): - import warnings - warnings.warn('Use set_size_inches instead!', DeprecationWarning) - self.set_size_inches(*args, **kwargs) - def set_size_inches(self, *args, **kwargs): """ set_size_inches(w,h, forward=False) @@ -431,9 +426,6 @@ automatically updated; eg you can resize the figure window from the shell - WARNING: forward=True is broken on all backends except GTK* - and WX* - ACCEPTS: a w,h tuple with w,h in inches """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2010-06-10 01:59:19
|
Revision: 8404 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8404&view=rev Author: jdh2358 Date: 2010-06-10 01:59:13 +0000 (Thu, 10 Jun 2010) Log Message: ----------- added bbox_inches and pad_inches to savefig signature Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2010-06-09 22:05:09 UTC (rev 8403) +++ trunk/matplotlib/lib/matplotlib/figure.py 2010-06-10 01:59:13 UTC (rev 8404) @@ -992,7 +992,7 @@ savefig(fname, dpi=None, facecolor='w', edgecolor='w', orientation='portrait', papertype=None, format=None, - transparent=False): + transparent=False, bbox_inches=None, pad_inches=0.1): Save the current figure. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-09-06 01:52:04
|
Revision: 8682 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8682&view=rev Author: efiring Date: 2010-09-06 01:51:58 +0000 (Mon, 06 Sep 2010) Log Message: ----------- figure.py, axes tracking: ensure a unique key is provided. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2010-09-05 19:33:42 UTC (rev 8681) +++ trunk/matplotlib/lib/matplotlib/figure.py 2010-09-06 01:51:58 UTC (rev 8682) @@ -82,6 +82,14 @@ hash(key) except TypeError: raise ValueError("first argument, %s, is not a valid key" % key) + + a_existing = self.get(key) + if a_existing is not None: + Stack.remove(self, (key, a_existing)) + warnings.Warn( + "key %s already existed; Axes is being replaced" % key) + # I don't think the above should ever happen. + if a in self: return None return Stack.push(self, (key, a)) @@ -648,15 +656,14 @@ %(Axes)s """ + if not len(args): return key = self._make_key(*args, **kwargs) - ax = self._axstack.get(key) if ax is not None: self.sca(ax) return ax - if not len(args): return if isinstance(args[0], Axes): a = args[0] assert(a.get_figure() is self) @@ -674,8 +681,7 @@ a = projection_factory(projection, self, rect, **kwargs) - if a not in self._axstack: - self._axstack.add(key, a) + self._axstack.add(key, a) self.sca(a) return a @@ -708,15 +714,17 @@ %(Axes)s """ + if not len(args): return - kwargs = kwargs.copy() + if len(args) == 1 and isinstance(args[0], int): + args = tuple([int(c) for c in str(args[0])]) - if not len(args): return - if isinstance(args[0], SubplotBase): a = args[0] assert(a.get_figure() is self) + key = self._make_key(*args, **kwargs) else: + kwargs = kwargs.copy() ispolar = kwargs.pop('polar', False) projection = kwargs.pop('projection', None) if ispolar: @@ -729,6 +737,7 @@ projection_class = get_projection_class(projection) + # Remake the key without projection kwargs: key = self._make_key(*args, **kwargs) ax = self._axstack.get(key) if ax is not None: @@ -737,6 +746,11 @@ return ax else: self._axstack.remove(ax) + # Undocumented convenience behavior: + # subplot(111); subplot(111, projection='polar') + # will replace the first with the second. + # Without this, add_subplot would be simpler and + # more similar to add_axes. a = subplot_class_factory(projection_class)(self, *args, **kwargs) self._axstack.add(key, a) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2010-09-09 00:35:18
|
Revision: 8693 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8693&view=rev Author: efiring Date: 2010-09-09 00:35:12 +0000 (Thu, 09 Sep 2010) Log Message: ----------- figure.py: preserve the order in which Axes were added to the figure Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2010-09-08 15:53:27 UTC (rev 8692) +++ trunk/matplotlib/lib/matplotlib/figure.py 2010-09-09 00:35:12 UTC (rev 8693) @@ -41,25 +41,35 @@ """ Specialization of the Stack to handle all tracking of Axes in a Figure. This requires storing - key, axes pairs. The key is based on the args and kwargs - used in generating the Axes. + key, (ind, axes) pairs. The key is based on the args and kwargs + used in generating the Axes. ind is a serial number for tracking + the order in which axes were added. """ + def __init__(self): + Stack.__init__(self) + self._ind = 0 + def as_list(self): """ Return a list of the Axes instances that have been added to the figure """ - return [a for k, a in self._elements] + ia_list = [a for k, a in self._elements] + ia_list.sort() + return [a for i, a in ia_list] def get(self, key): """ Return the Axes instance that was added with *key*. If it is not present, return None. """ - return dict(self._elements).get(key) + item = dict(self._elements).get(key) + if item is None: + return None + return item[1] def _entry_from_axes(self, e): - k = dict([(a, k) for (k, a) in self._elements])[e] - return k, e + ind, k = dict([(a, (ind, k)) for (k, (ind, a)) in self._elements])[e] + return (k, (ind, e)) def remove(self, a): Stack.remove(self, self._entry_from_axes(a)) @@ -92,13 +102,14 @@ if a in self: return None - return Stack.push(self, (key, a)) + self._ind += 1 + return Stack.push(self, (key, (self._ind, a))) def __call__(self): if not len(self._elements): return self._default else: - return self._elements[self._pos][1] + return self._elements[self._pos][1][1] def __contains__(self, a): return a in self.as_list() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |