SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S





1
(2)
2
3
(1)
4
(5)
5
(2)
6
(3)
7
(8)
8
(1)
9
10
11
12
(2)
13
(1)
14
(2)
15
16
(3)
17
(11)
18
(5)
19
(5)
20
(2)
21
(2)
22
(6)
23
(1)
24
25
(5)
26
27
(3)
28
(14)
29
(6)
30
31






Showing results of 90

<< < 1 2 3 4 (Page 4 of 4)
From: <lee...@us...> - 2009年05月07日 03:51:04
Revision: 7090
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7090&view=rev
Author: leejjoon
Date: 2009年05月07日 03:50:55 +0000 (2009年5月07日)
Log Message:
-----------
print_ps with mixed-renderer
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/backend_bases.py
 trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年05月07日 03:40:40 UTC (rev 7089)
+++ trunk/matplotlib/CHANGELOG	2009年05月07日 03:50:55 UTC (rev 7090)
@@ -1,4 +1,8 @@
 ======================================================================
+2009年05月06日 print_ps now uses mixed-mode renderer. Axes.draw rasterize
+ artists whose zorder smaller than rasterization_zorder.
+ -JJL
+
 2009年05月06日 Per-artist Rasterization, originally by Eric Bruning. -JJ
 
 2009年05月05日 Add an example that shows how to make a plot that updates
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年05月07日 03:40:40 UTC (rev 7089)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年05月07日 03:50:55 UTC (rev 7090)
@@ -8,6 +8,7 @@
 rcParams = matplotlib.rcParams
 
 import matplotlib.artist as martist
+from matplotlib.artist import allow_rasterization
 import matplotlib.axis as maxis
 import matplotlib.cbook as cbook
 import matplotlib.collections as mcoll
@@ -531,6 +532,8 @@
 self._frameon = frameon
 self._axisbelow = rcParams['axes.axisbelow']
 
+ self._rasterization_zorder = -30000
+
 self._hold = rcParams['axes.hold']
 self._connected = {} # a dict from events to (id, func)
 self.cla()
@@ -1566,6 +1569,19 @@
 """
 self._autoscaleYon = b
 
+ def set_rasterization_zorder(self, z):
+ """
+ Set zorder value below which artists will be rasterized
+ """
+ self._rasterization_zorder = z
+
+ def get_rasterization_zorder(self):
+ """
+ Get zorder value below which artists will be rasterized
+ """
+ return self._rasterization_zorder 
+
+
 def autoscale_view(self, tight=False, scalex=True, scaley=True):
 """
 autoscale the view limits using the data limits. You can
@@ -1620,15 +1636,55 @@
 else:
 self.apply_aspect()
 
+
+ artists = []
+
+ artists.extend(self.collections)
+ artists.extend(self.patches)
+ artists.extend(self.lines)
+ artists.extend(self.texts)
+ artists.extend(self.artists)
+ if self.axison and not inframe:
+ if self._axisbelow:
+ self.xaxis.set_zorder(0.5)
+ self.yaxis.set_zorder(0.5)
+ else:
+ self.xaxis.set_zorder(2.5)
+ self.yaxis.set_zorder(2.5)
+ artists.extend([self.xaxis, self.yaxis])
+ if not inframe: artists.append(self.title)
+ artists.extend(self.tables)
+ if self.legend_ is not None:
+ artists.append(self.legend_)
+
+ # the frame draws the edges around the axes patch -- we
+ # decouple these so the patch can be in the background and the
+ # frame in the foreground.
+ if self.axison and self._frameon:
+ artists.append(self.frame)
+
+
+ dsu = [ (a.zorder, i, a) for i, a in enumerate(artists)
+ if not a.get_animated() ]
+ dsu.sort()
+
+
+ # rasterze artists with negative zorder
+ # if the minimum zorder is negative, start rasterization
+ rasterization_zorder = self._rasterization_zorder
+ if len(dsu) > 0 and dsu[0][0] < rasterization_zorder:
+ renderer.start_rasterizing()
+ dsu_rasterized = [l for l in dsu if l[0] < rasterization_zorder]
+ dsu = [l for l in dsu if l[0] >= rasterization_zorder]
+ else:
+ dsu_rasterized = []
+ 
+ 
 # the patch draws the background rectangle -- the frame below
 # will draw the edges
 if self.axison and self._frameon:
 self.patch.draw(renderer)
 
- artists = []
-
-
-
 if len(self.images)<=1 or renderer.option_image_nocomposite():
 for im in self.images:
 im.draw(renderer)
@@ -1657,35 +1713,13 @@
 self.patch.get_path(),
 self.patch.get_transform())
 
- artists.extend(self.collections)
- artists.extend(self.patches)
- artists.extend(self.lines)
- artists.extend(self.texts)
- artists.extend(self.artists)
- if self.axison and not inframe:
- if self._axisbelow:
- self.xaxis.set_zorder(0.5)
- self.yaxis.set_zorder(0.5)
- else:
- self.xaxis.set_zorder(2.5)
- self.yaxis.set_zorder(2.5)
- artists.extend([self.xaxis, self.yaxis])
- if not inframe: artists.append(self.title)
- artists.extend(self.tables)
- if self.legend_ is not None:
- artists.append(self.legend_)
 
- # the frame draws the edges around the axes patch -- we
- # decouple these so the patch can be in the background and the
- # frame in the foreground.
- if self.axison and self._frameon:
- artists.append(self.frame)
 
+ if dsu_rasterized:
+ for zorder, i, a in dsu_rasterized:
+ a.draw(renderer)
+ renderer.stop_rasterizing()
 
- dsu = [ (a.zorder, i, a) for i, a in enumerate(artists)
- if not a.get_animated() ]
- dsu.sort()
-
 for zorder, i, a in dsu:
 a.draw(renderer)
 
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py	2009年05月07日 03:40:40 UTC (rev 7089)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py	2009年05月07日 03:50:55 UTC (rev 7090)
@@ -1443,6 +1443,7 @@
 facecolor=facecolor,
 edgecolor=edgecolor,
 orientation=orientation,
+ dryrun=True,
 **kwargs)
 renderer = self.figure._cachedRenderer
 bbox_inches = self.figure.get_tightbbox(renderer)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2009年05月07日 03:40:40 UTC (rev 7089)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py	2009年05月07日 03:50:55 UTC (rev 7090)
@@ -33,6 +33,9 @@
 from matplotlib.path import Path
 from matplotlib.transforms import Affine2D
 
+from matplotlib.backends.backend_mixed import MixedModeRenderer
+
+
 import numpy as npy
 import binascii
 import re
@@ -843,8 +846,13 @@
 def print_eps(self, outfile, *args, **kwargs):
 return self._print_ps(outfile, 'eps', *args, **kwargs)
 
+
+
+
+
+
 def _print_ps(self, outfile, format, *args, **kwargs):
- papertype = kwargs.get("papertype", rcParams['ps.papersize'])
+ papertype = kwargs.pop("papertype", rcParams['ps.papersize'])
 papertype = papertype.lower()
 if papertype == 'auto':
 pass
@@ -852,25 +860,28 @@
 raise RuntimeError( '%s is not a valid papertype. Use one \
 of %s'% (papertype, ', '.join( papersize.keys() )) )
 
- orientation = kwargs.get("orientation", "portrait").lower()
+ orientation = kwargs.pop("orientation", "portrait").lower()
 if orientation == 'landscape': isLandscape = True
 elif orientation == 'portrait': isLandscape = False
 else: raise RuntimeError('Orientation must be "portrait" or "landscape"')
 
 self.figure.set_dpi(72) # Override the dpi kwarg
- imagedpi = kwargs.get("dpi", 72)
- facecolor = kwargs.get("facecolor", "w")
- edgecolor = kwargs.get("edgecolor", "w")
+ imagedpi = kwargs.pop("dpi", 72)
+ facecolor = kwargs.pop("facecolor", "w")
+ edgecolor = kwargs.pop("edgecolor", "w")
 
 if rcParams['text.usetex']:
 self._print_figure_tex(outfile, format, imagedpi, facecolor, edgecolor,
- orientation, isLandscape, papertype)
+ orientation, isLandscape, papertype,
+ **kwargs)
 else:
 self._print_figure(outfile, format, imagedpi, facecolor, edgecolor,
- orientation, isLandscape, papertype)
+ orientation, isLandscape, papertype,
+ **kwargs)
 
 def _print_figure(self, outfile, format, dpi=72, facecolor='w', edgecolor='w',
- orientation='portrait', isLandscape=False, papertype=None):
+ orientation='portrait', isLandscape=False, papertype=None,
+ **kwargs):
 """
 Render the figure to hardcopy. Set the figure patch face and
 edge colors. This is useful because some of the GUIs have a
@@ -939,10 +950,30 @@
 self.figure.set_facecolor(facecolor)
 self.figure.set_edgecolor(edgecolor)
 
- self._pswriter = StringIO()
- renderer = RendererPS(width, height, self._pswriter, imagedpi=dpi)
+
+ dryrun = kwargs.get("dryrun", False)
+ if dryrun:
+ class NullWriter(object):
+ def write(self, *kl, **kwargs):
+ pass
+ 
+ self._pswriter = NullWriter()
+ else:
+ self._pswriter = StringIO()
+
+
+ # mixed mode rendering
+ _bbox_inches_restore = kwargs.pop("bbox_inches_restore", None)
+ ps_renderer = RendererPS(width, height, self._pswriter, imagedpi=dpi)
+ renderer = MixedModeRenderer(self.figure,
+ width, height, dpi, ps_renderer,
+ bbox_inches_restore=_bbox_inches_restore)
+
 self.figure.draw(renderer)
 
+ if dryrun: # return immediately if dryrun (tightbbox=True)
+ return
+
 self.figure.set_facecolor(origfacecolor)
 self.figure.set_edgecolor(origedgecolor)
 
@@ -962,7 +993,7 @@
 Ndict = len(psDefs)
 print >>fh, "%%BeginProlog"
 if not rcParams['ps.useafm']:
- Ndict += len(renderer.used_characters)
+ Ndict += len(ps_renderer.used_characters)
 print >>fh, "/mpldict %d dict def"%Ndict
 print >>fh, "mpldict begin"
 for d in psDefs:
@@ -970,7 +1001,7 @@
 for l in d.split('\n'):
 print >>fh, l.strip()
 if not rcParams['ps.useafm']:
- for font_filename, chars in renderer.used_characters.values():
+ for font_filename, chars in ps_renderer.used_characters.values():
 if len(chars):
 font = FT2Font(font_filename)
 cmap = font.get_charmap()
@@ -1019,7 +1050,8 @@
 shutil.move(tmpfile, outfile)
 
 def _print_figure_tex(self, outfile, format, dpi, facecolor, edgecolor,
- orientation, isLandscape, papertype):
+ orientation, isLandscape, papertype,
+ **kwargs):
 """
 If text.usetex is True in rc, a temporary pair of tex/eps files
 are created to allow tex to manage the text layout via the PSFrags
@@ -1051,10 +1083,29 @@
 self.figure.set_facecolor(facecolor)
 self.figure.set_edgecolor(edgecolor)
 
- self._pswriter = StringIO()
- renderer = RendererPS(width, height, self._pswriter, imagedpi=dpi)
+ dryrun = kwargs.get("dryrun", False)
+ if dryrun:
+ class NullWriter(object):
+ def write(self, *kl, **kwargs):
+ pass
+ 
+ self._pswriter = NullWriter()
+ else:
+ self._pswriter = StringIO()
+
+
+ # mixed mode rendering
+ _bbox_inches_restore = kwargs.pop("bbox_inches_restore", None)
+ ps_renderer = RendererPS(width, height, self._pswriter, imagedpi=dpi)
+ renderer = MixedModeRenderer(self.figure,
+ width, height, dpi, ps_renderer,
+ bbox_inches_restore=_bbox_inches_restore)
+
 self.figure.draw(renderer)
 
+ if dryrun: # return immediately if dryrun (tightbbox=True)
+ return
+
 self.figure.set_facecolor(origfacecolor)
 self.figure.set_edgecolor(origedgecolor)
 
@@ -1117,11 +1168,11 @@
 paper will be used to prevent clipping.'%(papertype, temp_papertype), 'helpful')
 
 
- texmanager = renderer.get_texmanager()
+ texmanager = ps_renderer.get_texmanager()
 font_preamble = texmanager.get_font_preamble()
 custom_preamble = texmanager.get_custom_preamble()
 
- convert_psfrags(tmpfile, renderer.psfrag, font_preamble,
+ convert_psfrags(tmpfile, ps_renderer.psfrag, font_preamble,
 custom_preamble, paperWidth, paperHeight,
 orientation)
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年05月07日 03:40:46
Revision: 7089
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7089&view=rev
Author: leejjoon
Date: 2009年05月07日 03:40:40 +0000 (2009年5月07日)
Log Message:
-----------
per-artist rasterization
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/artist.py
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/axis.py
 trunk/matplotlib/lib/matplotlib/collections.py
 trunk/matplotlib/lib/matplotlib/figure.py
 trunk/matplotlib/lib/matplotlib/image.py
 trunk/matplotlib/lib/matplotlib/legend.py
 trunk/matplotlib/lib/matplotlib/lines.py
 trunk/matplotlib/lib/matplotlib/patches.py
 trunk/matplotlib/lib/matplotlib/quiver.py
 trunk/matplotlib/lib/matplotlib/table.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年05月06日 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/CHANGELOG	2009年05月07日 03:40:40 UTC (rev 7089)
@@ -1,4 +1,6 @@
 ======================================================================
+2009年05月06日 Per-artist Rasterization, originally by Eric Bruning. -JJ
+
 2009年05月05日 Add an example that shows how to make a plot that updates
 using data from another process. Thanks to Robert
 Cimrman - RMM
Modified: trunk/matplotlib/lib/matplotlib/artist.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/artist.py	2009年05月06日 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/artist.py	2009年05月07日 03:40:40 UTC (rev 7089)
@@ -22,6 +22,38 @@
 # http://groups.google.com/groups?hl=en&lr=&threadm=mailman.5090.1098044946.5135.python-list%40python.org&rnum=1&prev=/groups%3Fq%3D__doc__%2Bauthor%253Ajdhunter%2540ace.bsd.uchicago.edu%26hl%3Den%26btnG%3DGoogle%2BSearch
 
 
+
+
+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. 
+ """
+ def before(artist, renderer):
+ if artist.get_rasterized():
+ renderer.start_rasterizing()
+
+ def after(artist, renderer):
+ if artist.get_rasterized():
+ renderer.stop_rasterizing()
+
+ # the axes class has a second argument inframe for its draw method.
+ def draw_wrapper(artist, renderer, *kl):
+ before(artist, renderer) 
+ draw(artist, renderer, *kl)
+ after(artist, renderer)
+
+ # "safe wrapping" to exactly replicate anything we haven't overridden above
+ draw_wrapper.__name__ = draw.__name__
+ draw_wrapper.__dict__ = draw.__dict__
+ 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
@@ -45,6 +77,7 @@
 self._label = ''
 self._picker = None
 self._contains = None
+ self._rasterized = None
 
 self.eventson = False # fire events only if eventson
 self._oid = 0 # an observer id
@@ -510,7 +543,23 @@
 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"):
+ warnings.warn("Rasterization of '%s' will be ignored" % self)
 
+ self._rasterized = rasterized
+
 def draw(self, renderer, *args, **kwargs):
 'Derived classes drawing method'
 if not self.get_visible(): return
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年05月06日 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年05月07日 03:40:40 UTC (rev 7089)
@@ -1602,6 +1602,7 @@
 
 #### Drawing
 
+ @allow_rasterization
 def draw(self, renderer=None, inframe=False):
 "Draw everything (plot lines, axes, labels)"
 if renderer is None:
Modified: trunk/matplotlib/lib/matplotlib/axis.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis.py	2009年05月06日 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/axis.py	2009年05月07日 03:40:40 UTC (rev 7089)
@@ -5,6 +5,7 @@
 
 from matplotlib import rcParams
 import matplotlib.artist as artist
+from matplotlib.artist import allow_rasterization
 import matplotlib.cbook as cbook
 import matplotlib.font_manager as font_manager
 import matplotlib.lines as mlines
@@ -176,6 +177,7 @@
 'Return the tick location (data coords) as a scalar'
 return self._loc
 
+ @allow_rasterization
 def draw(self, renderer):
 if not self.get_visible(): return
 renderer.open_group(self.__name__)
@@ -719,6 +721,7 @@
 bbox2 = mtransforms.Bbox.from_extents(0, 0, 0, 0)
 return bbox, bbox2
 
+ @allow_rasterization
 def draw(self, renderer, *args, **kwargs):
 'Draw the axis lines, grid lines, tick lines and labels'
 ticklabelBoxes = []
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py	2009年05月06日 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/collections.py	2009年05月07日 03:40:40 UTC (rev 7089)
@@ -17,6 +17,7 @@
 import matplotlib.cm as cm
 import matplotlib.transforms as transforms
 import matplotlib.artist as artist
+from matplotlib.artist import allow_rasterization
 import matplotlib.backend_bases as backend_bases
 import matplotlib.path as mpath
 import matplotlib.mlab as mlab
@@ -190,6 +191,7 @@
 
 return transform, transOffset, offsets, paths
 
+ @allow_rasterization
 def draw(self, renderer):
 if not self.get_visible(): return
 renderer.open_group(self.__class__.__name__)
@@ -594,6 +596,7 @@
 def get_datalim(self, transData):
 return self._bbox
 
+ @allow_rasterization
 def draw(self, renderer):
 if not self.get_visible(): return
 renderer.open_group(self.__class__.__name__)
@@ -781,6 +784,7 @@
 
 __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
 
+ @allow_rasterization
 def draw(self, renderer):
 self._transforms = [
 transforms.Affine2D().rotate(-self._rotation).scale(
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py	2009年05月06日 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/figure.py	2009年05月07日 03:40:40 UTC (rev 7089)
@@ -15,7 +15,7 @@
 import time
 
 import artist
-from artist import Artist
+from artist import Artist, allow_rasterization
 from axes import Axes, SubplotBase, subplot_class_factory
 from cbook import flatten, allequal, Stack, iterable, dedent
 import _image
@@ -727,6 +727,7 @@
 """
 self.clf()
 
+ @allow_rasterization
 def draw(self, renderer):
 """
 Render the figure using :class:`matplotlib.backend_bases.RendererBase` instance renderer
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py	2009年05月06日 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/image.py	2009年05月07日 03:40:40 UTC (rev 7089)
@@ -11,6 +11,7 @@
 
 from matplotlib import rcParams
 import matplotlib.artist as martist
+from matplotlib.artist import allow_rasterization
 import matplotlib.colors as mcolors
 import matplotlib.cm as cm
 import matplotlib.cbook as cbook
@@ -225,7 +226,7 @@
 norm=self._filternorm, radius=self._filterrad)
 return im
 
-
+ @allow_rasterization
 def draw(self, renderer, *args, **kwargs):
 if not self.get_visible(): return
 if (self.axes.get_xscale() != 'linear' or
@@ -571,6 +572,7 @@
 im.is_grayscale = self.is_grayscale
 return im
 
+ @allow_rasterization
 def draw(self, renderer, *args, **kwargs):
 if not self.get_visible(): return
 im = self.make_image(renderer.get_image_magnification())
@@ -723,6 +725,7 @@
 
 return im
 
+ @allow_rasterization
 def draw(self, renderer, *args, **kwargs):
 if not self.get_visible(): return
 # todo: we should be able to do some cacheing here
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py	2009年05月06日 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/legend.py	2009年05月07日 03:40:40 UTC (rev 7089)
@@ -26,7 +26,7 @@
 import numpy as np
 
 from matplotlib import rcParams
-from matplotlib.artist import Artist
+from matplotlib.artist import Artist, allow_rasterization
 from matplotlib.cbook import is_string_like, iterable, silent_list, safezip
 from matplotlib.font_manager import FontProperties
 from matplotlib.lines import Line2D
@@ -323,6 +323,7 @@
 
 return x+xdescent, y+ydescent
 
+ @allow_rasterization
 def draw(self, renderer):
 "Draw everything that belongs to the legend"
 if not self.get_visible(): return
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py	2009年05月06日 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/lines.py	2009年05月07日 03:40:40 UTC (rev 7089)
@@ -18,6 +18,8 @@
 from transforms import Affine2D, Bbox, TransformedPath, IdentityTransform
 
 from matplotlib import rcParams
+from artist import allow_rasterization
+
 # special-purpose marker identifiers:
 (TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN,
 CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN) = range(8)
@@ -459,6 +461,7 @@
 if len(x)<2: return 1
 return np.alltrue(x[1:]-x[0:-1]>=0)
 
+ @allow_rasterization
 def draw(self, renderer):
 if self._invalid:
 self.recache()
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2009年05月06日 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2009年05月07日 03:40:40 UTC (rev 7089)
@@ -7,6 +7,7 @@
 import numpy as np
 import matplotlib.cbook as cbook
 import matplotlib.artist as artist
+from matplotlib.artist import allow_rasterization
 import matplotlib.colors as colors
 import matplotlib.transforms as transforms
 from matplotlib.path import Path
@@ -260,7 +261,7 @@
 'Return the current hatching pattern'
 return self._hatch
 
-
+ @allow_rasterization
 def draw(self, renderer):
 'Draw the :class:`Patch` to the given *renderer*.'
 if not self.get_visible(): return
@@ -1176,6 +1177,7 @@
 self.theta2 = theta2
 __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
 
+ @allow_rasterization
 def draw(self, renderer):
 """
 Ellipses are normally drawn using an approximation that uses
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py	2009年05月06日 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/quiver.py	2009年05月07日 03:40:40 UTC (rev 7089)
@@ -21,6 +21,7 @@
 import matplotlib.transforms as transforms
 import matplotlib.text as mtext
 import matplotlib.artist as martist
+from matplotlib.artist import allow_rasterization
 import matplotlib.font_manager as font_manager
 from matplotlib.cbook import delete_masked_points
 from matplotlib.patches import CirclePolygon
@@ -282,6 +283,7 @@
 else:
 return y
 
+ @allow_rasterization
 def draw(self, renderer):
 self._init()
 self.vector.draw(renderer)
@@ -418,6 +420,7 @@
 if self.width is None:
 self.width = 0.06 * self.span / sn
 
+ @allow_rasterization
 def draw(self, renderer):
 self._init()
 if self._new_UV or self.angles == 'xy':
Modified: trunk/matplotlib/lib/matplotlib/table.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/table.py	2009年05月06日 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/table.py	2009年05月07日 03:40:40 UTC (rev 7089)
@@ -23,7 +23,7 @@
 import warnings
 
 import artist
-from artist import Artist
+from artist import Artist, allow_rasterization
 from patches import Rectangle
 from cbook import is_string_like
 from text import Text
@@ -90,6 +90,7 @@
 
 return fontsize
 
+ @allow_rasterization
 def draw(self, renderer):
 if not self.get_visible(): return
 # draw the rectangle
@@ -215,6 +216,7 @@
 def _approx_text_height(self):
 return self.FONTSIZE/72.0*self.figure.dpi/self._axes.bbox.height * 1.2
 
+ @allow_rasterization
 def draw(self, renderer):
 # Need a renderer to do hit tests on mouseevent; assume the last one will do
 if renderer is None:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年05月06日 23:03:06
Revision: 7088
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7088&view=rev
Author: efiring
Date: 2009年05月06日 23:02:57 +0000 (2009年5月06日)
Log Message:
-----------
Spelling correction and other minor cleanups in mlab
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/mlab.py
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py	2009年05月06日 20:52:55 UTC (rev 7087)
+++ trunk/matplotlib/lib/matplotlib/mlab.py	2009年05月06日 23:02:57 UTC (rev 7088)
@@ -175,14 +175,7 @@
 import matplotlib.nxutils as nxutils
 import matplotlib.cbook as cbook
 
-# set is a new builtin function in 2.4; delete the following when
-# support for 2.3 is dropped.
-try:
- set
-except NameError:
- from sets import Set as set
 
-
 def linspace(*args, **kw):
 warnings.warn("use numpy.linspace", DeprecationWarning)
 return np.linspace(*args, **kw)
@@ -617,12 +610,10 @@
 :func:`polyval`
 polyval function
 """
- warnings.warn("use numpy.poyfit", DeprecationWarning)
+ warnings.warn("use numpy.polyfit", DeprecationWarning)
 return np.polyfit(*args, **kwargs)
 
 
-
-
 def polyval(*args, **kwargs):
 """
 *y* = polyval(*p*, *x*)
@@ -899,14 +890,8 @@
 """
 warnings.warn("Use numpy.trapz(y,x) instead of trapz(x,y)", DeprecationWarning)
 return np.trapz(y, x)
- #if len(x)!=len(y):
- # raise ValueError, 'x and y must have the same length'
- #if len(x)<2:
- # raise ValueError, 'x and y must have > 1 element'
- #return np.sum(0.5*np.diff(x)*(y[1:]+y[:-1]))
 
 
-
 def longest_contiguous_ones(x):
 """
 Return the indices of the longest stretch of contiguous ones in *x*,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年05月06日 20:53:02
Revision: 7087
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7087&view=rev
Author: efiring
Date: 2009年05月06日 20:52:55 +0000 (2009年5月06日)
Log Message:
-----------
Give a more descriptive name (multiprocess.py) to new example
Added Paths:
-----------
 trunk/matplotlib/examples/misc/multiprocess.py
Removed Paths:
-------------
 trunk/matplotlib/examples/misc/log.py
Deleted: trunk/matplotlib/examples/misc/log.py
===================================================================
--- trunk/matplotlib/examples/misc/log.py	2009年05月06日 18:13:41 UTC (rev 7086)
+++ trunk/matplotlib/examples/misc/log.py	2009年05月06日 20:52:55 UTC (rev 7087)
@@ -1,87 +0,0 @@
-#Demo of using multiprocessing for generating data in one process and plotting
-#in another.
-#Written by Robert Cimrman
-#Requires >= Python 2.6 for the multiprocessing module or having the
-#standalone processing module installed
-import time
-try:
- from multiprocessing import Process, Pipe
-except ImportError:
- from processing import Process, Pipe
-from Queue import Empty
-import numpy as np
-import pylab
-import gobject
-
-class ProcessPlotter(object):
-
- def __init__(self):
- self.x = []
- self.y = []
-
- def terminate(self):
- pylab.close('all')
-
- def poll_draw(self):
-
- def call_back():
- while 1:
- if not self.pipe.poll():
- break
-
- command = self.pipe.recv()
-
- if command is None:
- self.terminate()
- return False
-
- else:
- self.x.append(command[0])
- self.y.append(command[1])
- self.ax.plot(self.x, self.y, 'ro')
-
- self.fig.canvas.draw()
- return True
-
- return call_back
-
- def __call__(self, pipe):
- print 'starting plotter...'
-
- self.pipe = pipe
- self.fig = pylab.figure()
-
- self.ax = self.fig.add_subplot(111)
- self.gid = gobject.timeout_add(1000, self.poll_draw())
-
- print '...done'
- pylab.show()
-
-
-class NBPlot(object):
- def __init__(self):
- self.plot_pipe, plotter_pipe = Pipe()
- self.plotter = ProcessPlotter()
- self.plot_process = Process(target = self.plotter,
- args = (plotter_pipe,))
- self.plot_process.daemon = True
- self.plot_process.start()
-
- def plot(self, finished=False):
- send = self.plot_pipe.send
- if finished:
- send(None)
- else:
- data = np.random.random(2)
- send(data)
-
-def main():
- pl = NBPlot()
- for ii in xrange(10):
- pl.plot()
- time.sleep(0.5)
- raw_input('press Enter...')
- pl.plot(finished=True)
-
-if __name__ == '__main__':
- main()
Copied: trunk/matplotlib/examples/misc/multiprocess.py (from rev 7086, trunk/matplotlib/examples/misc/log.py)
===================================================================
--- trunk/matplotlib/examples/misc/multiprocess.py	 (rev 0)
+++ trunk/matplotlib/examples/misc/multiprocess.py	2009年05月06日 20:52:55 UTC (rev 7087)
@@ -0,0 +1,87 @@
+#Demo of using multiprocessing for generating data in one process and plotting
+#in another.
+#Written by Robert Cimrman
+#Requires >= Python 2.6 for the multiprocessing module or having the
+#standalone processing module installed
+import time
+try:
+ from multiprocessing import Process, Pipe
+except ImportError:
+ from processing import Process, Pipe
+from Queue import Empty
+import numpy as np
+import pylab
+import gobject
+
+class ProcessPlotter(object):
+
+ def __init__(self):
+ self.x = []
+ self.y = []
+
+ def terminate(self):
+ pylab.close('all')
+
+ def poll_draw(self):
+
+ def call_back():
+ while 1:
+ if not self.pipe.poll():
+ break
+
+ command = self.pipe.recv()
+
+ if command is None:
+ self.terminate()
+ return False
+
+ else:
+ self.x.append(command[0])
+ self.y.append(command[1])
+ self.ax.plot(self.x, self.y, 'ro')
+
+ self.fig.canvas.draw()
+ return True
+
+ return call_back
+
+ def __call__(self, pipe):
+ print 'starting plotter...'
+
+ self.pipe = pipe
+ self.fig = pylab.figure()
+
+ self.ax = self.fig.add_subplot(111)
+ self.gid = gobject.timeout_add(1000, self.poll_draw())
+
+ print '...done'
+ pylab.show()
+
+
+class NBPlot(object):
+ def __init__(self):
+ self.plot_pipe, plotter_pipe = Pipe()
+ self.plotter = ProcessPlotter()
+ self.plot_process = Process(target = self.plotter,
+ args = (plotter_pipe,))
+ self.plot_process.daemon = True
+ self.plot_process.start()
+
+ def plot(self, finished=False):
+ send = self.plot_pipe.send
+ if finished:
+ send(None)
+ else:
+ data = np.random.random(2)
+ send(data)
+
+def main():
+ pl = NBPlot()
+ for ii in xrange(10):
+ pl.plot()
+ time.sleep(0.5)
+ raw_input('press Enter...')
+ pl.plot(finished=True)
+
+if __name__ == '__main__':
+ main()
Property changes on: trunk/matplotlib/examples/misc/multiprocess.py
___________________________________________________________________
Added: svn:mergeinfo
 + /branches/v0_91_maint/examples/misc/log.py:5753-5771
/branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ry...@us...> - 2009年05月06日 18:13:50
Revision: 7086
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7086&view=rev
Author: ryanmay
Date: 2009年05月06日 18:13:41 +0000 (2009年5月06日)
Log Message:
-----------
Add an example of an updating plot using (multi)processing. Credit goes to Robert Cimrman.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
Added Paths:
-----------
 trunk/matplotlib/examples/misc/log.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年05月05日 17:27:23 UTC (rev 7085)
+++ trunk/matplotlib/CHANGELOG	2009年05月06日 18:13:41 UTC (rev 7086)
@@ -1,9 +1,13 @@
 ======================================================================
-2009年05月05日 Add Axes.get_legend_handles_labels method -JJL
+2009年05月05日 Add an example that shows how to make a plot that updates
+ using data from another process. Thanks to Robert
+ Cimrman - RMM
 
-2009年05月04日 Fix bug that Text.Annotation is still drawn while set to 
- not visible.-JJL
+2009年05月05日 Add Axes.get_legend_handles_labels method. - JJL
 
+2009年05月04日 Fix bug that Text.Annotation is still drawn while set to
+ not visible. - JJL
+
 2009年05月04日 Added TJ's fill_betweenx patch - JDH
 
 2009年05月02日 Added options to plotfile based on question from
Added: trunk/matplotlib/examples/misc/log.py
===================================================================
--- trunk/matplotlib/examples/misc/log.py	 (rev 0)
+++ trunk/matplotlib/examples/misc/log.py	2009年05月06日 18:13:41 UTC (rev 7086)
@@ -0,0 +1,87 @@
+#Demo of using multiprocessing for generating data in one process and plotting
+#in another.
+#Written by Robert Cimrman
+#Requires >= Python 2.6 for the multiprocessing module or having the
+#standalone processing module installed
+import time
+try:
+ from multiprocessing import Process, Pipe
+except ImportError:
+ from processing import Process, Pipe
+from Queue import Empty
+import numpy as np
+import pylab
+import gobject
+
+class ProcessPlotter(object):
+
+ def __init__(self):
+ self.x = []
+ self.y = []
+
+ def terminate(self):
+ pylab.close('all')
+
+ def poll_draw(self):
+
+ def call_back():
+ while 1:
+ if not self.pipe.poll():
+ break
+
+ command = self.pipe.recv()
+
+ if command is None:
+ self.terminate()
+ return False
+
+ else:
+ self.x.append(command[0])
+ self.y.append(command[1])
+ self.ax.plot(self.x, self.y, 'ro')
+
+ self.fig.canvas.draw()
+ return True
+
+ return call_back
+
+ def __call__(self, pipe):
+ print 'starting plotter...'
+
+ self.pipe = pipe
+ self.fig = pylab.figure()
+
+ self.ax = self.fig.add_subplot(111)
+ self.gid = gobject.timeout_add(1000, self.poll_draw())
+
+ print '...done'
+ pylab.show()
+
+
+class NBPlot(object):
+ def __init__(self):
+ self.plot_pipe, plotter_pipe = Pipe()
+ self.plotter = ProcessPlotter()
+ self.plot_process = Process(target = self.plotter,
+ args = (plotter_pipe,))
+ self.plot_process.daemon = True
+ self.plot_process.start()
+
+ def plot(self, finished=False):
+ send = self.plot_pipe.send
+ if finished:
+ send(None)
+ else:
+ data = np.random.random(2)
+ send(data)
+
+def main():
+ pl = NBPlot()
+ for ii in xrange(10):
+ pl.plot()
+ time.sleep(0.5)
+ raw_input('press Enter...')
+ pl.plot(finished=True)
+
+if __name__ == '__main__':
+ main()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年05月05日 17:27:28
Revision: 7085
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7085&view=rev
Author: leejjoon
Date: 2009年05月05日 17:27:23 +0000 (2009年5月05日)
Log Message:
-----------
Add Axes.get_legend_handles_labels method
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年05月05日 03:27:48 UTC (rev 7084)
+++ trunk/matplotlib/CHANGELOG	2009年05月05日 17:27:23 UTC (rev 7085)
@@ -1,4 +1,6 @@
 ======================================================================
+2009年05月05日 Add Axes.get_legend_handles_labels method -JJL
+
 2009年05月04日 Fix bug that Text.Annotation is still drawn while set to 
 not visible.-JJL
 
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年05月05日 03:27:48 UTC (rev 7084)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年05月05日 17:27:23 UTC (rev 7085)
@@ -3761,6 +3761,41 @@
 return lags, c, a, b
 xcorr.__doc__ = cbook.dedent(xcorr.__doc__) % martist.kwdocd
 
+
+ def _get_legend_handles(self):
+ "return artists that will be used as handles for legend"
+ handles = self.lines[:]
+ handles.extend(self.patches)
+ handles.extend([c for c in self.collections
+ if isinstance(c, mcoll.LineCollection)])
+ handles.extend([c for c in self.collections
+ if isinstance(c, mcoll.RegularPolyCollection)])
+ return handles
+
+
+ def get_legend_handles_labels(self):
+ """
+ return handles and labels for legend
+
+ ax.legend() is equibalent to ::
+
+ h, l = ax.get_legend_handles_labels()
+ ax.legend(h, l)
+ 
+ """
+
+ handles = []
+ labels = []
+ for handle in self._get_legend_handles():
+ label = handle.get_label()
+ if (label is not None and
+ label != '' and not label.startswith('_')):
+ handles.append(handle)
+ labels.append(label)
+
+ return handles, labels
+
+
 def legend(self, *args, **kwargs):
 """
 call signature::
@@ -3867,24 +3902,8 @@
 .. plot:: mpl_examples/api/legend_demo.py
 """
 
- def get_handles():
- handles = self.lines[:]
- handles.extend(self.patches)
- handles.extend([c for c in self.collections
- if isinstance(c, mcoll.LineCollection)])
- handles.extend([c for c in self.collections
- if isinstance(c, mcoll.RegularPolyCollection)])
- return handles
-
 if len(args)==0:
- handles = []
- labels = []
- for handle in get_handles():
- label = handle.get_label()
- if (label is not None and
- label != '' and not label.startswith('_')):
- handles.append(handle)
- labels.append(label)
+ handles, labels = self.get_legend_handles_labels()
 if len(handles) == 0:
 warnings.warn("No labeled objects found. "
 "Use label='...' kwarg on individual plots.")
@@ -3893,13 +3912,15 @@
 elif len(args)==1:
 # LABELS
 labels = args[0]
- handles = [h for h, label in zip(get_handles(), labels)]
+ handles = [h for h, label in zip(self._get_legend_handles(),
+ labels)]
 
 elif len(args)==2:
 if is_string_like(args[1]) or isinstance(args[1], int):
 # LABELS, LOC
 labels, loc = args
- handles = [h for h, label in zip(get_handles(), labels)]
+ handles = [h for h, label in zip(self._get_legend_handles(),
+ labels)]
 kwargs['loc'] = loc
 else:
 # LINES, LABELS
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年05月05日 03:28:01
Revision: 7084
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7084&view=rev
Author: leejjoon
Date: 2009年05月05日 03:27:48 +0000 (2009年5月05日)
Log Message:
-----------
Better support for tick (tick label) color handling in axes_grid.axisline
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/text.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/parasite_axes.py
Added Paths:
-----------
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/ChangeLog
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py	2009年05月04日 20:14:40 UTC (rev 7083)
+++ trunk/matplotlib/lib/matplotlib/text.py	2009年05月05日 03:27:48 UTC (rev 7084)
@@ -235,7 +235,7 @@
 thisx, thisy = 0.0, 0.0
 xmin, ymin = 0.0, 0.0
 width, height = 0.0, 0.0
- lines = self._text.split('\n')
+ lines = self.get_text().split('\n')
 
 whs = np.zeros((len(lines), 2))
 horizLayout = np.zeros((len(lines), 4))
@@ -406,10 +406,10 @@
 props = props.copy() # don't want to alter the pad externally
 pad = props.pop('pad', 4)
 pad = renderer.points_to_pixels(pad)
- if self._text == "":
+ if self.get_text() == "":
 self.arrow_patch.set_patchA(None)
 return
- 
+
 bbox = self.get_window_extent(renderer)
 l,b,w,h = bbox.bounds
 l-=pad/2.
@@ -451,7 +451,7 @@
 if renderer is not None:
 self._renderer = renderer
 if not self.get_visible(): return
- if self._text=='': return
+ if self.get_text()=='': return
 
 renderer.open_group('text', self.get_gid())
 
@@ -472,8 +472,8 @@
 self._draw_bbox(renderer, posx, posy)
 
 gc = renderer.new_gc()
- gc.set_foreground(self._color)
- gc.set_alpha(self._alpha)
+ gc.set_foreground(self.get_color())
+ gc.set_alpha(self.get_alpha())
 gc.set_url(self._url)
 if self.get_clip_on():
 gc.set_clip_rectangle(self.clipbox)
@@ -604,7 +604,7 @@
 need to know if the text has changed.
 """
 x, y = self.get_position()
- return (x, y, self._text, self._color,
+ return (x, y, self.get_text(), self._color,
 self._verticalalignment, self._horizontalalignment,
 hash(self._fontproperties), self._rotation,
 self.figure.dpi, id(self._renderer),
@@ -650,7 +650,7 @@
 if dpi is not None:
 dpi_orig = self.figure.dpi
 self.figure.dpi = dpi
- if self._text == '':
+ if self.get_text() == '':
 tx, ty = self._get_xy_display()
 return Bbox.from_bounds(tx,ty,0,0)
 
Added: trunk/matplotlib/lib/mpl_toolkits/axes_grid/ChangeLog
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/ChangeLog	 (rev 0)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/ChangeLog	2009年05月05日 03:27:48 UTC (rev 7084)
@@ -0,0 +1,8 @@
+2009年05月04日 Jae-Joon Lee <lee...@gm...>
+
+	* inset_locator.py (inset_axes, zoomed_inset_axes): axes_class support
+
+	* axislines.py : Better support for tick (tick label) color
+	handling
+	(Axes.get_children): fix typo
+
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py	2009年05月04日 20:14:40 UTC (rev 7083)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py	2009年05月05日 03:27:48 UTC (rev 7084)
@@ -200,16 +200,18 @@
 nth_coord = 1
 elif loc in ["bottom", "top"]:
 nth_coord = 0
+
+ self.nth_coord = nth_coord
+ self.axis = [self.axes.xaxis, self.axes.yaxis][self.nth_coord]
+
+ super(AxisLineHelper.Fixed, self).__init__(loc)
+
 if passingthrough_point is None:
 passingthrough_point = self._default_passthru_pt[loc]
 if label_direction is None:
 label_direction = loc
 
- super(AxisLineHelper.Fixed, self).__init__(loc)
 
- self.nth_coord = nth_coord
- self.axis = [self.axes.xaxis, self.axes.yaxis][self.nth_coord]
-
 self.passthru_pt = passingthrough_point
 
 _verts = np.array([[0., 0.],
@@ -456,11 +458,48 @@
 def __init__(self, ticksize, **kwargs):
 self.ticksize = ticksize
 self.locs_angles = []
+
+ self._axis = kwargs.pop("axis", None)
+ if self._axis is not None:
+ if "color" not in kwargs:
+ kwargs["color"] = "auto"
+ if ("mew" not in kwargs) and ("markeredgewidth" not in kwargs):
+ kwargs["markeredgewidth"] = "auto"
+
 super(Ticks, self).__init__([0.], [0.], **kwargs)
- #self.set_color("k")
- self.set_mec("k")
- self.set_mew(0.5)
 
+
+ def get_color(self):
+ if self._color == 'auto':
+ if self._axis is not None:
+ ticklines = self._axis.get_ticklines()
+ if ticklines:
+ color_from_axis = ticklines[0].get_color()
+ return color_from_axis
+ return "k"
+
+ return super(Ticks, self).get_color()
+
+
+ def get_markeredgecolor(self):
+ if self._markeredgecolor == 'auto':
+ return self.get_color()
+ else:
+ return self._markeredgecolor
+
+ def get_markeredgewidth(self):
+ if self._markeredgewidth == 'auto':
+ if self._axis is not None:
+ ticklines = self._axis.get_ticklines()
+ if ticklines:
+ width_from_axis = ticklines[0].get_markeredgewidth()
+ return width_from_axis
+ return .5
+
+ else:
+ return self._markeredgewidth
+
+
 def update_locs_angles(self, locs_angles, renderer):
 self.locs_angles = locs_angles
 
@@ -494,7 +533,7 @@
 gc = renderer.new_gc()
 self._set_gc_clip(gc)
 gc.set_foreground(self.get_markeredgecolor())
- gc.set_linewidth(self._markeredgewidth)
+ gc.set_linewidth(self.get_markeredgewidth())
 gc.set_alpha(self._alpha)
 
 offset = renderer.points_to_pixels(size)
@@ -515,16 +554,33 @@
 
 class TickLabels(mtext.Text):
 
- def __init__(self, size, color):
+ def __init__(self, size, **kwargs):
 self._locs_labels = []
 
+ self._axis = kwargs.pop("axis", None)
+ if self._axis is not None:
+ if "color" not in kwargs:
+ kwargs["color"] = "auto"
+
 super(TickLabels, self).__init__(x=0., y=0., text="",
- color=color,
+ **kwargs
 )
 
 def update_locs_labels(self, locs_labels, renderer):
 self._locs_labels = locs_labels
 
+ def get_color(self):
+ if self._color == 'auto':
+ if self._axis is not None:
+ ticklabels = self._axis.get_ticklabels()
+ if ticklabels:
+ color_from_axis = ticklabels[0].get_color()
+ return color_from_axis
+ return "k"
+
+ return super(TickLabels, self).get_color()
+
+
 def draw(self, renderer):
 if not self.get_visible(): return
 
@@ -549,6 +605,34 @@
 #else:
 # return Bbox.from_bounds(0, 0, 0, 0)
 
+
+class AxisLabel(mtext.Text):
+ def __init__(self, *kl, **kwargs):
+ self._axis = kwargs.pop("axis", None)
+ if self._axis is not None:
+ if "color" not in kwargs:
+ kwargs["color"] = "auto"
+
+ super(AxisLabel, self).__init__(*kl, **kwargs)
+
+ def get_color(self):
+ if self._color == 'auto':
+ if self._axis is not None:
+ label = self._axis.get_label()
+ if label:
+ color_from_axis = label.get_color()
+ return color_from_axis
+ return "k"
+
+ return super(AxisLabel, self).get_color()
+
+ def get_text(self):
+ t = super(AxisLabel, self).get_text()
+ if t == "__from_axes__":
+ return self._axis.get_label().get_text()
+ return self._text
+
+
 class AxisGridLineBase(martist.Artist):
 def __init__(self, *kl, **kw):
 super(AxisGridLineBase, self).__init__(*kl, **kw)
@@ -599,9 +683,9 @@
 
 
 if self._helper.label_direction in ["left", "right"]:
+ axis_name = "ytick"
+ else:
 axis_name = "xtick"
- else:
- axis_name = "ytick"
 
 
 if major_tick_size is None:
@@ -638,12 +722,13 @@
 
 transform=self._helper.get_tick_transform()+self.offset_transform
 
- self.major_ticks = Ticks(self.major_tick_size, transform=transform)
- self.minor_ticks = Ticks(self.minor_tick_size, transform=transform)
+ self.major_ticks = Ticks(self.major_tick_size,
+ transform=transform)
+ self.minor_ticks = Ticks(self.minor_tick_size,
+ transform=transform)
 
 
 size = rcParams['xtick.labelsize']
- color = rcParams['xtick.color']
 
 fontprops = font_manager.FontProperties(size=size)
 tvhl = self._helper.get_ticklabel_transform(self.major_tick_pad,
@@ -652,10 +737,14 @@
 trans=transform)
 trans, vert, horiz, label_a = tvhl
 
- self.major_ticklabels = TickLabels(size, color)
- self.minor_ticklabels = TickLabels(size, color)
+ color = rcParams['xtick.color']
+ self.major_ticklabels = TickLabels(size, color=color)
+ self.minor_ticklabels = TickLabels(size, color=color)
 
+ #self.major_ticklabels = TickLabels(size, axis=self.axis)
+ #self.minor_ticklabels = TickLabels(size, axis=self.axis)
 
+
 self.major_ticklabels.set(figure = self.axes.figure,
 rotation = label_a,
 transform=trans,
@@ -724,10 +813,10 @@
 color = rcParams['axes.labelcolor'],
 )
 
- self.label = mtext.Text(0, 0, "__from_axes__",
- fontproperties=fontprops,
- color = rcParams['axes.labelcolor'],
- )
+ self.label = AxisLabel(0, 0, "",
+ fontproperties=fontprops,
+ color = rcParams['axes.labelcolor'],
+ )
 self.label.set_figure(self.axes.figure)
 
 #self._set_artist_props(label)
@@ -752,15 +841,16 @@
 transform=tr2,
 va=va, ha=ha, rotation=a)
 
- if self.label.get_text() == "__from_axes__":
- label_text = self._helper.axis.get_label().get_text()
- self.label.set_text(label_text)
- self.label.draw(renderer)
- self.label.set_text("__from_axes__")
- else:
- self.label.draw(renderer)
+# if self.label.get_text() == "__from_axes__":
+# label_text = self.axis.get_label().get_text()
+# self.label.set_text(label_text)
+# self.label.draw(renderer)
+# self.label.set_text("__from_axes__")
+# else:
 
+ self.label.draw(renderer)
 
+
 def set_label(self, s):
 self.label.set_text(s)
 
@@ -857,9 +947,11 @@
 
 
 if self._helper.label_direction in ["left", "right"]:
+ axis_name = "ytick"
+ self.axis = axes.yaxis
+ else:
 axis_name = "xtick"
- else:
- axis_name = "ytick"
+ self.axis = axes.xaxis
 
 
 if major_tick_size is None:
@@ -897,12 +989,15 @@
 
 transform=self._helper.get_tick_transform()+self.offset_transform
 
- self.major_ticks = Ticks(self.major_tick_size, transform=transform)
- self.minor_ticks = Ticks(self.minor_tick_size, transform=transform)
+ self.major_ticks = Ticks(self.major_tick_size,
+ axis=self.axis,
+ transform=transform)
+ self.minor_ticks = Ticks(self.minor_tick_size,
+ axis=self.axis,
+ transform=transform)
 
 
 size = rcParams['xtick.labelsize']
- color = rcParams['xtick.color']
 
 fontprops = font_manager.FontProperties(size=size)
 tvhl = self._helper.get_ticklabel_transform(self.major_tick_pad,
@@ -911,10 +1006,14 @@
 trans=transform)
 trans, vert, horiz, label_a = tvhl
 
- self.major_ticklabels = TickLabels(size, color)
- self.minor_ticklabels = TickLabels(size, color)
+ #color = rcParams['xtick.color']
+ #self.major_ticklabels = TickLabels(size, color=color)
+ #self.minor_ticklabels = TickLabels(size, color=color)
 
+ self.major_ticklabels = TickLabels(size, axis=self.axis)
+ self.minor_ticklabels = TickLabels(size, axis=self.axis)
 
+
 self.major_ticklabels.set(figure = self.axes.figure,
 rotation = label_a,
 transform=trans,
@@ -1022,10 +1121,12 @@
 color = rcParams['axes.labelcolor'],
 )
 
- self.label = mtext.Text(0, 0, "__from_axes__",
- fontproperties=fontprops,
- color = rcParams['axes.labelcolor'],
- )
+ self.label = AxisLabel(0, 0, "__from_axes__",
+ color = "auto", #rcParams['axes.labelcolor'],
+ fontproperties=fontprops,
+ axis=self.axis,
+ )
+
 self.label.set_figure(self.axes.figure)
 
 #self._set_artist_props(label)
@@ -1050,15 +1151,16 @@
 transform=tr2,
 va=va, ha=ha, rotation=a)
 
- if self.label.get_text() == "__from_axes__":
- label_text = self._helper.axis.get_label().get_text()
- self.label.set_text(label_text)
- self.label.draw(renderer)
- self.label.set_text("__from_axes__")
- else:
- self.label.draw(renderer)
+# if self.label.get_text() == "__from_axes__":
+# label_text = self._helper.axis.get_label().get_text()
+# self.label.set_text(label_text)
+# self.label.draw(renderer)
+# self.label.set_text("__from_axes__")
+# else:
 
+ self.label.draw(renderer)
 
+
 def set_label(self, s):
 self.label.set_text(s)
 
@@ -1208,7 +1310,7 @@
 if self._axisline_on:
 children = self._axislines.values()+[self.gridlines]
 else:
- cildren = []
+ children = []
 children.extend(super(Axes, self).get_children())
 return children
 
@@ -1253,15 +1355,16 @@
 continue
 
 if axisline.label.get_visible():
- if axisline.label.get_text() == "__from_axes__":
- label_text = axisline._helper.axis.get_label().get_text()
- axisline.label.set_text(label_text)
- bb.append(axisline.label.get_window_extent(renderer))
- axisline.label.set_text("__from_axes__")
- else:
- bb.append(axisline.label.get_window_extent(renderer))
+# if axisline.label.get_text() == "__from_axes__":
+# label_text = axisline._helper.axis.get_label().get_text()
+# axisline.label.set_text(label_text)
+# bb.append(axisline.label.get_window_extent(renderer))
+# axisline.label.set_text("__from_axes__")
+# else:
 
+ bb.append(axisline.label.get_window_extent(renderer))
 
+
 if axisline.major_ticklabels.get_visible():
 bb.extend(axisline.major_ticklabels.get_window_extents(renderer))
 if axisline.minor_ticklabels.get_visible():
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py	2009年05月04日 20:14:40 UTC (rev 7083)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/inset_locator.py	2009年05月05日 03:27:48 UTC (rev 7084)
@@ -246,9 +246,13 @@
 
 def inset_axes(parent_axes, width, height, loc=1,
 bbox_to_anchor=None, bbox_transform=None,
+ axes_class=None,
 axes_kwargs=None,
 **kwargs):
 
+ if axes_class is None:
+ axes_class = Axes
+
 if axes_kwargs is None:
 inset_axes = Axes(parent_axes.figure, parent_axes.get_position())
 else:
@@ -268,24 +272,24 @@
 
 def zoomed_inset_axes(parent_axes, zoom, loc=1,
 bbox_to_anchor=None, bbox_transform=None,
+ axes_class=None,
 axes_kwargs=None,
- connects=None,
 **kwargs):
 
+ if axes_class is None:
+ axes_class = Axes
+
 if axes_kwargs is None:
- inset_axes = Axes(parent_axes.figure, parent_axes.get_position())
+ inset_axes = axes_class(parent_axes.figure, parent_axes.get_position())
 else:
- inset_axes = Axes(parent_axes.figure, parent_axes.get_position(),
- **axes_kwargs)
+ inset_axes = axes_class(parent_axes.figure, parent_axes.get_position(),
+ **axes_kwargs)
 
 axes_locator = AnchoredZoomLocator(parent_axes, zoom=zoom, loc=loc)
 inset_axes.set_axes_locator(axes_locator)
 
 _add_inset_axes(parent_axes, inset_axes)
 
- if connects is not None:
- pass
-
 return inset_axes
 
 
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/parasite_axes.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/parasite_axes.py	2009年05月04日 20:14:40 UTC (rev 7083)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/parasite_axes.py	2009年05月05日 03:27:48 UTC (rev 7084)
@@ -287,13 +287,21 @@
 
 ax2 = ParasiteAxes(self, sharex=self, frameon=False)
 self.parasites.append(ax2)
+
+ # for normal axes
+ self.yaxis.tick_left()
+ ax2.xaxis.set_visible(False)
+ ax2.yaxis.tick_right()
+ ax2.yaxis.set_label_position('right')
+
+ # for axisline axes
 self._axislines["right"].set_visible(False)
- ax2.xaxis.set_visible(False)
 ax2._axislines["left"].set_visible(False)
 ax2._axislines["right"].set_visible(True)
 ax2._axislines["right"].major_ticklabels.set_visible(True)
 ax2._axislines["right"].label.set_visible(True)
- self.yaxis.tick_left()
+
+
 return ax2
 
 def twiny(self):
@@ -310,11 +318,20 @@
 
 ax2 = ParasiteAxes(self, sharey=self, frameon=False)
 self.parasites.append(ax2)
- ax2.xaxis.set_visible(True)
+
+ # for normal axes
+ self.xaxis.tick_bottom()
 ax2.yaxis.set_visible(False)
 ax2.xaxis.tick_top()
 ax2.xaxis.set_label_position('top')
- self.xaxis.tick_bottom()
+
+ # for axisline axes
+ self._axislines["top"].set_visible(False)
+ ax2._axislines["bottom"].set_visible(False)
+ ax2._axislines["top"].set_visible(True)
+ ax2._axislines["top"].major_ticklabels.set_visible(True)
+ ax2._axislines["top"].label.set_visible(True)
+
 return ax2
 
 def twin(self, aux_trans=None):
@@ -339,6 +356,16 @@
 )
 self.parasites.append(ax2)
 
+
+ # for normal axes
+ self.yaxis.tick_left()
+ self.xaxis.tick_bottom()
+ ax2.yaxis.tick_right()
+ ax2.yaxis.set_label_position('right')
+ ax2.xaxis.tick_top()
+ ax2.xaxis.set_label_position('top')
+
+ # for axisline axes
 self._axislines["right"].set_visible(False)
 self._axislines["top"].set_visible(False)
 ax2._axislines["left"].set_visible(False)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年05月04日 20:14:41
Revision: 7083
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7083&view=rev
Author: leejjoon
Date: 2009年05月04日 20:14:40 +0000 (2009年5月04日)
Log Message:
-----------
Merged revisions 7082 via svnmerge from 
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint
........
 r7082 | leejjoon | 2009年05月04日 16:05:57 -0400 (2009年5月04日) | 2 lines
 
 Fix bug that Text.Annotation is still drawn while set to not visible
........
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/text.py
Property Changed:
----------------
 trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
 - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7080
 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7082
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年05月04日 20:05:57 UTC (rev 7082)
+++ trunk/matplotlib/CHANGELOG	2009年05月04日 20:14:40 UTC (rev 7083)
@@ -1,4 +1,7 @@
 ======================================================================
+2009年05月04日 Fix bug that Text.Annotation is still drawn while set to 
+ not visible.-JJL
+
 2009年05月04日 Added TJ's fill_betweenx patch - JDH
 
 2009年05月02日 Added options to plotfile based on question from
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py	2009年05月04日 20:05:57 UTC (rev 7082)
+++ trunk/matplotlib/lib/matplotlib/text.py	2009年05月04日 20:14:40 UTC (rev 7083)
@@ -1612,6 +1612,11 @@
 """
 Draw the :class:`Annotation` object to the given *renderer*.
 """
+
+ if renderer is not None:
+ self._renderer = renderer
+ if not self.get_visible(): return
+
 self.update_positions(renderer)
 self.update_bbox_position_size(renderer)
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年05月04日 20:05:59
Revision: 7082
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7082&view=rev
Author: leejjoon
Date: 2009年05月04日 20:05:57 +0000 (2009年5月04日)
Log Message:
-----------
Fix bug that Text.Annotation is still drawn while set to not visible
Modified Paths:
--------------
 branches/v0_98_5_maint/CHANGELOG
 branches/v0_98_5_maint/lib/matplotlib/text.py
Modified: branches/v0_98_5_maint/CHANGELOG
===================================================================
--- branches/v0_98_5_maint/CHANGELOG	2009年05月04日 19:07:43 UTC (rev 7081)
+++ branches/v0_98_5_maint/CHANGELOG	2009年05月04日 20:05:57 UTC (rev 7082)
@@ -1,4 +1,7 @@
 ======================================================================
+2009年05月04日 Fix bug that Text.Annotation is still drawn while set to 
+ not visible.-JJL
+
 2008年04月12日 Release 0.98.5.3 at r7038
 
 2009年04月06日 The pdf backend now escapes newlines and linefeeds in strings.
Modified: branches/v0_98_5_maint/lib/matplotlib/text.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/text.py	2009年05月04日 19:07:43 UTC (rev 7081)
+++ branches/v0_98_5_maint/lib/matplotlib/text.py	2009年05月04日 20:05:57 UTC (rev 7082)
@@ -1602,6 +1602,11 @@
 """
 Draw the :class:`Annotation` object to the given *renderer*.
 """
+
+ if renderer is not None:
+ self._renderer = renderer
+ if not self.get_visible(): return
+
 self.update_positions(renderer)
 self.update_bbox_position_size(renderer)
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年05月04日 19:07:48
Revision: 7081
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7081&view=rev
Author: mdboom
Date: 2009年05月04日 19:07:43 +0000 (2009年5月04日)
Log Message:
-----------
Merged revisions 7080 via svnmerge from 
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint
........
 r7080 | mdboom | 2009年05月04日 15:05:38 -0400 (2009年5月04日) | 2 lines
 
 [2723470] UnboundLocalError in ticker.py
........
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/ticker.py
Property Changed:
----------------
 trunk/matplotlib/
 trunk/matplotlib/doc/pyplots/README
 trunk/matplotlib/doc/sphinxext/gen_gallery.py
 trunk/matplotlib/doc/sphinxext/gen_rst.py
 trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
 trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
 trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
 - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7072
 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7080
Modified: svn:mergeinfo
 - /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
 + /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
Property changes on: trunk/matplotlib/doc/pyplots/README
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072
 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py	2009年05月04日 19:05:38 UTC (rev 7080)
+++ trunk/matplotlib/lib/matplotlib/ticker.py	2009年05月04日 19:07:43 UTC (rev 7081)
@@ -953,6 +953,8 @@
 vmax -= offset
 raw_step = (vmax-vmin)/nbins
 scaled_raw_step = raw_step/scale
+ best_vmax = vmax
+ best_vmin = vmin
 
 for step in self._steps:
 if step < scaled_raw_step:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7080
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7080&view=rev
Author: mdboom
Date: 2009年05月04日 19:05:38 +0000 (2009年5月04日)
Log Message:
-----------
[2723470] UnboundLocalError in ticker.py
Modified Paths:
--------------
 branches/v0_98_5_maint/lib/matplotlib/ticker.py
Modified: branches/v0_98_5_maint/lib/matplotlib/ticker.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/ticker.py	2009年05月04日 18:19:18 UTC (rev 7079)
+++ branches/v0_98_5_maint/lib/matplotlib/ticker.py	2009年05月04日 19:05:38 UTC (rev 7080)
@@ -930,6 +930,8 @@
 vmax -= offset
 raw_step = (vmax-vmin)/nbins
 scaled_raw_step = raw_step/scale
+ best_vmax = vmax
+ best_vmin = vmin
 
 for step in self._steps:
 if step < scaled_raw_step:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年05月04日 18:19:24
Revision: 7079
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7079&view=rev
Author: jdh2358
Date: 2009年05月04日 18:19:18 +0000 (2009年5月04日)
Log Message:
-----------
added sf patch 2786759 for fill_betweenx
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/boilerplate.py
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/pyplot.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年05月03日 00:09:06 UTC (rev 7078)
+++ trunk/matplotlib/CHANGELOG	2009年05月04日 18:19:18 UTC (rev 7079)
@@ -1,7 +1,10 @@
 ======================================================================
+2009年05月04日 Added TJ's fill_betweenx patch - JDH
+
 2009年05月02日 Added options to plotfile based on question from
 Joseph Smidt and patch by Matthias Michler. - EF
 
+
 2009年05月01日 Changed add_artist and similar Axes methods to
 return their argument. - EF
 
Modified: trunk/matplotlib/boilerplate.py
===================================================================
--- trunk/matplotlib/boilerplate.py	2009年05月03日 00:09:06 UTC (rev 7078)
+++ trunk/matplotlib/boilerplate.py	2009年05月04日 18:19:18 UTC (rev 7079)
@@ -65,6 +65,7 @@
 'errorbar',
 'fill',
 'fill_between',
+ 'fill_betweenx',
 'hexbin',
 'hist',
 'hlines',
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年05月03日 00:09:06 UTC (rev 7078)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年05月04日 18:19:18 UTC (rev 7079)
@@ -5826,10 +5826,10 @@
 an N length np array of the x data
 
 *y1*
- an N length scalar or np array of the x data
+ an N length scalar or np array of the y data
 
 *y2*
- an N length scalar or np array of the x data
+ an N length scalar or np array of the y data
 
 *where*
 if None, default to fill between everywhere. If not None,
@@ -5844,6 +5844,12 @@
 %(PolyCollection)s
 
 .. plot:: mpl_examples/pylab_examples/fill_between.py
+
+ .. seealso::
+
+ :meth:`fill_betweenx`
+ for filling between two sets of x-values
+
 """
 # Handle united data, such as dates
 self._process_unit_info(xdata=x, ydata=y1, kwargs=kwargs)
@@ -5913,6 +5919,113 @@
 return collection
 fill_between.__doc__ = cbook.dedent(fill_between.__doc__) % martist.kwdocd
 
+ def fill_betweenx(self, y, x1, x2=0, where=None, **kwargs):
+ """
+ call signature::
+
+ fill_between(y, x1, x2=0, where=None, **kwargs)
+
+ Create a :class:`~matplotlib.collections.PolyCollection`
+ filling the regions between *x1* and *x2* where
+ ``where==True``
+
+ *y*
+ an N length np array of the y data
+
+ *x1*
+ an N length scalar or np array of the x data
+
+ *x2*
+ an N length scalar or np array of the x data
+
+ *where*
+ if None, default to fill between everywhere. If not None,
+ it is a a N length numpy boolean array and the fill will
+ only happen over the regions where ``where==True``
+
+ *kwargs*
+ keyword args passed on to the :class:`PolyCollection`
+
+ kwargs control the Polygon properties:
+
+ %(PolyCollection)s
+
+ .. plot:: mpl_examples/pylab_examples/fill_betweenx.py
+
+ .. seealso::
+
+ :meth:`fill_between`
+ for filling between two sets of y-values
+
+ """
+ # Handle united data, such as dates
+ self._process_unit_info(ydata=y, xdata=x1, kwargs=kwargs)
+ self._process_unit_info(xdata=x2)
+
+ # Convert the arrays so we can work with them
+ y = np.asanyarray(self.convert_yunits(y))
+ x1 = np.asanyarray(self.convert_xunits(x1))
+ x2 = np.asanyarray(self.convert_xunits(x2))
+
+ if x1.ndim == 0:
+ x1 = np.ones_like(y)*x1
+ if x2.ndim == 0:
+ x2 = np.ones_like(y)*x2
+
+ if where is None:
+ where = np.ones(len(y), np.bool)
+ else:
+ where = np.asarray(where, np.bool)
+
+ if not (y.shape == x1.shape == x2.shape == where.shape):
+ raise ValueError("Argument dimensions are incompatible")
+
+ mask = reduce(ma.mask_or,
+ [ma.getmask(y), ma.getmask(x1), ma.getmask(x2)])
+ if mask is not ma.nomask:
+ where &= ~mask
+
+ polys = []
+ for ind0, ind1 in mlab.contiguous_regions(where):
+ theseverts = []
+ yslice = y[ind0:ind1]
+ x1slice = x1[ind0:ind1]
+ x2slice = x2[ind0:ind1]
+
+ if not len(yslice):
+ continue
+
+ N = len(yslice)
+ Y = np.zeros((2*N+2, 2), np.float)
+
+ # the purpose of the next two lines is for when x2 is a
+ # scalar like 0 and we want the fill to go all the way
+ # down to 0 even if none of the x1 sample points do
+ Y[0] = x2slice[0], yslice[0]
+ Y[N+1] = x2slice[-1], yslice[-1]
+
+ Y[1:N+1,0] = x1slice
+ Y[1:N+1,1] = yslice
+ Y[N+2:,0] = x2slice[::-1]
+ Y[N+2:,1] = yslice[::-1]
+
+ polys.append(Y)
+
+ collection = mcoll.PolyCollection(polys, **kwargs)
+
+ # now update the datalim and autoscale
+ X1Y = np.array([x1[where], y[where]]).T
+ X2Y = np.array([x2[where], y[where]]).T
+ self.dataLim.update_from_data_xy(X1Y, self.ignore_existing_data_limits,
+ updatex=True, updatey=True)
+
+ self.dataLim.update_from_data_xy(X2Y, self.ignore_existing_data_limits,
+ updatex=False, updatey=True)
+ self.add_collection(collection)
+ self.autoscale_view()
+ return collection
+ fill_between.__doc__ = cbook.dedent(fill_between.__doc__) % martist.kwdocd
+
 #### plotting z(x,y): imshow, pcolor and relatives, contour
 
 def imshow(self, X, cmap=None, norm=None, aspect=None,
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py	2009年05月03日 00:09:06 UTC (rev 7078)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py	2009年05月04日 18:19:18 UTC (rev 7079)
@@ -1185,7 +1185,8 @@
 figtext add text in figure coords
 figure create or change active figure
 fill make filled polygons
- fill_between make filled polygons
+ fill_between make filled polygons between two sets of y-values
+ fill_betweenx make filled polygons between two sets of x-values
 gca return the current axes
 gcf return the current figure
 gci get the current image, or None
@@ -1973,6 +1974,28 @@
 
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
+def fill_betweenx(*args, **kwargs):
+ # allow callers to override the hold state by passing hold=True|False
+ b = ishold()
+ h = kwargs.pop('hold', None)
+ if h is not None:
+ hold(h)
+ try:
+ ret = gca().fill_betweenx(*args, **kwargs)
+ draw_if_interactive()
+ except:
+ hold(b)
+ raise
+
+ hold(b)
+ return ret
+if Axes.fill_betweenx.__doc__ is not None:
+ fill_betweenx.__doc__ = dedent(Axes.fill_betweenx.__doc__) + """
+
+Additional kwargs: hold = [True|False] overrides default hold state"""
+
+# This function was autogenerated by boilerplate.py. Do not edit as
+# changes will be lost
 def hexbin(*args, **kwargs):
 # allow callers to override the hold state by passing hold=True|False
 b = ishold()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年05月03日 00:09:14
Revision: 7078
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7078&view=rev
Author: efiring
Date: 2009年05月03日 00:09:06 +0000 (2009年5月03日)
Log Message:
-----------
Added options to plotfile
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/examples/pylab_examples/plotfile_demo.py
 trunk/matplotlib/lib/matplotlib/pyplot.py
Added Paths:
-----------
 trunk/matplotlib/examples/data/data_x_x2_x3.csv
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年05月01日 19:04:06 UTC (rev 7077)
+++ trunk/matplotlib/CHANGELOG	2009年05月03日 00:09:06 UTC (rev 7078)
@@ -1,4 +1,7 @@
 ======================================================================
+2009年05月02日 Added options to plotfile based on question from
+ Joseph Smidt and patch by Matthias Michler. - EF
+
 2009年05月01日 Changed add_artist and similar Axes methods to
 return their argument. - EF
 
Added: trunk/matplotlib/examples/data/data_x_x2_x3.csv
===================================================================
--- trunk/matplotlib/examples/data/data_x_x2_x3.csv	 (rev 0)
+++ trunk/matplotlib/examples/data/data_x_x2_x3.csv	2009年05月03日 00:09:06 UTC (rev 7078)
@@ -0,0 +1,11 @@
+ 0 0 0
+ 1 1 1
+ 2 4 8
+ 3 9 27
+ 4 16 64
+ 5 25 125
+ 6 36 216
+ 7 49 343
+ 8 64 512
+ 9 81 729
+10 100 1000
Modified: trunk/matplotlib/examples/pylab_examples/plotfile_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/plotfile_demo.py	2009年05月01日 19:04:06 UTC (rev 7077)
+++ trunk/matplotlib/examples/pylab_examples/plotfile_demo.py	2009年05月03日 00:09:06 UTC (rev 7078)
@@ -1,6 +1,7 @@
-from pylab import plotfile, show
+from pylab import plotfile, show, gca
 
 fname = '../data/msft.csv'
+fname2 = '../data/data_x_x2_x3.csv'
 
 # test 1; use ints
 plotfile(fname, (0,5,6))
@@ -14,7 +15,20 @@
 # test 4; use semilogy for volume
 plotfile(fname, (0,5,6), plotfuncs={5:'semilogy'})
 
-# test 5; use bar for volume
+#test 5; single subplot
+plotfile(fname, ('date', 'open', 'high', 'low', 'close'), subplots=False)
+
+# test 6; labeling, if no names in csv-file
+plotfile(fname2, cols=(0,1,2), delimiter=' ',
+ names=['$x$', '$f(x)=x^2$', '$f(x)=x^3$'])
+
+# test 7; more than one file per figure--illustrated here with a single file
+plotfile(fname2, cols=(0, 1), delimiter=' ')
+plotfile(fname2, cols=(0, 2), newfig=False, delimiter=' ') # use current figure
+gca().set_xlabel(r'$x$')
+gca().set_ylabel(r'$f(x) = x^2, x^3$')
+
+# test 8; use bar for volume
 plotfile(fname, (0,5,6), plotfuncs={5:'bar'})
 
 show()
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py	2009年05月01日 19:04:06 UTC (rev 7077)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py	2009年05月03日 00:09:06 UTC (rev 7078)
@@ -1448,7 +1448,8 @@
 return ret
 
 def plotfile(fname, cols=(0,), plotfuncs=None,
- comments='#', skiprows=0, checkrows=5, delimiter=',',
+ comments='#', skiprows=0, checkrows=5, delimiter=',', names=None,
+ subplots=True, newfig=True,
 **kwargs):
 """
 Plot the data in *fname*
@@ -1464,18 +1465,28 @@
 
 - If len(*cols*) > 1, the first element will be an identifier for
 data for the *x* axis and the remaining elements will be the
- column indexes for multiple subplots
+ column indexes for multiple subplots if *subplots* is *True*
+ (the default), or for lines in a single subplot if *subplots*
+ is *False*.
 
 *plotfuncs*, if not *None*, is a dictionary mapping identifier to
 an :class:`~matplotlib.axes.Axes` plotting function as a string.
 Default is 'plot', other choices are 'semilogy', 'fill', 'bar',
 etc. You must use the same type of identifier in the *cols*
 vector as you use in the *plotfuncs* dictionary, eg., integer
- column numbers in both or column names in both.
+ column numbers in both or column names in both. If *subplots*
+ is *False*, then including any function such as 'semilogy'
+ that changes the axis scaling will set the scaling for all
+ columns.
 
- *comments*, *skiprows*, *checkrows*, and *delimiter* are all passed on to
- :func:`matplotlib.pylab.csv2rec` to load the data into a record array.
+ *comments*, *skiprows*, *checkrows*, *delimiter*, and *names*
+ are all passed on to :func:`matplotlib.pylab.csv2rec` to
+ load the data into a record array.
 
+ If *newfig* is *True*, the plot always will be made in a new figure;
+ if *False*, it will be made in the current figure if one exists,
+ else in a new figure.
+
 kwargs are passed on to plotting functions.
 
 Example usage::
@@ -1484,17 +1495,26 @@
 plotfile(fname, (0,1,3))
 
 # plot using column names; specify an alternate plot type for volume
- plotfile(fname, ('date', 'volume', 'adj_close'), plotfuncs={'volume': 'semilogy'})
+ plotfile(fname, ('date', 'volume', 'adj_close'),
+ plotfuncs={'volume': 'semilogy'})
+
+ Note: plotfile is intended as a convenience for quickly plotting
+ data from flat files; it is not intended as an alternative
+ interface to general plotting with pyplot or matplotlib.
 """
 
- fig = figure()
+ if newfig:
+ fig = figure()
+ else:
+ fig = gcf()
+
 if len(cols)<1:
 raise ValueError('must have at least one column of data')
 
 if plotfuncs is None:
 plotfuncs = dict()
- r = mlab.csv2rec(fname, comments=comments,
- skiprows=skiprows, checkrows=checkrows, delimiter=delimiter)
+ r = mlab.csv2rec(fname, comments=comments, skiprows=skiprows,
+ checkrows=checkrows, delimiter=delimiter, names=names)
 
 def getname_val(identifier):
 'return the name and column data for identifier'
@@ -1507,36 +1527,44 @@
 raise TypeError('identifier must be a string or integer')
 
 xname, x = getname_val(cols[0])
+ ynamelist = []
 
 if len(cols)==1:
 ax1 = fig.add_subplot(1,1,1)
 funcname = plotfuncs.get(cols[0], 'plot')
 func = getattr(ax1, funcname)
 func(x, **kwargs)
- ax1.set_xlabel(xname)
+ ax1.set_ylabel(xname)
 else:
 N = len(cols)
 for i in range(1,N):
- if i==1:
- ax = ax1 = fig.add_subplot(N-1,1,i)
- ax.grid(True)
- else:
- ax = fig.add_subplot(N-1,1,i, sharex=ax1)
- ax.grid(True)
+ if subplots:
+ if i==1:
+ ax = ax1 = fig.add_subplot(N-1,1,i)
+ else:
+ ax = fig.add_subplot(N-1,1,i, sharex=ax1)
+ elif i==1:
+ ax = fig.add_subplot(1,1,1)
 
+ ax.grid(True)
 
+
 yname, y = getname_val(cols[i])
+ ynamelist.append(yname)
 
 funcname = plotfuncs.get(cols[i], 'plot')
 func = getattr(ax, funcname)
 
 func(x, y, **kwargs)
- ax.set_ylabel(yname)
+ if subplots:
+ ax.set_ylabel(yname)
 if ax.is_last_row():
 ax.set_xlabel(xname)
 else:
 ax.set_xlabel('')
 
+ if not subplots:
+ ax.legend(ynamelist, loc='best')
 
 if xname=='date':
 fig.autofmt_xdate()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年05月01日 19:04:09
Revision: 7077
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7077&view=rev
Author: efiring
Date: 2009年05月01日 19:04:06 +0000 (2009年5月01日)
Log Message:
-----------
Make Axes.add_artist etc. return their argument.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年05月01日 18:05:12 UTC (rev 7076)
+++ trunk/matplotlib/CHANGELOG	2009年05月01日 19:04:06 UTC (rev 7077)
@@ -1,4 +1,6 @@
 ======================================================================
+2009年05月01日 Changed add_artist and similar Axes methods to
+ return their argument. - EF
 
 2009年04月30日 Incorrect eps bbox for landscape mode fixed - JJL
 
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年05月01日 18:05:12 UTC (rev 7076)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年05月01日 19:04:06 UTC (rev 7077)
@@ -1323,17 +1323,24 @@
 len(self.patches))>0
 
 def add_artist(self, a):
- 'Add any :class:`~matplotlib.artist.Artist` to the axes'
+ '''
+ Add any :class:`~matplotlib.artist.Artist` to the axes
+
+ Returns the artist.
+ '''
 a.set_axes(self)
 self.artists.append(a)
 self._set_artist_props(a)
 a.set_clip_path(self.patch)
 a._remove_method = lambda h: self.artists.remove(h)
+ return a
 
 def add_collection(self, collection, autolim=True):
 '''
 add a :class:`~matplotlib.collections.Collection` instance
 to the axes
+
+ Returns the collection.
 '''
 label = collection.get_label()
 if not label:
@@ -1348,11 +1355,14 @@
 self.update_datalim(collection.get_datalim(self.transData))
 
 collection._remove_method = lambda h: self.collections.remove(h)
+ return collection
 
 def add_line(self, line):
 '''
 Add a :class:`~matplotlib.lines.Line2D` to the list of plot
 lines
+
+ Returns the line.
 '''
 self._set_artist_props(line)
 if line.get_clip_path() is None:
@@ -1363,6 +1373,7 @@
 line.set_label('_line%d'%len(self.lines))
 self.lines.append(line)
 line._remove_method = lambda h: self.lines.remove(h)
+ return line
 
 def _update_line_limits(self, line):
 p = line.get_path()
@@ -1378,6 +1389,8 @@
 axes patches; the clipbox will be set to the Axes clipping
 box. If the transform is not set, it will be set to
 :attr:`transData`.
+
+ Returns the patch.
 """
 
 self._set_artist_props(p)
@@ -1386,6 +1399,7 @@
 self._update_patch_limits(p)
 self.patches.append(p)
 p._remove_method = lambda h: self.patches.remove(h)
+ return p
 
 def _update_patch_limits(self, patch):
 'update the data limits for patch *p*'
@@ -1412,11 +1426,14 @@
 '''
 Add a :class:`~matplotlib.tables.Table` instance to the
 list of axes tables
+
+ Returns the table.
 '''
 self._set_artist_props(tab)
 self.tables.append(tab)
 tab.set_clip_path(self.patch)
 tab._remove_method = lambda h: self.tables.remove(h)
+ return tab
 
 def relim(self):
 'recompute the data limits based on current artists'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7076
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7076&view=rev
Author: mdboom
Date: 2009年05月01日 18:05:12 +0000 (2009年5月01日)
Log Message:
-----------
Scale fonts correctly for Mac OS-X backend. (Patch contributed by Michiel de Hoon).
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py	2009年04月30日 17:31:23 UTC (rev 7075)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py	2009年05月01日 18:05:12 UTC (rev 7076)
@@ -107,7 +107,6 @@
 n = self.gc.level() - gc.level()
 for i in range(n): self.gc.restore()
 self.gc = gc
- size = prop.get_size_in_points()
 ox, oy, width, height, descent, image, used_characters = \
 self.mathtext_parser.parse(s, self.dpi, prop)
 gc.draw_mathtext(x, y, angle, 255 - image.as_array())
@@ -121,15 +120,15 @@
 self._draw_mathtext(gc, x, y, s, prop, angle)
 else:
 family = prop.get_family()
- size = prop.get_size_in_points()
 weight = prop.get_weight()
 style = prop.get_style()
+ points = prop.get_size_in_points()
+ size = self.points_to_pixels(points)
 gc.draw_text(x, y, unicode(s), family, size, weight, style, angle)
 
 def get_text_width_height_descent(self, s, prop, ismath):
 if ismath=='TeX':
 # todo: handle props
- size = prop.get_size_in_points()
 texmanager = self.get_texmanager()
 fontsize = prop.get_size_in_points()
 w, h, d = texmanager.get_text_width_height_descent(s, fontsize,
@@ -140,9 +139,10 @@
 self.mathtext_parser.parse(s, self.dpi, prop)
 return width, height, descent
 family = prop.get_family()
- size = prop.get_size_in_points()
 weight = prop.get_weight()
 style = prop.get_style()
+ points = prop.get_size_in_points()
+ size = self.points_to_pixels(points)
 width, height, descent = self.gc.get_text_width_height_descent(unicode(s), family, size, weight, style)
 return width, height, 0.0*descent
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing results of 90

<< < 1 2 3 4 (Page 4 of 4)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /