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
|
|
From: <as...@us...> - 2008-12-04 01:59:00
|
Revision: 6487
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6487&view=rev
Author: astraw
Date: 2008-12-04 01:58:58 +0000 (Thu, 04 Dec 2008)
Log Message:
-----------
further improvements to github instructions
Modified Paths:
--------------
trunk/matplotlib/README.git
Modified: trunk/matplotlib/README.git
===================================================================
--- trunk/matplotlib/README.git 2008-12-04 01:52:51 UTC (rev 6486)
+++ trunk/matplotlib/README.git 2008-12-04 01:58:58 UTC (rev 6487)
@@ -1,7 +1,8 @@
-To clone from the `matplotlib github mirror`_ into the directory
-``mpl.git``, enter the following commands. These instructions assume
-you already have a github login (-- they use the personal
-gi...@gi... clone URL instead of the git://github.com clone URL)::
+There is an experimental `matplotlib github mirror`_ of the subversion
+repository. To make a local clone it the directory ``mpl.git``, enter
+the following commands. These instructions assume you already have a
+github login (-- they use the personal gi...@gi... clone URL
+instead of the git://github.com clone URL)::
# This will create your copy in the mpl.git directory
git clone gi...@gi...:astraw/matplotlib.git mpl.git
@@ -14,3 +15,15 @@
git svn fetch -r 6300:HEAD
.. _matplotlib github mirror: http://github.com/astraw/matplotlib
+
+To update your git repository with the latest svn updates from SourceForge::
+
+ git svn rebase
+
+To list what changes will be committed to svn::
+
+ git svn dcommit -n
+
+To commit your changes to svn::
+
+ git svn dcommit
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <as...@us...> - 2008-12-04 01:52:57
|
Revision: 6486
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6486&view=rev
Author: astraw
Date: 2008-12-04 01:52:51 +0000 (Thu, 04 Dec 2008)
Log Message:
-----------
add github instructions
Added Paths:
-----------
trunk/matplotlib/README.git
Added: trunk/matplotlib/README.git
===================================================================
--- trunk/matplotlib/README.git (rev 0)
+++ trunk/matplotlib/README.git 2008-12-04 01:52:51 UTC (rev 6486)
@@ -0,0 +1,16 @@
+To clone from the `matplotlib github mirror`_ into the directory
+``mpl.git``, enter the following commands. These instructions assume
+you already have a github login (-- they use the personal
+gi...@gi... clone URL instead of the git://github.com clone URL)::
+
+ # This will create your copy in the mpl.git directory
+ git clone gi...@gi...:astraw/matplotlib.git mpl.git
+ cd mpl.git
+ git config --add remote.origin.fetch +refs/remotes/*:refs/remotes/*
+ git fetch
+ git svn init --trunk=trunk/matplotlib --tags=tags https://matplotlib.svn.sourceforge.net/svnroot/matplotlib
+
+ # Now just get the latest svn revisions from the SourceForge SVN repository
+ git svn fetch -r 6300:HEAD
+
+.. _matplotlib github mirror: http://github.com/astraw/matplotlib
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-12-03 18:50:53
|
Revision: 6485
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6485&view=rev
Author: jdh2358
Date: 2008-12-03 18:50:49 +0000 (Wed, 03 Dec 2008)
Log Message:
-----------
use standard axes creation func
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/fancyarrow_demo.py
Modified: trunk/matplotlib/examples/pylab_examples/fancyarrow_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fancyarrow_demo.py 2008-12-03 18:38:03 UTC (rev 6484)
+++ trunk/matplotlib/examples/pylab_examples/fancyarrow_demo.py 2008-12-03 18:50:49 UTC (rev 6485)
@@ -7,9 +7,9 @@
fig1 = plt.figure(1, (4, figheight))
fontsize = 0.3 * fig1.dpi
-ax = plt.Axes(fig1, [0, 0, 1, 1], frameon=False, aspect=1.)
-fig1.add_axes(ax)
+ax = fig1.add_axes([0, 0, 1, 1], frameon=False, aspect=1.)
+
ax.set_xlim(0, 4)
ax.set_ylim(0, figheight)
@@ -17,9 +17,7 @@
y = (float(len(styles)) -0.25 - i) # /figheight
p = mpatches.Circle((3.2, y), 0.2, fc="w")
ax.add_patch(p)
- #ax.plot([0.8], [y], "o", mec="b", mfc="w", ms=20, transform=fig1.transFigure)
- #ax.scatter([0.8], [y], s=20*20, marker="o", edgecolors=["b"], facecolors=["w"],
- # )
+
ax.annotate(stylename, (3.2, y),
(2., y),
#xycoords="figure fraction", textcoords="figure fraction",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-12-03 18:38:07
|
Revision: 6484
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6484&view=rev
Author: jdh2358
Date: 2008-12-03 18:38:03 +0000 (Wed, 03 Dec 2008)
Log Message:
-----------
committed Gregor's enter notify update for backend wx
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-12-03 15:33:53 UTC (rev 6483)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-12-03 18:38:03 UTC (rev 6484)
@@ -743,6 +743,7 @@
bind(self, wx.EVT_LEFT_UP, self._onLeftButtonUp)
bind(self, wx.EVT_MOTION, self._onMotion)
bind(self, wx.EVT_LEAVE_WINDOW, self._onLeave)
+ bind(self, wx.EVT_ENTER_WINDOW, self._onEnter)
bind(self, wx.EVT_IDLE, self._onIdle)
self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
@@ -1268,7 +1269,11 @@
evt.Skip()
FigureCanvasBase.leave_notify_event(self, guiEvent = evt)
+ def _onEnter(self, evt):
+ """Mouse has entered the window."""
+ FigureCanvasBase.enter_notify_event(self, guiEvent = evt)
+
########################################################################
#
# The following functions and classes are for pylab compatibility
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-03 15:33:55
|
Revision: 6483
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6483&view=rev
Author: mdboom
Date: 2008-12-03 15:33:53 +0000 (Wed, 03 Dec 2008)
Log Message:
-----------
Fix degree display in geographic transforms, also.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/projections/geo.py
Modified: trunk/matplotlib/lib/matplotlib/projections/geo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/projections/geo.py 2008-12-03 09:07:27 UTC (rev 6482)
+++ trunk/matplotlib/lib/matplotlib/projections/geo.py 2008-12-03 15:33:53 UTC (rev 6483)
@@ -29,8 +29,10 @@
def __call__(self, x, pos=None):
degrees = (x / np.pi) * 180.0
degrees = round(degrees / self._round_to) * self._round_to
- # \u00b0 : degree symbol
- return u"%d\u00b0" % degrees
+ if rcParams['text.usetex'] and not rcParams['text.latex.unicode']:
+ return r"$%0.0f^\circ$" % degrees
+ else:
+ return u"%0.0f\u00b0" % degrees
RESOLUTION = 75
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <as...@us...> - 2008-12-03 09:07:31
|
Revision: 6482
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6482&view=rev
Author: astraw
Date: 2008-12-03 09:07:27 +0000 (Wed, 03 Dec 2008)
Log Message:
-----------
docs: add hexbin link in main overview page
Modified Paths:
--------------
trunk/matplotlib/doc/_templates/index.html
Modified: trunk/matplotlib/doc/_templates/index.html
===================================================================
--- trunk/matplotlib/doc/_templates/index.html 2008-12-03 08:27:12 UTC (rev 6481)
+++ trunk/matplotlib/doc/_templates/index.html 2008-12-03 09:07:27 UTC (rev 6482)
@@ -490,6 +490,17 @@
</tr>
<tr>
<th align="left">
+ <a href="api/pyplot_api.html#matplotlib.pyplot.hexbin">hexbin</a>
+
+ </th>
+
+ <td align="left">
+ make a 2D hexagonal binning plot
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
<a href="api/pyplot_api.html#matplotlib.pyplot.hist">hist</a>
</th>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <as...@us...> - 2008-12-03 08:27:15
|
Revision: 6481
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6481&view=rev
Author: astraw
Date: 2008-12-03 08:27:12 +0000 (Wed, 03 Dec 2008)
Log Message:
-----------
add info about how to build HTML documentation
Modified Paths:
--------------
trunk/matplotlib/doc/README.txt
Modified: trunk/matplotlib/doc/README.txt
===================================================================
--- trunk/matplotlib/doc/README.txt 2008-12-03 07:40:09 UTC (rev 6480)
+++ trunk/matplotlib/doc/README.txt 2008-12-03 08:27:12 UTC (rev 6481)
@@ -32,3 +32,9 @@
* mpl_examples - a link to the matplotlib examples in case any
documentation wants to literal include them
+
+To build the HTML documentation, install sphinx (0.5 or greater
+required), then type "python make.py html" in this directory. Wait
+for the initial run (which builds the example gallery) to be done,
+then run "python make.py html" again. The top file of the results will
+be ./build/html/index.html
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2008-12-03 07:40:13
|
Revision: 6480
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6480&view=rev
Author: leejjoon
Date: 2008-12-03 07:40:09 +0000 (Wed, 03 Dec 2008)
Log Message:
-----------
reorganization of style classes in patches.py
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/patches.py
Added Paths:
-----------
trunk/matplotlib/examples/pylab_examples/fancyarrow_demo.py
trunk/matplotlib/examples/pylab_examples/fancybox_demo2.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-12-02 22:27:38 UTC (rev 6479)
+++ trunk/matplotlib/CHANGELOG 2008-12-03 07:40:09 UTC (rev 6480)
@@ -1,3 +1,7 @@
+2008-12-02 The transmuter classes in the patches.py are reorganized as
+ subclasses of the Style classes. A few more box and arrow
+ styles are added. -JJL
+
2008-12-02 Fixed a bug in the new legend class that didn't allowed
a tuple of coordinate vlaues as loc. -JJL
Added: trunk/matplotlib/examples/pylab_examples/fancyarrow_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fancyarrow_demo.py (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/fancyarrow_demo.py 2008-12-03 07:40:09 UTC (rev 6480)
@@ -0,0 +1,43 @@
+import matplotlib.patches as mpatches
+import matplotlib.pyplot as plt
+
+styles = mpatches.ArrowStyle.get_styles()
+
+figheight = (len(styles)+.5)
+fig1 = plt.figure(1, (4, figheight))
+fontsize = 0.3 * fig1.dpi
+
+ax = plt.Axes(fig1, [0, 0, 1, 1], frameon=False, aspect=1.)
+fig1.add_axes(ax)
+
+ax.set_xlim(0, 4)
+ax.set_ylim(0, figheight)
+
+for i, (stylename, styleclass) in enumerate(sorted(styles.items())):
+ y = (float(len(styles)) -0.25 - i) # /figheight
+ p = mpatches.Circle((3.2, y), 0.2, fc="w")
+ ax.add_patch(p)
+ #ax.plot([0.8], [y], "o", mec="b", mfc="w", ms=20, transform=fig1.transFigure)
+ #ax.scatter([0.8], [y], s=20*20, marker="o", edgecolors=["b"], facecolors=["w"],
+ # )
+ ax.annotate(stylename, (3.2, y),
+ (2., y),
+ #xycoords="figure fraction", textcoords="figure fraction",
+ ha="right", va="center",
+ size=fontsize,
+ arrowprops=dict(arrowstyle=stylename,
+ patchB=p,
+ shrinkA=5,
+ shrinkB=5,
+ fc="w", ec="k",
+ connectionstyle="arc3,rad=-0.05",
+ ),
+ bbox=dict(boxstyle="square", fc="w"))
+
+ax.xaxis.set_visible(False)
+ax.yaxis.set_visible(False)
+
+
+
+plt.draw()
+plt.show()
Added: trunk/matplotlib/examples/pylab_examples/fancybox_demo2.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fancybox_demo2.py (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/fancybox_demo2.py 2008-12-03 07:40:09 UTC (rev 6480)
@@ -0,0 +1,17 @@
+import matplotlib.patches as mpatch
+import matplotlib.pyplot as plt
+
+styles = mpatch.BoxStyle.get_styles()
+
+figheight = (len(styles)+.5)
+fig1 = plt.figure(1, (4, figheight))
+fontsize = 0.4 * fig1.dpi
+
+for i, (stylename, styleclass) in enumerate(styles.items()):
+ fig1.text(0.5, (float(len(styles)) - 0.5 - i)/figheight, stylename,
+ ha="center",
+ size=fontsize,
+ transform=fig1.transFigure,
+ bbox=dict(boxstyle=stylename, fc="w", ec="k"))
+plt.draw()
+plt.show()
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py 2008-12-02 22:27:38 UTC (rev 6479)
+++ trunk/matplotlib/lib/matplotlib/patches.py 2008-12-03 07:40:09 UTC (rev 6480)
@@ -289,6 +289,7 @@
rgbFace = (r, g, b)
gc.set_alpha(a)
+
if self._hatch:
gc.set_hatch(self._hatch )
@@ -1366,319 +1367,576 @@
r.draw(renderer)
-class BboxTransmuterBase(object):
+
+def _pprint_table(_table, leadingspace=2):
"""
- :class:`BBoxTransmuterBase` and its derivatives are used to make a
- fancy box around a given rectangle. The :meth:`__call__` method
- returns the :class:`~matplotlib.path.Path` of the fancy box. This
- class is not an artist and actual drawing of the fancy box is done
- by the :class:`FancyBboxPatch` class.
+ Given the list of list of strings, return a string of REST table format.
"""
+ if leadingspace:
+ pad = ' '*leadingspace
+ else:
+ pad = ''
- # The derived classes are required to be able to be initialized
- # w/o arguments, i.e., all its argument (except self) must have
- # the default values.
+ columns = [[] for cell in _table[0]]
- def __init__(self):
- super(BboxTransmuterBase, self).__init__()
+ for row in _table:
+ for column, cell in zip(columns, row):
+ column.append(cell)
+
+
+ col_len = [max([len(cell) for cell in column]) for column in columns]
+ lines = []
+ table_formatstr = pad + ' '.join([('=' * cl) for cl in col_len])
+ lines.append('')
+ lines.append(table_formatstr)
+ lines.append(pad + ' '.join([cell.ljust(cl) for cell, cl in zip(_table[0], col_len)]))
+ lines.append(table_formatstr)
+
+ lines.extend([(pad + ' '.join([cell.ljust(cl) for cell, cl in zip(row, col_len)]))
+ for row in _table[1:]])
+
+ lines.append(table_formatstr)
+ lines.append('')
+ return "\n".join(lines)
- def transmute(self, x0, y0, width, height, mutation_size):
+
+def _pprint_styles(_styles, leadingspace=2):
+ """
+ A helper function for the _Style class. Given the dictionary of
+ (stylename : styleclass), return a formatted string listing all the
+ styles. Used to update the documentation.
+ """
+ if leadingspace:
+ pad = ' '*leadingspace
+ else:
+ pad = ''
+
+ names, attrss, clss = [], [], []
+
+ import inspect
+
+ _table = [["Class", "Name", "Attrs"]]
+
+ for name, cls in sorted(_styles.items()):
+ args, varargs, varkw, defaults = inspect.getargspec(cls.__init__)
+ if defaults:
+ args = [(argname, argdefault) \
+ for argname, argdefault in zip(args[1:], defaults)]
+ else:
+ args = []
+
+ _table.append([cls.__name__, name,
+ ",".join([("%s=%s" % (an, av)) for an, av in args])])
+
+ return _pprint_table(_table)
+
+
+
+class _Style(object):
+ """
+ A base class for the Styles. It is meant to be a container class,
+ where actual styles are declared as subclass of it, and it
+ provides some helper functions.
+ """
+ def __new__(self, stylename, **kw):
"""
- The transmute method is a very core of the
- :class:`BboxTransmuter` class and must be overriden in the
- subclasses. It receives the location and size of the
- rectangle, and the mutation_size, with which the amount of
- padding and etc. will be scaled. It returns a
- :class:`~matplotlib.path.Path` instance.
+ return the instance of the subclass with the given style name.
"""
- raise NotImplementedError('Derived must override')
+ # the "class" should have the _style_list attribute, which is
+ # a dictionary of stylname, style class paie.
+
+ _list = stylename.replace(" ","").split(",")
+ _name = _list[0].lower()
+ try:
+ _cls = self._style_list[_name]
+ except KeyError:
+ raise ValueError("Unknown style : %s" % stylename)
+ try:
+ _args_pair = [cs.split("=") for cs in _list[1:]]
+ _args = dict([(k, float(v)) for k, v in _args_pair])
+ except ValueError:
+ raise ValueError("Incorrect style argument : %s" % stylename)
+ _args.update(kw)
- def __call__(self, x0, y0, width, height, mutation_size,
- aspect_ratio=1.):
+ return _cls(**_args)
+
+
+ @classmethod
+ def get_styles(klass):
"""
- The __call__ method a thin wrapper around the transmute method
- and take care of the aspect.
+ A class method which returns a dictionary of available styles.
"""
- if aspect_ratio is not None:
- # Squeeze the given height by the aspect_ratio
- y0, height = y0/aspect_ratio, height/aspect_ratio
- # call transmute method with squeezed height.
- path = self.transmute(x0, y0, width, height, mutation_size)
- vertices, codes = path.vertices, path.codes
- # Restore the height
- vertices[:,1] = vertices[:,1] * aspect_ratio
- return Path(vertices, codes)
- else:
- return self.transmute(x0, y0, width, height, mutation_size)
+ return klass._style_list
+ @classmethod
+ def pprint_styles(klass):
+ """
+ A class method which returns a string of the available styles.
+ """
+ return _pprint_styles(klass._style_list)
-class SquareBoxTransmuter(BboxTransmuterBase):
+
+
+class BoxStyle(_Style):
"""
- Simple square box.
+ :class:`BoxStyle` is a container class which defines several
+ boxstyle classes, which are used for :class:`FancyBoxPatch`.
- *pad*: an amount of padding.
+ A style object can be created as
+
+ BoxStyle.Round(pad=0.2)
+
+ or
+
+ BoxStyle("Round", pad=0.2)
+
+ or
+
+ BoxStyle("Round, pad=0.2")
+
+ Following boxstyle classes are defined.
+
+ %(AvailableBoxstyles)s
+
+ An instance of any boxstyle class is an callable object,
+ whose call signature is
+
+ __call__(self, x0, y0, width, height, mutation_size, aspect_ratio=1.)
+
+ and returns a :class:`Path` instance. *x0*, *y0*, *width* and
+ *height* specify the location and size of the box to be
+ drawn. *mutation_scale* determines the overall size of the
+ mutation (by which I mean the transformation of the rectangle to
+ the fancy box). *mutation_aspect* determines the aspect-ratio of
+ the mutation.
+
"""
+
+ _style_list = {}
- def __init__(self, pad=0.3):
- self.pad = pad
- super(SquareBoxTransmuter, self).__init__()
- def transmute(self, x0, y0, width, height, mutation_size):
+ class _Base(object):
+ """
+ :class:`BBoxTransmuterBase` and its derivatives are used to make a
+ fancy box around a given rectangle. The :meth:`__call__` method
+ returns the :class:`~matplotlib.path.Path` of the fancy box. This
+ class is not an artist and actual drawing of the fancy box is done
+ by the :class:`FancyBboxPatch` class.
+ """
- # padding
- pad = mutation_size * self.pad
+ # The derived classes are required to be able to be initialized
+ # w/o arguments, i.e., all its argument (except self) must have
+ # the default values.
- # width and height with padding added.
- width, height = width + 2.*pad, \
- height + 2.*pad,
+ def __init__(self):
+ """
+ initializtion.
+ """
+ super(BoxStyle._Base, self).__init__()
- # boundary of the padded box
- x0, y0 = x0-pad, y0-pad,
- x1, y1 = x0+width, y0 + height
- cp = [(x0, y0), (x1, y0), (x1, y1), (x0, y1),
- (x0, y0), (x0, y0)]
- com = [Path.MOVETO,
- Path.LINETO,
- Path.LINETO,
- Path.LINETO,
- Path.LINETO,
- Path.CLOSEPOLY]
- path = Path(cp, com)
+ def transmute(self, x0, y0, width, height, mutation_size):
+ """
+ The transmute method is a very core of the
+ :class:`BboxTransmuter` class and must be overriden in the
+ subclasses. It receives the location and size of the
+ rectangle, and the mutation_size, with which the amount of
+ padding and etc. will be scaled. It returns a
+ :class:`~matplotlib.path.Path` instance.
+ """
+ raise NotImplementedError('Derived must override')
- return path
-class RoundBoxTransmuter(BboxTransmuterBase):
- """
- A box with round corners.
- """
+ def __call__(self, x0, y0, width, height, mutation_size,
+ aspect_ratio=1.):
+ """
+ Given the location and size of the box, return the path of
+ the box around it.
- def __init__(self, pad=0.3, rounding_size=None):
- self.pad = pad
- self.rounding_size = rounding_size
- BboxTransmuterBase.__init__(self)
+ - *x0*, *y0*, *width*, *height* : location and size of the box
+ - *mutation_size* : a reference scale for the mutation.
+ - *aspect_ratio* : aspect-ration for the mutation.
+ """
+ # The __call__ method is a thin wrapper around the transmute method
+ # and take care of the aspect.
- def transmute(self, x0, y0, width, height, mutation_size):
+ if aspect_ratio is not None:
+ # Squeeze the given height by the aspect_ratio
+ y0, height = y0/aspect_ratio, height/aspect_ratio
+ # call transmute method with squeezed height.
+ path = self.transmute(x0, y0, width, height, mutation_size)
+ vertices, codes = path.vertices, path.codes
+ # Restore the height
+ vertices[:,1] = vertices[:,1] * aspect_ratio
+ return Path(vertices, codes)
+ else:
+ return self.transmute(x0, y0, width, height, mutation_size)
- # padding
- pad = mutation_size * self.pad
- # size of the roudning corner
- if self.rounding_size:
- dr = mutation_size * self.rounding_size
- else:
- dr = pad
- width, height = width + 2.*pad, \
- height + 2.*pad,
+ class Square(_Base):
+ """
+ A simple square box.
+ """
+ def __init__(self, pad=0.3):
+ """
+ *pad*
+ amount of padding
+ """
+
+ self.pad = pad
+ super(BoxStyle.Square, self).__init__()
- x0, y0 = x0-pad, y0-pad,
- x1, y1 = x0+width, y0 + height
+ def transmute(self, x0, y0, width, height, mutation_size):
- # Round corners are implemented as quadratic bezier. eg.
- # [(x0, y0-dr), (x0, y0), (x0+dr, y0)] for lower left corner.
- cp = [(x0+dr, y0),
- (x1-dr, y0),
- (x1, y0), (x1, y0+dr),
- (x1, y1-dr),
- (x1, y1), (x1-dr, y1),
- (x0+dr, y1),
- (x0, y1), (x0, y1-dr),
- (x0, y0+dr),
- (x0, y0), (x0+dr, y0),
- (x0+dr, y0)]
+ # padding
+ pad = mutation_size * self.pad
- com = [Path.MOVETO,
- Path.LINETO,
- Path.CURVE3, Path.CURVE3,
- Path.LINETO,
- Path.CURVE3, Path.CURVE3,
- Path.LINETO,
- Path.CURVE3, Path.CURVE3,
- Path.LINETO,
- Path.CURVE3, Path.CURVE3,
- Path.CLOSEPOLY]
+ # width and height with padding added.
+ width, height = width + 2.*pad, \
+ height + 2.*pad,
- path = Path(cp, com)
+ # boundary of the padded box
+ x0, y0 = x0-pad, y0-pad,
+ x1, y1 = x0+width, y0 + height
- return path
+ cp = [(x0, y0), (x1, y0), (x1, y1), (x0, y1),
+ (x0, y0), (x0, y0)]
+ com = [Path.MOVETO,
+ Path.LINETO,
+ Path.LINETO,
+ Path.LINETO,
+ Path.LINETO,
+ Path.CLOSEPOLY]
-class Round4BoxTransmuter(BboxTransmuterBase):
- """
- A box with round edges.
- """
+ path = Path(cp, com)
- def __init__(self, pad=0.3, rounding_size=None):
- self.pad = pad
- self.rounding_size = rounding_size
- BboxTransmuterBase.__init__(self)
+ return path
- def transmute(self, x0, y0, width, height, mutation_size):
+ _style_list["square"] = Square
- # padding
- pad = mutation_size * self.pad
- # roudning size. Use a half of the pad if not set.
- if self.rounding_size:
- dr = mutation_size * self.rounding_size
- else:
- dr = pad / 2.
+ class LArrow(_Base):
+ """
+ (left) Arrow Box
+ """
- width, height = width + 2.*pad - 2*dr, \
- height + 2.*pad - 2*dr,
+ def __init__(self, pad=0.3):
+ self.pad = pad
+ super(BoxStyle.LArrow, self).__init__()
+ def transmute(self, x0, y0, width, height, mutation_size):
- x0, y0 = x0-pad+dr, y0-pad+dr,
- x1, y1 = x0+width, y0 + height
+ # padding
+ pad = mutation_size * self.pad
+ # width and height with padding added.
+ width, height = width + 2.*pad, \
+ height + 2.*pad,
- cp = [(x0, y0),
- (x0+dr, y0-dr), (x1-dr, y0-dr), (x1, y0),
- (x1+dr, y0+dr), (x1+dr, y1-dr), (x1, y1),
- (x1-dr, y1+dr), (x0+dr, y1+dr), (x0, y1),
- (x0-dr, y1-dr), (x0-dr, y0+dr), (x0, y0),
- (x0, y0)]
+ # boundary of the padded box
+ x0, y0 = x0-pad, y0-pad,
+ x1, y1 = x0+width, y0 + height
- com = [Path.MOVETO,
- Path.CURVE4, Path.CURVE4, Path.CURVE4,
- Path.CURVE4, Path.CURVE4, Path.CURVE4,
- Path.CURVE4, Path.CURVE4, Path.CURVE4,
- Path.CURVE4, Path.CURVE4, Path.CURVE4,
- Path.CLOSEPOLY]
+ dx = (y1-y0)/2.
+ dxx = dx*.5
+ # adjust x0. 1.4 <- sqrt(2)
+ x0 = x0 + pad / 1.4
+
+ cp = [(x0+dxx, y0), (x1, y0), (x1, y1), (x0+dxx, y1),
+ (x0+dxx, y1+dxx), (x0-dx, y0+dx), (x0+dxx, y0-dxx), # arrow
+ (x0+dxx, y0), (x0+dxx, y0)]
- path = Path(cp, com)
+ com = [Path.MOVETO, Path.LINETO, Path.LINETO, Path.LINETO,
+ Path.LINETO, Path.LINETO, Path.LINETO,
+ Path.LINETO, Path.CLOSEPOLY]
- return path
+ path = Path(cp, com)
+ return path
+ _style_list["larrow"] = LArrow
-class SawtoothBoxTransmuter(BboxTransmuterBase):
- """
- A sawtooth box.
- """
+ class RArrow(LArrow):
+ """
+ (right) Arrow Box
+ """
- def __init__(self, pad=0.3, tooth_size=None):
- self.pad = pad
- self.tooth_size = tooth_size
- BboxTransmuterBase.__init__(self)
+ def __init__(self, pad=0.3):
+ self.pad = pad
+ super(BoxStyle.RArrow, self).__init__()
- def _get_sawtooth_vertices(self, x0, y0, width, height, mutation_size):
+ def transmute(self, x0, y0, width, height, mutation_size):
+ p = BoxStyle.LArrow.transmute(self, x0, y0,
+ width, height, mutation_size)
- # padding
- pad = mutation_size * self.pad
+ p.vertices[:,0] = 2*x0 + width - p.vertices[:,0]
- # size of sawtooth
- if self.tooth_size is None:
- tooth_size = self.pad * .5 * mutation_size
- else:
- tooth_size = self.tooth_size * mutation_size
+ return p
- tooth_size2 = tooth_size / 2.
- width, height = width + 2.*pad - tooth_size, \
- height + 2.*pad - tooth_size,
+
+ _style_list["rarrow"] = RArrow
- # the sizes of the vertical and horizontal sawtooth are
- # separately adjusted to fit the given box size.
- dsx_n = int(round((width - tooth_size) / (tooth_size * 2))) * 2
- dsx = (width - tooth_size) / dsx_n
- dsy_n = int(round((height - tooth_size) / (tooth_size * 2))) * 2
- dsy = (height - tooth_size) / dsy_n
+ class Round(_Base):
+ """
+ A box with round corners.
+ """
- x0, y0 = x0-pad+tooth_size2, y0-pad+tooth_size2
- x1, y1 = x0+width, y0 + height
+ def __init__(self, pad=0.3, rounding_size=None):
+ """
+ *pad*
+ amount of padding
+ *rounding_size*
+ rounding radius of corners. *pad* if None
+ """
+ self.pad = pad
+ self.rounding_size = rounding_size
+ super(BoxStyle.Round, self).__init__()
- bottom_saw_x = [x0] + \
- [x0 + tooth_size2 + dsx*.5* i for i in range(dsx_n*2)] + \
- [x1 - tooth_size2]
- bottom_saw_y = [y0] + \
- [y0 - tooth_size2, y0, y0 + tooth_size2, y0] * dsx_n + \
- [y0 - tooth_size2]
+ def transmute(self, x0, y0, width, height, mutation_size):
- right_saw_x = [x1] + \
- [x1 + tooth_size2, x1, x1 - tooth_size2, x1] * dsx_n + \
- [x1 + tooth_size2]
- right_saw_y = [y0] + \
- [y0 + tooth_size2 + dsy*.5* i for i in range(dsy_n*2)] + \
- [y1 - tooth_size2]
+ # padding
+ pad = mutation_size * self.pad
- top_saw_x = [x1] + \
- [x1 - tooth_size2 - dsx*.5* i for i in range(dsx_n*2)] + \
- [x0 + tooth_size2]
- top_saw_y = [y1] + \
- [y1 + tooth_size2, y1, y1 - tooth_size2, y1] * dsx_n + \
- [y1 + tooth_size2]
+ # size of the roudning corner
+ if self.rounding_size:
+ dr = mutation_size * self.rounding_size
+ else:
+ dr = pad
- left_saw_x = [x0] + \
- [x0 - tooth_size2, x0, x0 + tooth_size2, x0] * dsy_n + \
- [x0 - tooth_size2]
- left_saw_y = [y1] + \
- [y1 - tooth_size2 - dsy*.5* i for i in range(dsy_n*2)] + \
- [y0 + tooth_size2]
+ width, height = width + 2.*pad, \
+ height + 2.*pad,
- saw_vertices = zip(bottom_saw_x, bottom_saw_y) + \
- zip(right_saw_x, right_saw_y) + \
- zip(top_saw_x, top_saw_y) + \
- zip(left_saw_x, left_saw_y) + \
- [(bottom_saw_x[0], bottom_saw_y[0])]
- return saw_vertices
+ x0, y0 = x0-pad, y0-pad,
+ x1, y1 = x0+width, y0 + height
+ # Round corners are implemented as quadratic bezier. eg.
+ # [(x0, y0-dr), (x0, y0), (x0+dr, y0)] for lower left corner.
+ cp = [(x0+dr, y0),
+ (x1-dr, y0),
+ (x1, y0), (x1, y0+dr),
+ (x1, y1-dr),
+ (x1, y1), (x1-dr, y1),
+ (x0+dr, y1),
+ (x0, y1), (x0, y1-dr),
+ (x0, y0+dr),
+ (x0, y0), (x0+dr, y0),
+ (x0+dr, y0)]
- def transmute(self, x0, y0, width, height, mutation_size):
+ com = [Path.MOVETO,
+ Path.LINETO,
+ Path.CURVE3, Path.CURVE3,
+ Path.LINETO,
+ Path.CURVE3, Path.CURVE3,
+ Path.LINETO,
+ Path.CURVE3, Path.CURVE3,
+ Path.LINETO,
+ Path.CURVE3, Path.CURVE3,
+ Path.CLOSEPOLY]
- saw_vertices = self._get_sawtooth_vertices(x0, y0, width, height, mutation_size)
- path = Path(saw_vertices)
- return path
+ path = Path(cp, com)
+ return path
-class RoundtoothBoxTransmuter(SawtoothBoxTransmuter):
- """
- A roundtooth(?) box.
- """
+ _style_list["round"] = Round
- def transmute(self, x0, y0, width, height, mutation_size):
- saw_vertices = self._get_sawtooth_vertices(x0, y0, width, height, mutation_size)
+ class Round4(_Base):
+ """
+ Another box with round edges.
+ """
- cp = [Path.MOVETO] + ([Path.CURVE3, Path.CURVE3] * ((len(saw_vertices)-1)//2))
- path = Path(saw_vertices, cp)
+ def __init__(self, pad=0.3, rounding_size=None):
+ """
+ *pad*
+ amount of padding
- return path
+ *rounding_size*
+ rounding size of edges. *pad* if None
+ """
+
+ self.pad = pad
+ self.rounding_size = rounding_size
+ super(BoxStyle.Round4, self).__init__()
+ def transmute(self, x0, y0, width, height, mutation_size):
-def _list_available_boxstyles(transmuters):
- """ a helper function of the :class:`FancyBboxPatch` to list the available
- box styles. It inspects the arguments of the __init__ methods of
- each classes and report them
- """
- import inspect
- s = []
- for name, cls in transmuters.items():
- args, varargs, varkw, defaults = inspect.getargspec(cls.__init__)
- args_string = ["%s=%s" % (argname, str(argdefault)) \
- for argname, argdefault in zip(args[1:], defaults)]
- s.append(",".join([name]+args_string))
- return s
+ # padding
+ pad = mutation_size * self.pad
+ # roudning size. Use a half of the pad if not set.
+ if self.rounding_size:
+ dr = mutation_size * self.rounding_size
+ else:
+ dr = pad / 2.
+ width, height = width + 2.*pad - 2*dr, \
+ height + 2.*pad - 2*dr,
+ x0, y0 = x0-pad+dr, y0-pad+dr,
+ x1, y1 = x0+width, y0 + height
+
+ cp = [(x0, y0),
+ (x0+dr, y0-dr), (x1-dr, y0-dr), (x1, y0),
+ (x1+dr, y0+dr), (x1+dr, y1-dr), (x1, y1),
+ (x1-dr, y1+dr), (x0+dr, y1+dr), (x0, y1),
+ (x0-dr, y1-dr), (x0-dr, y0+dr), (x0, y0),
+ (x0, y0)]
+
+ com = [Path.MOVETO,
+ Path.CURVE4, Path.CURVE4, Path.CURVE4,
+ Path.CURVE4, Path.CURVE4, Path.CURVE4,
+ Path.CURVE4, Path.CURVE4, Path.CURVE4,
+ Path.CURVE4, Path.CURVE4, Path.CURVE4,
+ Path.CLOSEPOLY]
+
+ path = Path(cp, com)
+
+ return path
+
+ _style_list["round4"] = Round4
+
+
+ class Sawtooth(_Base):
+ """
+ A sawtooth box.
+ """
+
+ def __init__(self, pad=0.3, tooth_size=None):
+ """
+ *pad*
+ amount of padding
+
+ *tooth_size*
+ size of the sawtooth. pad* if None
+ """
+ self.pad = pad
+ self.tooth_size = tooth_size
+ super(BoxStyle.Sawtooth, self).__init__()
+
+ def _get_sawtooth_vertices(self, x0, y0, width, height, mutation_size):
+
+
+ # padding
+ pad = mutation_size * self.pad
+
+ # size of sawtooth
+ if self.tooth_size is None:
+ tooth_size = self.pad * .5 * mutation_size
+ else:
+ tooth_size = self.tooth_size * mutation_size
+
+ tooth_size2 = tooth_size / 2.
+ width, height = width + 2.*pad - tooth_size, \
+ height + 2.*pad - tooth_size,
+
+ # the sizes of the vertical and horizontal sawtooth are
+ # separately adjusted to fit the given box size.
+ dsx_n = int(round((width - tooth_size) / (tooth_size * 2))) * 2
+ dsx = (width - tooth_size) / dsx_n
+ dsy_n = int(round((height - tooth_size) / (tooth_size * 2))) * 2
+ dsy = (height - tooth_size) / dsy_n
+
+
+ x0, y0 = x0-pad+tooth_size2, y0-pad+tooth_size2
+ x1, y1 = x0+width, y0 + height
+
+
+ bottom_saw_x = [x0] + \
+ [x0 + tooth_size2 + dsx*.5* i for i in range(dsx_n*2)] + \
+ [x1 - tooth_size2]
+ bottom_saw_y = [y0] + \
+ [y0 - tooth_size2, y0, y0 + tooth_size2, y0] * dsx_n + \
+ [y0 - tooth_size2]
+
+ right_saw_x = [x1] + \
+ [x1 + tooth_size2, x1, x1 - tooth_size2, x1] * dsx_n + \
+ [x1 + tooth_size2]
+ right_saw_y = [y0] + \
+ [y0 + tooth_size2 + dsy*.5* i for i in range(dsy_n*2)] + \
+ [y1 - tooth_size2]
+
+ top_saw_x = [x1] + \
+ [x1 - tooth_size2 - dsx*.5* i for i in range(dsx_n*2)] + \
+ [x0 + tooth_size2]
+ top_saw_y = [y1] + \
+ [y1 + tooth_size2, y1, y1 - tooth_size2, y1] * dsx_n + \
+ [y1 + tooth_size2]
+
+ left_saw_x = [x0] + \
+ [x0 - tooth_size2, x0, x0 + tooth_size2, x0] * dsy_n + \
+ [x0 - tooth_size2]
+ left_saw_y = [y1] + \
+ [y1 - tooth_size2 - dsy*.5* i for i in range(dsy_n*2)] + \
+ [y0 + tooth_size2]
+
+ saw_vertices = zip(bottom_saw_x, bottom_saw_y) + \
+ zip(right_saw_x, right_saw_y) + \
+ zip(top_saw_x, top_saw_y) + \
+ zip(left_saw_x, left_saw_y) + \
+ [(bottom_saw_x[0], bottom_saw_y[0])]
+
+ return saw_vertices
+
+
+ def transmute(self, x0, y0, width, height, mutation_size):
+
+ saw_vertices = self._get_sawtooth_vertices(x0, y0, width, height, mutation_size)
+ path = Path(saw_vertices)
+ return path
+
+ _style_list["sawtooth"] = Sawtooth
+
+
+ class Roundtooth(Sawtooth):
+ """
+ A roundtooth(?) box.
+ """
+
+ def __init__(self, pad=0.3, tooth_size=None):
+ """
+ *pad*
+ amount of padding
+
+ *tooth_size*
+ size of the sawtooth. pad* if None
+ """
+ super(BoxStyle.Roundtooth, self).__init__(pad, tooth_size)
+
+
+ def transmute(self, x0, y0, width, height, mutation_size):
+
+ saw_vertices = self._get_sawtooth_vertices(x0, y0, width, height, mutation_size)
+
+ cp = [Path.MOVETO] + ([Path.CURVE3, Path.CURVE3] * ((len(saw_vertices)-1)//2))
+ path = Path(saw_vertices, cp)
+
+ return path
+
+ _style_list["roundtooth"] = Roundtooth
+
+ __doc__ = cbook.dedent(__doc__) % \
+ {"AvailableBoxstyles": _pprint_styles(_style_list)}
+
+
class FancyBboxPatch(Patch):
"""
Draw a fancy box around a rectangle with lower left at *xy*=(*x*,
@@ -1689,27 +1947,8 @@
transformation of the rectangle box to the fancy box is delegated
to the :class:`BoxTransmuterBase` and its derived classes.
- *boxstyle* determines what kind of fancy box will be drawn. In
- other words, it selects the :class:`BboxTransmuter` class to use,
- and sets optional attributes.
-
- *bbox_transmuter* can specify a custom :class:`BboxTransmuter`
- instance.
-
- *mutation_scale* determines the overall size of the mutation (by
- which I mean the transformation of the rectangle to the fancy
- path)
-
- *mutation_aspect* determines the aspect-ratio of the mutation.
"""
- _fancy_bbox_transmuters = {"square":SquareBoxTransmuter,
- "round":RoundBoxTransmuter,
- "round4":Round4BoxTransmuter,
- "sawtooth":SawtoothBoxTransmuter,
- "roundtooth":RoundtoothBoxTransmuter,
- }
-
def __str__(self):
return self.__class__.__name__ \
+ "FancyBboxPatch(%g,%g;%gx%g)" % (self._x, self._y, self._width, self._height)
@@ -1725,18 +1964,13 @@
*width*, *height*
- *boxstyle* describes how the fancy box will be drawn. It
- should be one of the available boxstyle names, with optional
- comma-separated attributes. These attributes are meant to be
- scaled with the *mutation_scale*. Following box styles are
- available.
+ *boxstyle* determines what kind of fancy box will be drawn. It
+ can be a string of the style name with a comma separated
+ attribute, or an instance of :class:`BoxStyle`. Following box
+ styles are available.
%(AvailableBoxstyles)s
- The *boxstyle* name can be "custom", in which case the
- *bbox_transmuter* argument needs to be set, which should be an
- instance of :class:`BboxTransmuterBase` (or its derived).
-
*mutation_scale* : a value with which attributes of boxstyle
(e.g., pad) will be scaled. default=1.
@@ -1767,17 +2001,12 @@
kwdoc = dict()
- kwdoc["AvailableBoxstyles"]="\n".join([" - " + l \
- for l in _list_available_boxstyles(_fancy_bbox_transmuters)])
+ kwdoc["AvailableBoxstyles"]=_pprint_styles(BoxStyle._style_list)
kwdoc.update(artist.kwdocd)
__init__.__doc__ = cbook.dedent(__init__.__doc__) % kwdoc
del kwdoc
- @classmethod
- def list_available_boxstyles(cls):
- return _list_available_boxstyles(cls._fancy_bbox_transmuters)
-
def set_boxstyle(self, boxstyle=None, **kw):
"""
Set the box style.
@@ -1799,29 +2028,20 @@
if boxstyle==None:
# print out available boxstyles and return.
- print " Following box styles are available."
- for l in self.list_available_boxstyles():
- print " - " + l
+ print "Following box styles are available:"
+ print BoxStyle.pprint_styles()
return
- # parse the boxstyle descrption (e.g. "round,pad=0.3")
- bs_list = boxstyle.replace(" ","").split(",")
- boxstyle_name = bs_list[0]
- try:
- bbox_transmuter_cls = self._fancy_bbox_transmuters[boxstyle_name]
- except KeyError:
- raise ValueError("Unknown Boxstyle : %s" % boxstyle_name)
- try:
- boxstyle_args_pair = [bs.split("=") for bs in bs_list[1:]]
- boxstyle_args = dict([(k, float(v)) for k, v in boxstyle_args_pair])
- except ValueError:
- raise ValueError("Incorrect Boxstyle argument : %s" % boxstyle)
+ if isinstance(boxstyle, BoxStyle._Base):
+ self._bbox_transmuter = boxstyle
+ elif callable(boxstyle):
+ self._bbox_transmuter = boxstyle
+ else:
+ self._bbox_transmuter = BoxStyle(boxstyle, **kw)
+
- boxstyle_args.update(kw)
- self._bbox_transmuter = bbox_transmuter_cls(**boxstyle_args)
kwdoc = dict()
- kwdoc["AvailableBoxstyles"]=" | ".join([l \
- for l in _list_available_boxstyles(_fancy_bbox_transmuters)])
+ kwdoc["AvailableBoxstyles"]=_pprint_styles(BoxStyle._style_list)
kwdoc.update(artist.kwdocd)
set_boxstyle.__doc__ = cbook.dedent(set_boxstyle.__doc__) % kwdoc
del kwdoc
@@ -1854,16 +2074,8 @@
"""
return self._mutation_aspect
- def set_bbox_transmuter(self, bbox_transmuter):
- """
- Set the transmuter object
-
- ACCEPTS: :class:`BboxTransmuterBase` (or its derivatives) instance
- """
- self._bbox_transmuter = bbox_transmuter
-
- def get_bbox_transmuter(self):
- "Return the current transmuter object"
+ def get_boxstyle(self):
+ "Return the boxstyle object"
return self._bbox_transmuter
def get_path(self):
@@ -1871,10 +2083,10 @@
Return the mutated path of the rectangle
"""
- _path = self.get_bbox_transmuter()(self._x, self._y,
- self._width, self._height,
- self.get_mutation_scale(),
- self.get_mutation_aspect())
+ _path = self.get_boxstyle()(self._x, self._y,
+ self._width, self._height,
+ self.get_mutation_scale(),
+ self.get_mutation_aspect())
return _path
@@ -1954,239 +2166,354 @@
from matplotlib.bezier import split_bezier_intersecting_with_closedpath
from matplotlib.bezier import get_intersection, inside_circle, get_parallels
from matplotlib.bezier import make_wedged_bezier2
-from matplotlib.bezier import split_path_inout, inside_circle
+from matplotlib.bezier import split_path_inout, inside_circle, get_cos_sin
-class ConnectorBase(object):
- """ The ConnectorClass is used to define a path between a two
- points. This class is used in the FancyArrowPatch class. It
- creates a path between point A and point B. When optional patch
- objects (pathcA & patchB) are provided and if they enclose the
- point A or B, the path is clipped to the boundary of the each
- patch. Additionally the path can be shirnked by a fixed size
- (given in points) with shrinkA and shrinkB.
+
+class ConnectionStyle(_Style):
"""
+ :class:`ConnectionStyle` is a container class which defines
+ several connectionstyle classes, which is used to create a path
+ between two points. These are mainly used with
+ :class:`FancyArrowPatch`.
- class SimpleEvent:
- def __init__(self, xy):
- self.x, self.y = xy
+ A connectionstyle object can be either created as
- def _clip(self, path, patchA, patchB):
- """ Clip the path to the boundary of the patchA and patchB.
- The starting point of the path needed to be inside of the
- patchA and the end point inside the patch B. The contains
- methods of each patch object is utilized to test if the point
- is inside the path.
+ ConnectionStyle.Arc3(rad=0.2)
+
+ or
+
+ ConnectionStyle("Arc3", rad=0.2)
+
+ or
+
+ ConnectionStyle("Arc3, rad=0.2")
+
+ Following classes are defined
+
+ %(AvailableConnectorstyles)s
+
+
+ An instance of any connection style class is an callable object,
+ whose call signature is
+
+ __call__(self, posA, posB, patchA=None, patchB=None, shrinkA=2., shrinkB=2.)
+
+ and it returns a :class:`Path` instance. *posA* and *posB are tuples
+ of x,y coordinates of the two points to be connected. *patchA* (or
+ $patchB*) is given, the returned path is clipped so that it start
+ (or end) from the boundary of the patch. The path is further
+ shrinked by *shrinkA* (or *shrinkB*) which is given in points.
+ """
+
+ _style_list = {}
+
+
+ class _Base(object):
"""
+ A base class for connectionstyle classes. The dervided needs
+ to implement a *connect* methods whose call signature is
- if patchA:
- def insideA(xy_display):
- #xy_display = patchA.get_data_transform().transform_point(xy_data)
- xy_event = ConnectorBase.SimpleEvent(xy_display)
- return patchA.contains(xy_event)[0]
+ connect(posA, posB)
+
+ where posA and posB are tuples of x, y coordinates to be
+ connected. The methods needs to return a path connecting two
+ points. This base class defines a __call__ method, and few
+ helper methods.
+ """
- try:
+ class SimpleEvent:
+ def __init__(self, xy):
+ self.x, self.y = xy
+
+ def _clip(self, path, patchA, patchB):
+ """
+ Clip the path to the boundary of the patchA and patchB.
+ The starting point of the path needed to be inside of the
+ patchA and the end point inside the patch B. The *contains*
+ methods of each patch object is utilized to test if the point
+ is inside the path.
+ """
+
+ if patchA:
+ def insideA(xy_display):
+ #xy_display = patchA.get_data_transform().transform_point(xy_data)
+ xy_event = ConnectionStyle._Base.SimpleEvent(xy_display)
+ return patchA.contains(xy_event)[0]
+
+ try:
+ left, right = split_path_inout(path, insideA)
+ except ValueError:
+ right = path
+
+ path = right
+
+ if patchB:
+ def insideB(xy_display):
+ #xy_display = patchB.get_data_transform().transform_point(xy_data)
+ xy_event = ConnectionStyle._Base.SimpleEvent(xy_display)
+ return patchB.contains(xy_event)[0]
+
+ try:
+ left, right = split_path_inout(path, insideB)
+ except ValueError:
+ left = path
+
+ path = left
+
+ return path
+
+
+ def _shrink(self, path, shrinkA, shrinkB):
+ """
+ Shrink the path by fixed size (in points) with shrinkA and shrinkB
+ """
+ if shrinkA:
+ x, y = path.vertices[0]
+ insideA = inside_circle(x, y, shrinkA)
+
left, right = split_path_inout(path, insideA)
- except ValueError:
- right = path
+ path = right
- path = right
+ if shrinkB:
+ x, y = path.vertices[-1]
+ insideB = inside_circle(x, y, shrinkB)
- if patchB:
- def insideB(xy_display):
- #xy_display = patchB.get_data_transform().transform_point(xy_data)
- xy_event = ConnectorBase.SimpleEvent(xy_display)
- return patchB.contains(xy_event)[0]
-
- try:
left, right = split_path_inout(path, insideB)
- except ValueError:
- left = path
+ path = left
- path = left
+ return path
- #ppp = patchB.get_patch_transform().transform_path(patchB.get_path())
- #def insideB(xy_data):
- # return ppp.contains_point(xy_data)
- ##return patchB.contains(ConnectorBase.SimpleEvent(xy))[0]
+ def __call__(self, posA, posB,
+ shrinkA=2., shrinkB=2., patchA=None, patchB=None):
+ """
+ Calls the *connect* method to create a path between *posA*
+ and *posB*. The path is clipped and shrinked.
+ """
+
+ path = self.connect(posA, posB)
- return path
+ clipped_path = self._clip(path, patchA, patchB)
+ shrinked_path = self._shrink(clipped_path, shrinkA, shrinkB)
+ return shrinked_path
- def _shrink(self, path, shrinkA, shrinkB):
+
+ class Arc3(_Base):
"""
- Shrink the path by fixed size (in points) with shrinkA and shrinkB
+ Creates a simple quadratic bezier curve between two
+ points. The curve is created so that the middle contol points
+ (C1) is located at the same distance from the start (C0) and
+ end points(C2) and the distance of the C1 to the line
+ connecting C0-C2 is *rad* times the distance of C0-C2.
"""
- if shrinkA:
- x, y = path.vertices[0]
- insideA = inside_circle(x, y, shrinkA)
- left, right = split_path_inout(path, insideA)
- path = right
+ def __init__(self, rad=0.):
+ """
+ *rad*
+ curvature of the curve.
+ """
+ self.rad = rad
- if shrinkB:
- x, y = path.vertices[-1]
- insideB = inside_circle(x, y, shrinkB)
+ def connect(self, posA, posB):
+ x1, y1 = posA
+ x2, y2 = posB
+ x12, y12 = (x1 + x2)/2., (y1 + y2)/2.
+ dx, dy = x2 - x1, y2 - y1
- left, right = split_path_inout(path, insideB)
- path = left
+ f = self.rad
- return path
+ cx, cy = x12 + f*dy, y12 - f*dx
- def __call__(self, posA, posB,
- shrinkA=2., shrinkB=2., patchA=None, patchB=None):
+ vertices = [(x1, y1),
+ (cx, cy),
+ (x2, y2)]
+ codes = [Path.MOVETO,
+ Path.CURVE3,
+ Path.CURVE3]
- path = self.connect(posA, posB)
+ return Path(vertices, codes)
- clipped_path = self._clip(path, patchA, patchB)
- shrinked_path = self._shrink(clipped_path, shrinkA, shrinkB)
+ _style_list["arc3"] = Arc3
+
- return shrinked_path
+ class Angle3(_Base):
+ """
+ Creates a simple quadratic bezier curve between two
+ points. The middle control points is placed at the
+ intersecting point of two lines which crosses the start (or
+ end) point and has a angle of angleA (or angleB).
+ """
-class Arc3Connector(ConnectorBase):
- """ Creates a simple quadratic bezier curve between two
- points. The curve is created so that the middle contol points (C1)
- is located at the same distance from the start (C0) and end
- points(C2) and the distance of the C1 to the line connecting C0-C2
- is *rad* times the distance of C0-C2.
- """
- def __init__(self, rad=0.):
- self.rad = rad
+ def __init__(self, angleA=90, angleB=0):
+ """
+ *angleA*
+ starting angle of the path
- def connect(self, posA, posB):
- x1, y1 = posA
- x2, y2 = posB
- x12, y12 = (x1 + x2)/2., (y1 + y2)/2.
- dx, dy = x2 - x1, y2 - y1
+ *angleB*
+ ending angle of the path
+ """
- f = self.rad
+ self.angleA = angleA
+ self.angleB = angleB
- cx, cy = x12 + f*dy, y12 - f*dx
- vertices = [(x1, y1),
- (cx, cy),
- (x2, y2)]
- codes = [Path.MOVETO,
- Path.CURVE3,
- Path.CURVE3]
+ def connect(self, posA, posB):
+ x1, y1 = posA
+ x2, y2 = posB
- return Path(vertices, codes)
+ cosA, sinA = math.cos(self.angleA/180.*math.pi),\
+ math.sin(self.angleA/180.*math.pi),
+ cosB, sinB = math.cos(self.angleB/180.*math.pi),\
+ math.sin(self.angleB/180.*math.pi),
+ cx, cy = get_intersection(x1, y1, cosA, sinA,
+ x2, y2, cosB, sinB)
-class Angle3Connector(ConnectorBase):
- """ Creates a simple quadratic bezier curve between two
- points. The middle control points is placed at the intersecting
- point of two lines which crosses the start (or end) point
- and has a angle of angleA (or angleB).
- """
- def __init__(self, angleA=90, angleB=0):
- self.angleA = angleA
- self.angleB = angleB
+ vertices = [(x1, y1), (cx, cy), (x2, y2)]
+ codes = [Path.MOVETO, Path.CURVE3, Path.CURVE3]
- def connect(self, posA, posB):
- x1, y1 = posA
- x2, y2 = posB
+ return Path(vertices, codes)
- cosA, sinA = math.cos(self.angleA/180.*math.pi),\
- math.sin(self.angleA/180.*math.pi),
- cosB, sinB = math.cos(self.angleB/180.*math.pi),\
- math.sin(self.angleB/180.*math.pi),
+ _style_list["angle3"] = Angle3
- cx, cy = get_intersection(x1, y1, cosA, sinA,
- x2, y2, cosB, sinB)
- vertices = [(x1, y1), (cx, cy), (x2, y2)]
- codes = [Path.MOVETO, Path.CURVE3, Path.CURVE3]
+ class Angle(_Base):
+ """
+ Creates a picewise continuous quadratic bezier path between
+ two points. The path has a one passing-through point placed at
+ the intersecting point of two lines which crosses the start
+ (or end) point and has a angle of angleA (or angleB). The
+ connecting edges are rounded with *rad*.
+ """
- return Path(vertices, codes)
+ def __init__(self, angleA=90, angleB=0, rad=0.):
+ """
+ *angleA*
+ starting angle of the path
+ *angleB*
+ ending angle of the path
-class AngleConnector(ConnectorBase):
- """ Creates a picewise continuous quadratic bezier path between
- two points. The path has a one passing-through point placed at the
- intersecting point of two lines which crosses the start (or end)
- point and has a angle of angleA (or angleB). The connecting edges are
- rounded with *rad*.
- """
+ *rad*
+ rounding radius of the edge
+ """
- def __init__(self, angleA=90, angleB=0, rad=0.):
- self.angleA = angleA
- self.angleB = angleB
+ self.angleA = angleA
+ self.angleB = angleB
- self.rad = rad
+ self.rad = rad
- def connect(self, posA, posB):
- x1, y1 = posA
- x2, y2 = posB
+ def connect(self, posA, posB):
+ x1, y1 = posA
+ x2, y2 = posB
- cosA, sinA = math.cos(self.angleA/180.*math.pi),\
- math.sin(self.angleA/180.*math.pi),
- cosB, sinB = math.cos(self.angleB/180.*math.pi),\
- -math.sin(self.angleB/180.*math.pi),
+ cosA, sinA = math.cos(self.angleA/180.*math.pi),\
+ math.sin(self.angleA/180.*math.pi),
+ cosB, sinB = math.cos(self.angleB/180.*math.pi),\
+ -math.sin(self.angleB/180.*math.pi),
- cx, cy = get_intersection(x1, y1, cosA, sinA,
- x2, y2, cosB, sinB)
+ cx, cy = get_intersection(x1, y1, cosA, sinA,
+ x2, y2, cosB, sinB)
- vertices = [(x1, y1)]
- codes = [Path.MOVETO]
+ vertices = [(x1, y1)]
+ codes = [Path.MOVETO]
- if self.rad == 0.:
- vertices.append((cx, cy))
+ if self.rad == 0.:
+ vertices.append((cx, cy))
+ codes.append(Path.LINETO)
+ else:
+ vertices.extend([(cx - self.rad * cosA, cy - self.rad * sinA),
+ (cx, cy),
+ (cx + self.rad * cosB, cy + self.rad * sinB)])
+ codes.extend([Path.LINETO, Path.CURVE3, Path.CURVE3])
+
+ vertices.append((x2, y2))
codes.append(Path.LINETO)
- else:
- vertices.extend([(cx - self.rad * cosA, cy - self.rad * sinA),
- (cx, cy),
- (cx + self.rad * cosB, cy + self.rad * sinB)])
- codes.extend([Path.LINETO, Path.CURVE3, Path.CURVE3])
- vertices.append((x2, y2))
- codes.append(Path.LINETO)
+ return Path(vertices, codes)
- return Path(vertices, codes)
+ _style_list["angle"] = Angle
+ class Arc(_Base):
+ """
+ Creates a picewise continuous quadratic bezier path between
+ two points. The path can have two passing-through points, a
+ point placed at the distance of armA and angle of angleA from
+ point A, another point with respect to point B. The edges are
+ rounded with *rad*.
+ """
-class ArcConnector(ConnectorBase):
- """ Creates a picewise continuous quadratic bezier path between
- two points. The path can have two passing-through points, a point
- placed at the distance of armA and angle of angleA from point A,
- another point with respect to point B. The edges are rounded with
- *rad*.
- """
+ def __init__(self, angleA=0, angleB=0, armA=None, armB=None, rad=0.):
+ """
+ *angleA* :
+ starting angle of the path
- def __init__(self, angleA=0, angleB=0, armA=None, armB=None, rad=0.):
- self.angleA = angleA
- self.angleB = angleB
- self.armA = armA
- self.armB = armB
+ *angleB* :
+ ending angle of the path
- self.rad = rad
+ *armA* :
+ length of the starting arm
- def connect(self, posA, posB):
- x1, y1 = posA
- x2, y2 = posB
+ *armB* :
+ length of the ending arm
- vertices = [(x1, y1)]
- rounded = []
- codes = [Path.MOVETO]
+ *rad* :
+ rounding radius of the edges
+ """
- if self.armA:
- cosA = math.cos(self.angleA/180.*math.pi)
- sinA = math.sin(self.angleA/180.*math.pi)
- #x_armA, y_armB
- d = self.armA - self.rad
- rounded.append((x1 + d*cosA, y1 + d*sinA))
- d = self.armA
- rounded.append((x1 + d*cosA, y1 + d*sinA))
+ self.angleA = angleA
+ self.angleB = angleB
+ self.armA = armA
+ self.armB = armB
- if self.armB:
- cosB = math.cos(self.angleB/180.*math.pi)
- sinB = math.sin(self.angleB/180.*math.pi)
- x_armB, y_armB = x2 + self.armB*cosB, y2 + self.armB*sinB
+ self.rad = rad
+ def connect(self, posA, posB):
+ x1, y1 = posA
+ x2, y2 = posB
+
+ vertices = [(x1, y1)]
+ rounded = []
+ codes = [Path.MOVETO]
+
+ if self.armA:
+ cosA = math.cos(self.angleA/180.*math.pi)
+ sinA = math.sin(self.angleA/180.*math.pi)
+ #x_armA, y_armB
+ d = self.armA - self.rad
+ rounded.append((x1 + d*cosA, y1 + d*sinA))
+ d = self.armA
+ rounded.append((x1 + d*cosA, y1 + d*sinA))
+
+ if self.armB:
+ cosB = math.cos(self.angleB/180.*math.pi)
+ sinB = math.sin(self.angleB/180.*math.pi)
+ x_armB, y_armB = x2 + self.armB*cosB, y2 + self.armB*sinB
+
+ if rounded:
+ xp, yp = rounded[-1]
+ dx, dy = x_armB - xp, y_armB - yp
+ dd = (dx*dx + dy*dy)**.5
+
+ rounded.append((xp + self.rad*dx/dd, yp + self.rad*dy/dd))
+ vertices.extend(rounded)
+ codes.extend([Path.LINETO,
+ Path.CURVE3,
+ Path.CURVE3])
+ else:
+ xp, yp = vertices[-1]
+ dx, dy = x_armB - xp, y_armB - yp
+ dd = (dx*dx + dy*dy)**.5
+
+ d = dd - self.rad
+ rounded = [(xp + d*dx/dd, yp + d*dy/dd),
+ (x_armB, y_armB)]
+
if rounded:
xp, yp = rounded[-1]
- dx, dy = x_armB - xp, y_armB - yp
+ dx, dy = x2 - xp, y2 - yp
dd = (dx*dx + dy*dy)**.5
rounded.append((xp + self.rad*dx/dd, yp + self.rad*dy/dd))
@@ -2194,528 +2521,677 @@
codes.extend([Path.LINETO,
Path.CURVE3,
Path.CURVE3])
- else:
- xp, yp = vertices[-1]
- dx, dy = x_armB - xp, y_armB - yp
- dd = (dx*dx + dy*dy)**.5
- d = dd - self.rad
- rounded = [(xp + d*dx/dd, yp + d*dy/dd),
- (x_armB, y_armB)]
+ vertices.append((x2, y2))
+ codes.append(Path.LINETO)
- if rounded:
- xp, yp = rounded[-1]
- dx, dy = x2 - xp, y2 - yp
- dd = (dx*dx + dy*dy)**.5
+ return Path(vertices, codes)
- rounded.append((xp + self.rad*dx/dd, yp + self.rad*dy/dd))
- vertices.extend(rounded)
- codes.extend([Path.LINETO,
- Path.CURVE3,
- Path.CURVE3])
+ _style_list["arc"] = Arc
- vertices.append((x2, y2))
- codes.append(Path.LINETO)
+ __doc__ = cbook.dedent(__doc__) % \
+ {"AvailableConnectorstyles": _pprint_styles(_style_list)}
+
- return Path(vertices, codes)
+class ArrowStyle(_Style):
+ """
+ :class:`ArrowStyle` is a container class which defines several
+ arrowstyle classes, which is used to create an arrow path along a
+ given path. These are mainly used with :class:`FancyArrowPatch`.
+ A arrowstyle object can be either created as
+ ArrowStyle.Fancy(head_length=.4, head_width=.4, tail_width=.4)
+ or
-class ArrowTransmuterBase(object):
- """
- Arrow Transmuter Base class
+ ArrowStyle("Fancy", head_length=.4, head_width=.4, tail_width=.4)
- ArrowTransmuterBase and its derivatives are used to make a fancy
- arrow around a given path. The __call__ method returns a path
- (which will be used to create a PathPatch instance) and a boolean
- value indicating the path is open therefore is not fillable. This
- class is not an artist and actual drawing of the fancy arrow is
- done by the FancyArrowPatch class.
+ or
+
+ ArrowStyle("Fancy, head_length=.4, head_width=.4, tail_width=.4")
+ Following classes are defined
+
+ %(AvailableArrowstyles)s
+
+
+ An instance of any arrow style class is an callable object,
+ whose call signature is
+
+ __call__(self, path, mutation_size, linewidth, aspect_ratio=1.)
+
+ and it returns a tuple of a :class:`Path` instance and a boolean
+ value. *path* is a :class:`Path` instance along witch the arrow
+ will be drawn. *mutation_size* and *aspect_ratio* has a same
+ meaning as in :class:`BoxStyle`. *linewidth* is a line width to be
+ stroked. This is meant to be used to correct the location of the
+ head so that it does not overshoot the destination point, but not all
+ classes support it.
"""
- # The derived classes are required to be able to be initialized
- # w/o arguments, i.e., all its argument (except self) must have
- # the default values.
- def __init__(self):
- super(ArrowTransmuterBase, self).__init__()
+ _style_list = {}
- @staticmethod
- def ensure_quadratic_bezier(path):
- """ Some ArrowTransmuter class only wokrs with a simple
- quaratic bezier curve (created with Arc3Connetion or
- Angle3Connector). This static method is to check if the
- provided path is a simple quadratic bezier curve and returns
- its control points if true.
+ class _Base(object):
"""
- segments = list(path.iter_segments())
- assert len(segments) == 2
+ Arrow Transmuter Base class
- assert segments[0][1] == Path.MOVETO
- assert segments[1][1] == Path.CURVE3
+ ArrowTransmuterBase and its derivatives are used to make a fancy
+ arrow around a given path. The __call__ method returns a path
+ (which will be used to create a PathPatch instance) and a boolean
+ value indicating the path is open therefore is not fillable. This
+ class is not an artist and actual drawing of the fancy arrow is
+ done by the FancyArrowPatch class.
- return list(segments[0][0]) + list(segments[1][0])
+ """
+ # The derived classes are required to be able to be initialized
+ # w/o arguments, i.e., all its argument (except self) must have
+ # the default values.
- def transmute(self, path, mutation_size, linewidth):
+ def __init__(self):
+ super(ArrowStyle....
[truncated message content] |
|
From: <lee...@us...> - 2008-12-02 22:27:43
|
Revision: 6479
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6479&view=rev
Author: leejjoon
Date: 2008-12-02 22:27:38 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
Fixed a bug in the new legend class that didn't allowed a tuple of coordinate vlaues as loc
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/legend.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-12-02 22:04:41 UTC (rev 6478)
+++ trunk/matplotlib/CHANGELOG 2008-12-02 22:27:38 UTC (rev 6479)
@@ -1,3 +1,6 @@
+2008-12-02 Fixed a bug in the new legend class that didn't allowed
+ a tuple of coordinate vlaues as loc. -JJL
+
2008-12-02 Improve checks for external dependencies, using subprocess
(instead of deprecated popen*) and distutils (for version
checking) - DSD
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py 2008-12-02 22:04:41 UTC (rev 6478)
+++ trunk/matplotlib/lib/matplotlib/legend.py 2008-12-02 22:27:38 UTC (rev 6479)
@@ -61,6 +61,9 @@
'upper center' : 9,
'center' : 10,
+ loc can be a tuple of the noramilzed coordinate values with
+ respect its parent.
+
Return value is a sequence of text, line instances that make
up the legend
"""
@@ -100,7 +103,7 @@
axespad = None, # deprecated; use borderaxespad
# spacing & pad defined as a fractionof the font-size
- borderpad = None, # the fractional whitespace inside the legend border
+ borderpad = None, # the whitespace inside the legend border
labelspacing=None, #the vertical space between the legend entries
handlelength=None, # the length of the legend handles
handletextpad=None, # the pad between the legend handle and text
@@ -119,11 +122,11 @@
Optional keyword arguments:
- ================ =========================================
+ ================ =================================================
Keyword Description
- ================ =========================================
+ ================ =================================================
- loc a location code
+ loc a location code or a tuple of coordinates
numpoints the number of points in the legend line
prop the font property
markerscale the relative size of legend markers vs. original
@@ -284,14 +287,22 @@
a.set_transform(self.get_transform())
def _findoffset_best(self, width, height, xdescent, ydescent):
- "Heper function to locate the legend"
+ "Heper function to locate the legend at its best position"
ox, oy = self._find_best_position(width, height)
return ox+xdescent, oy+ydescent
def _findoffset_loc(self, width, height, xdescent, ydescent):
- "Heper function to locate the legend"
- bbox = Bbox.from_bounds(0, 0, width, height)
- x, y = self._get_anchored_bbox(self._loc, bbox, self.parent.bbox)
+ "Heper function to locate the legend using the location code"
+
+ if iterable(self._loc) and len(self._loc)==2:
+ # when loc is a tuple of axes(or figure) coordinates.
+ fx, fy = self._loc
+ bbox = self.parent.bbox
+ x, y = bbox.x0 + bbox.width * fx, bbox.y0 + bbox.height * fy
+ else:
+ bbox = Bbox.from_bounds(0, 0, width, height)
+ x, y = self._get_anchored_bbox(self._loc, bbox, self.parent.bbox)
+
return x+xdescent, y+ydescent
def draw(self, renderer):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-12-02 22:04:45
|
Revision: 6478
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6478&view=rev
Author: dsdale
Date: 2008-12-02 22:04:41 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
removed lingering print statement
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2008-12-02 20:09:44 UTC (rev 6477)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2008-12-02 22:04:41 UTC (rev 6478)
@@ -110,7 +110,6 @@
FigureCanvasBase.enter_notify_event(self, event)
def leaveEvent(self, event):
- print event
FigureCanvasBase.leave_notify_event(self, event)
def mousePressEvent( self, event ):
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:09:47
|
Revision: 6477
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6477&view=rev
Author: mdboom
Date: 2008-12-02 20:09:44 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
Round theta ticks to the nearest degree, rather than truncating.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/projections/polar.py
Modified: trunk/matplotlib/lib/matplotlib/projections/polar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/projections/polar.py 2008-12-02 20:08:53 UTC (rev 6476)
+++ trunk/matplotlib/lib/matplotlib/projections/polar.py 2008-12-02 20:09:44 UTC (rev 6477)
@@ -137,14 +137,14 @@
def __call__(self, x, pos=None):
# \u00b0 : degree symbol
if rcParams['text.usetex'] and not rcParams['text.latex.unicode']:
- return r"$%d^\circ$" % ((x / npy.pi) * 180.0)
+ return r"$%0.0f^\circ$" % ((x / npy.pi) * 180.0)
else:
# we use unicode, rather than mathtext with \circ, so
# that it will work correctly with any arbitrary font
# (assuming it has a degree sign), whereas $5\circ$
# will only work correctly with one of the supported
# math fonts (Computer Modern and STIX)
- return u"%d\u00b0" % ((x / npy.pi) * 180.0)
+ return u"%0.0f\u00b0" % ((x / npy.pi) * 180.0)
class RadialLocator(Locator):
"""
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: <md...@us...> - 2008-12-02 19:51:12
|
Revision: 6475
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6475&view=rev
Author: mdboom
Date: 2008-12-02 19:51:10 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
suppress gcc-4.3 warnings
Modified Paths:
--------------
trunk/matplotlib/src/_backend_agg.cpp
trunk/matplotlib/src/_image.cpp
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2008-12-02 17:55:15 UTC (rev 6474)
+++ trunk/matplotlib/src/_backend_agg.cpp 2008-12-02 19:51:10 UTC (rev 6475)
@@ -1216,8 +1216,8 @@
private:
inline unsigned vertex(unsigned idx, double* x, double* y) {
- size_t m = m_m + ((idx & 0x2) >> 1);
- size_t n = m_n + ((idx+1 & 0x2) >> 1);
+ size_t m = m_m + ((idx & 0x2) >> 1);
+ size_t n = m_n + (((idx+1) & 0x2) >> 1);
double* pair = (double*)PyArray_GETPTR2(m_coordinates, n, m);
*x = *pair++;
*y = *pair;
@@ -1336,11 +1336,15 @@
throw Py::RuntimeError(e);
}
} catch (...) {
- if (free_edgecolors) Py_XDECREF(edgecolors_obj.ptr());
+ if (free_edgecolors) {
+ Py_XDECREF(edgecolors_obj.ptr());
+ }
throw;
}
- if (free_edgecolors) Py_XDECREF(edgecolors_obj.ptr());
+ if (free_edgecolors) {
+ Py_XDECREF(edgecolors_obj.ptr());
+ }
return Py::Object();
}
Modified: trunk/matplotlib/src/_image.cpp
===================================================================
--- trunk/matplotlib/src/_image.cpp 2008-12-02 17:55:15 UTC (rev 6474)
+++ trunk/matplotlib/src/_image.cpp 2008-12-02 19:51:10 UTC (rev 6475)
@@ -1327,20 +1327,27 @@
void _pcolor_cleanup(PyArrayObject* x, PyArrayObject* y, PyArrayObject *d,
unsigned int * rowstarts ,unsigned int*colstarts ,
float *acols , float *arows) {
- if (x)
+ if (x) {
Py_XDECREF(x);
- if (y)
+ }
+ if (y) {
Py_XDECREF(y);
- if(d)
+ }
+ if(d) {
Py_XDECREF(d);
- if(rowstarts)
+ }
+ if(rowstarts) {
PyMem_Free(rowstarts);
- if(colstarts)
+ }
+ if(colstarts) {
PyMem_Free(colstarts);
- if(acols)
+ }
+ if(acols) {
PyMem_Free(acols);
- if(arows)
+ }
+ if(arows) {
PyMem_Free(arows);
+ }
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2008-12-02 17:55:17
|
Revision: 6474
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6474&view=rev
Author: ryanmay
Date: 2008-12-02 17:55:15 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
Begin and end docstrings on newlines.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/quiver.py
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2008-12-02 17:54:44 UTC (rev 6473)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2008-12-02 17:55:15 UTC (rev 6474)
@@ -745,7 +745,8 @@
%s""" % _barbs_doc
def _find_tails(self, mag, rounding=True, half=5, full=10, flag=50):
- '''Find how many of each of the tail pieces is necessary. Flag
+ '''
+ Find how many of each of the tail pieces is necessary. Flag
specifies the increment for a flag, barb for a full barb, and half for
half a barb. Mag should be the magnitude of a vector (ie. >= 0).
@@ -777,7 +778,8 @@
def _make_barbs(self, u, v, nflags, nbarbs, half_barb, empty_flag, length,
pivot, sizes, fill_empty, flip):
- '''This function actually creates the wind barbs. *u* and *v*
+ '''
+ This function actually creates the wind barbs. *u* and *v*
are components of the vector in the *x* and *y* directions,
respectively.
@@ -817,7 +819,8 @@
This function returns list of arrays of vertices, defining a polygon for
each of the wind barbs. These polygons have been rotated to properly
- align with the vector direction.'''
+ align with the vector direction.
+ '''
#These control the spacing and size of barb elements relative to the
#length of the shaft
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-02 17:54:50
|
Revision: 6473
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6473&view=rev
Author: mdboom
Date: 2008-12-02 17:54:44 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
Fix axhline etc. with non-linear scales.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/transforms.py
Modified: trunk/matplotlib/lib/matplotlib/transforms.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/transforms.py 2008-12-02 17:53:45 UTC (rev 6472)
+++ trunk/matplotlib/lib/matplotlib/transforms.py 2008-12-02 17:54:44 UTC (rev 6473)
@@ -1237,6 +1237,7 @@
of the same dimensions.
"""
pass_through = True
+ is_affine = False
def __init__(self, child):
"""
@@ -1288,10 +1289,6 @@
self.invalidate()
self._invalid = 0
- def _get_is_affine(self):
- return self._child.is_affine
- is_affine = property(_get_is_affine)
-
def _get_is_separable(self):
return self._child.is_separable
is_separable = property(_get_is_separable)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2008-12-02 17:53:48
|
Revision: 6472
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6472&view=rev
Author: ryanmay
Date: 2008-12-02 17:53:45 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
Add information to docstring for pyplot.subplot()
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/pyplot.py
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py 2008-12-02 17:11:07 UTC (rev 6471)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py 2008-12-02 17:53:45 UTC (rev 6472)
@@ -588,11 +588,6 @@
``subplot(111)`` is the default axis.
- The background color of the subplot can be specified via keyword
- argument *axisbg*, which takes a color string as value, as in::
-
- subplot(211, axisbg='y')
-
New subplots that overlap old will delete the old axes. If you do
not want this behavior, use
:meth:`matplotlib.figure.Figure.add_subplot` or the
@@ -602,11 +597,35 @@
plot([1,2,3]) # implicitly creates subplot(111)
subplot(211) # overlaps, subplot(111) is killed
plot(rand(12), rand(12))
+ subplot(212, axisbg='y') # creates 2nd subplot with yellow background
+ Keyword arguments:
+
+ *axisbg*:
+ The background color of the subplot, which can be any valid
+ color specifier. See :module:`matplotlib.colors` for more
+ information.
+
+ *polar*:
+ A boolean flag indicating whether the subplot plot should be
+ a polar projection. Defaults to False.
+
+ *projection*:
+ A string giving the name of a custom projection to be used
+ for the subplot. This projection must have been previously
+ registered. See :func:`matplotlib.projections.register_projection`
+
.. seealso::
:func:`~matplotlib.pyplot.axes`:
For additional information on :func:`axes` and
:func:`subplot` keyword arguments.
+
+ :file:`examples/pylab_examples/polar_scatter.py`
+
+ **Example:**
+
+ .. plot:: mpl_examples/pylab_examples/subplot_demo.py
+
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-12-02 17:12:17
|
Revision: 6471
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6471&view=rev
Author: dsdale
Date: 2008-12-02 17:11:07 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
improved checks for external dependencies
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/__init__.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2008-12-02 17:07:57 UTC (rev 6470)
+++ trunk/matplotlib/CHANGELOG 2008-12-02 17:11:07 UTC (rev 6471)
@@ -1,3 +1,7 @@
+2008-12-02 Improve checks for external dependencies, using subprocess
+ (instead of deprecated popen*) and distutils (for version
+ checking) - DSD
+
2008-11-30 Reimplementaion of the legend which supports baseline alignement,
multi-column, and expand mode. - JJL
Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py 2008-12-02 17:07:57 UTC (rev 6470)
+++ trunk/matplotlib/lib/matplotlib/__init__.py 2008-12-02 17:11:07 UTC (rev 6471)
@@ -93,8 +93,9 @@
__revision__ = '$Revision$'
__date__ = '$Date$'
-import os, re, shutil, sys, warnings
+import os, re, shutil, subprocess, sys, warnings
import distutils.sysconfig
+import distutils.version
NEWCONFIG = False
@@ -256,10 +257,10 @@
def checkdep_dvipng():
try:
- stdin, stdout = os.popen4('dvipng -version')
- line = stdout.readlines()[1]
+ s = subprocess.Popen(['dvipng','-version'], stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ line = s.stdout.readlines()[1]
v = line.split()[-1]
- float(v)
return v
except (IndexError, ValueError):
return None
@@ -267,47 +268,45 @@
def checkdep_ghostscript():
try:
if sys.platform == 'win32':
- command = 'gswin32c --version'
+ command_args = ['gswin32c', '--version']
else:
- command = 'gs --version'
- stdin, stdout = os.popen4(command)
- v = stdout.read()[:-1]
- vtest = '.'.join(v.split('.')[:2]) # deal with version numbers like '7.07.1'
- float(vtest)
- return vtest
+ command_args = ['gs', '--version']
+ s = subprocess.Popen(command_args, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ v = s.stdout.read()[:-1]
+ return v
except (IndexError, ValueError):
return None
def checkdep_tex():
try:
- stdin, stdout = os.popen4('tex -version')
- line = stdout.readlines()[0]
+ s = subprocess.Popen(['tex','-version'], stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ line = s.stdout.readlines()[0]
pattern = '3\.1\d+'
match = re.search(pattern, line)
v = match.group(0)
- float(v)
return v
except (IndexError, ValueError, AttributeError):
return None
def checkdep_pdftops():
try:
- stdin, stdout = os.popen4('pdftops -v')
- for line in stdout.readlines():
+ s = subprocess.Popen(['pdftops','-v'], stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ for line in s.stderr:
if 'version' in line:
v = line.split()[-1]
- float(v)
return v
except (IndexError, ValueError, UnboundLocalError):
return None
def compare_versions(a, b):
- "return True if a is greater than b"
+ "return True if a is greater than or equal to b"
if a:
- a = [int(i) for i in a.split('.')]
- b = [int(i) for i in b.split('.')]
- if a[0]>b[0]: return True
- elif (a[0]==b[0]) and (a[1]>=b[1]): return True
+ a = distutils.version.LooseVersion(a)
+ b = distutils.version.LooseVersion(b)
+ if a>=b: return True
else: return False
else: return False
@@ -330,8 +329,13 @@
if s == 'xpdf':
pdftops_req = '3.0'
+ pdftops_req_alt = '0.9' # poppler version numbers, ugh
pdftops_v = checkdep_pdftops()
- if compare_versions(pdftops_v, pdftops_req): pass
+ if compare_versions(pdftops_v, pdftops_req):
+ pass
+ elif compare_versions(pdftops_v, pdftops_req_alt) and not \
+ compare_versions(pdftops_v, '1.0'):
+ pass
else:
flag = False
warnings.warn(('matplotlibrc ps.usedistiller can not be set to '
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ds...@us...> - 2008-12-02 17:09:35
|
Revision: 6470
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6470&view=rev
Author: dsdale
Date: 2008-12-02 17:07:57 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
Pass qt* enter and leave events to FigureCanvasBase
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt.py 2008-12-02 15:52:39 UTC (rev 6469)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt.py 2008-12-02 17:07:57 UTC (rev 6470)
@@ -102,6 +102,12 @@
w,h = self.get_width_height()
self.resize( w, h )
+ def enterEvent(self, event):
+ FigureCanvasBase.enter_notify_event(self, event)
+
+ def leaveEvent(self, event):
+ FigureCanvasBase.leave_notify_event(self, event)
+
def mousePressEvent( self, event ):
x = event.pos().x()
# flipy so y=0 is bottom of canvas
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2008-12-02 15:52:39 UTC (rev 6469)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2008-12-02 17:07:57 UTC (rev 6470)
@@ -105,8 +105,12 @@
def __timerEvent(self, event):
# hide until we can test and fix
self.mpl_idle_event(event)
-
+
+ def enterEvent(self, event):
+ FigureCanvasBase.enter_notify_event(self, event)
+
def leaveEvent(self, event):
+ print event
FigureCanvasBase.leave_notify_event(self, event)
def mousePressEvent( self, event ):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-02 15:52:42
|
Revision: 6469
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6469&view=rev
Author: mdboom
Date: 2008-12-02 15:52:39 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
Minor formatting changes.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/transforms.py
Modified: trunk/matplotlib/lib/matplotlib/transforms.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/transforms.py 2008-12-02 15:40:44 UTC (rev 6468)
+++ trunk/matplotlib/lib/matplotlib/transforms.py 2008-12-02 15:52:39 UTC (rev 6469)
@@ -313,7 +313,8 @@
return [min(self.get_points()[:, 0]),
min(self.get_points()[:, 1])]
min = property(_get_min, None, None, """
- (property) :attr:`min` is the bottom-left corner of the bounding box.""")
+ (property) :attr:`min` is the bottom-left corner of the bounding
+ box.""")
def _get_max(self):
return [max(self.get_points()[:, 0]),
@@ -324,41 +325,44 @@
def _get_intervalx(self):
return self.get_points()[:, 0]
intervalx = property(_get_intervalx, None, None, """
- (property) :attr:`intervalx` is the pair of *x* coordinates that define the
- bounding box. It is not guaranteed to be sorted from left to right.""")
+ (property) :attr:`intervalx` is the pair of *x* coordinates that define
+ the bounding box. It is not guaranteed to be sorted from left to
+ right.""")
def _get_intervaly(self):
return self.get_points()[:, 1]
intervaly = property(_get_intervaly, None, None, """
- (property) :attr:`intervaly` is the pair of *y* coordinates that define the
- bounding box. It is not guaranteed to be sorted from bottom to top.""")
+ (property) :attr:`intervaly` is the pair of *y* coordinates that define
+ the bounding box. It is not guaranteed to be sorted from bottom to
+ top.""")
def _get_width(self):
points = self.get_points()
return points[1, 0] - points[0, 0]
width = property(_get_width, None, None, """
- (property) The width of the bounding box. It may be negative if :attr:`x1` <
- :attr:`x0`.""")
+ (property) The width of the bounding box. It may be negative if
+ :attr:`x1` < :attr:`x0`.""")
def _get_height(self):
points = self.get_points()
return points[1, 1] - points[0, 1]
height = property(_get_height, None, None, """
- (property) The height of the bounding box. It may be negative if :attr:`y1` <
- :attr:`y0`.""")
+ (property) The height of the bounding box. It may be negative if
+ :attr:`y1` < :attr:`y0`.""")
def _get_size(self):
points = self.get_points()
return points[1] - points[0]
size = property(_get_size, None, None, """
- (property) The width and height of the bounding box. May be negative, in the same
- way as :attr:`width` and :attr:`height`.""")
+ (property) The width and height of the bounding box. May be negative,
+ in the same way as :attr:`width` and :attr:`height`.""")
def _get_bounds(self):
x0, y0, x1, y1 = self.get_points().flatten()
return (x0, y0, x1 - x0, y1 - y0)
bounds = property(_get_bounds, None, None, """
- (property) Returns (:attr:`x0`, :attr:`y0`, :attr:`width`, :attr:`height`).""")
+ (property) Returns (:attr:`x0`, :attr:`y0`, :attr:`width`,
+ :attr:`height`).""")
def _get_extents(self):
return self.get_points().flatten().copy()
@@ -788,7 +792,8 @@
- when False, include the existing bounds of the :class:`Bbox`.
- when None, use the last value passed to :meth:`ignore`.
"""
- warnings.warn("update_from_data requires a memory copy -- please replace with update_from_data_xy")
+ warnings.warn(
+ "update_from_data requires a memory copy -- please replace with update_from_data_xy")
xy = np.hstack((x.reshape((len(x), 1)), y.reshape((len(y), 1))))
return self.update_from_data_xy(xy, ignore)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2008-12-02 15:40:49
|
Revision: 6468
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6468&view=rev
Author: jdh2358
Date: 2008-12-02 15:40:44 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
added gregor's wx enter/leave patch - fixed figure_enter problem
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backend_bases.py
trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-12-02 15:32:07 UTC (rev 6467)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008-12-02 15:40:44 UTC (rev 6468)
@@ -791,9 +791,6 @@
'process the figure/axes enter leave events'
if LocationEvent.lastevent is not None:
last = LocationEvent.lastevent
- if last.canvas!=self.canvas:
- # process figure enter/leave event
- self.canvas.callbacks.process('figure_enter_event', self)
if last.inaxes!=self.inaxes:
# process axes enter/leave events
if last.inaxes is not None:
@@ -803,8 +800,6 @@
else:
# process a figure enter event
- self.canvas.callbacks.process('figure_enter_event', self)
- # process an axes enter event if we are over an axes
if self.inaxes is not None:
self.canvas.callbacks.process('axes_enter_event', self)
@@ -952,8 +947,6 @@
'pick_event',
'idle_event',
'figure_enter_event',
- # todo: we only process this when a mouse enters a different
- # figure -- we need to connect to the GUI leavel event
'figure_leave_event',
'axes_enter_event',
'axes_leave_event'
@@ -1216,7 +1209,18 @@
self.callbacks.process('figure_leave_event', LocationEvent.lastevent)
LocationEvent.lastevent = None
+ def enter_notify_event(self, guiEvent=None):
+ """
+ Backend derived classes should call this function when entering
+ canvas
+ *guiEvent*
+ the native UI event that generated the mpl event
+
+ """
+ event = Event('figure_enter_event', self, guiEvent)
+ self.callbacks.process('figure_enter_event', event)
+
def idle_event(self, guiEvent=None):
'call when GUI is idle'
s = 'idle_event'
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-12-02 15:32:07 UTC (rev 6467)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2008-12-02 15:40:44 UTC (rev 6468)
@@ -147,6 +147,7 @@
gdk.EXPOSURE_MASK |
gdk.KEY_PRESS_MASK |
gdk.KEY_RELEASE_MASK |
+ gdk.ENTER_NOTIFY_MASK |
gdk.LEAVE_NOTIFY_MASK |
gdk.POINTER_MOTION_MASK |
gdk.POINTER_MOTION_HINT_MASK)
@@ -171,6 +172,7 @@
self.connect('key_release_event', self.key_release_event)
self.connect('motion_notify_event', self.motion_notify_event)
self.connect('leave_notify_event', self.leave_notify_event)
+ self.connect('enter_notify_event', self.enter_notify_event)
self.set_events(self.__class__.event_mask)
@@ -243,6 +245,9 @@
def leave_notify_event(self, widget, event):
FigureCanvasBase.leave_notify_event(self, event)
+ def enter_notify_event(self, widget, event):
+ FigureCanvasBase.enter_notify_event(self, event)
+
def _get_key(self, event):
if event.keyval in self.keyvald:
key = self.keyvald[event.keyval]
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-12-02 15:32:07 UTC (rev 6467)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2008-12-02 15:40:44 UTC (rev 6468)
@@ -1263,10 +1263,10 @@
FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=evt)
def _onLeave(self, evt):
- """Mouse has left the window; fake a motion event."""
+ """Mouse has left the window."""
evt.Skip()
- FigureCanvasBase.motion_notify_event(self, -1, -1, guiEvent=evt)
+ FigureCanvasBase.leave_notify_event(self, guiEvent = evt)
########################################################################
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-02 15:32:12
|
Revision: 6467
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6467&view=rev
Author: mdboom
Date: 2008-12-02 15:32:07 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
Be more conservative about chunking large paths -- filled paths shouldn't be chunked -- or at least would require a more complex algorithm.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-12-02 15:27:23 UTC (rev 6466)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008-12-02 15:32:07 UTC (rev 6467)
@@ -79,7 +79,7 @@
def draw_path(self, gc, path, transform, rgbFace=None):
nmax = rcParams['agg.path.chunksize'] # here at least for testing
npts = path.vertices.shape[0]
- if nmax > 100 and npts > nmax and path.should_simplify:
+ if nmax > 100 and npts > nmax and path.should_simplify and rgbFace is None:
nch = npy.ceil(npts/float(nmax))
chsize = int(npy.ceil(npts/nch))
i0 = npy.arange(0, npts, chsize)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-02 15:27:28
|
Revision: 6466
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6466&view=rev
Author: mdboom
Date: 2008-12-02 15:27:23 +0000 (Tue, 02 Dec 2008)
Log Message:
-----------
Remove one-pixel offset in clipbox code.
Modified Paths:
--------------
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2008-12-01 19:35:39 UTC (rev 6465)
+++ trunk/matplotlib/src/_backend_agg.cpp 2008-12-02 15:27:23 UTC (rev 6466)
@@ -312,8 +312,8 @@
double l, b, r, t;
if (py_convert_bbox(cliprect.ptr(), l, b, r, t)) {
- rasterizer.clip_box(int(mpl_round(l)) + 1, height - int(mpl_round(b)),
- int(mpl_round(r)), height - int(mpl_round(t)));
+ rasterizer.clip_box(int(mpl_round(l)), height - int(mpl_round(b)),
+ int(mpl_round(r)), height - int(mpl_round(t)));
}
_VERBOSE("RendererAgg::set_clipbox done");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-01 19:35:43
|
Revision: 6465
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6465&view=rev
Author: mdboom
Date: 2008-12-01 19:35:39 +0000 (Mon, 01 Dec 2008)
Log Message:
-----------
Non-affine transformation invalidation wasn't propagating correctly.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/transforms.py
Modified: trunk/matplotlib/lib/matplotlib/transforms.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/transforms.py 2008-12-01 19:07:08 UTC (rev 6464)
+++ trunk/matplotlib/lib/matplotlib/transforms.py 2008-12-01 19:35:39 UTC (rev 6465)
@@ -115,12 +115,12 @@
return
# Invalidate all ancestors of self using pseudo-recursion.
- parent = None
stack = [self]
while len(stack):
root = stack.pop()
# Stop at subtrees that have already been invalidated
if root._invalid != value or root.pass_through:
+ value |= root._invalid
root._invalid = value
stack.extend(root._parents.keys())
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2008-12-01 19:07:12
|
Revision: 6464
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6464&view=rev
Author: ryanmay
Date: 2008-12-01 19:07:08 +0000 (Mon, 01 Dec 2008)
Log Message:
-----------
Typo in docstring.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mlab.py
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2008-12-01 16:27:15 UTC (rev 6463)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-12-01 19:07:08 UTC (rev 6464)
@@ -351,7 +351,7 @@
is 0 (no overlap).
*pad_to*: integer
- The number of points to which the data segment is padd when
+ The number of points to which the data segment is padded when
performing the FFT. This can be different from *NFFT*, which
specifies the number of data points used. While not increasing
the actual resolution of the psd (the minimum distance between
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2008-12-01 16:27:20
|
Revision: 6463
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6463&view=rev
Author: mdboom
Date: 2008-12-01 16:27:15 +0000 (Mon, 01 Dec 2008)
Log Message:
-----------
[ 2316591 ] assertion is always true
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/config/verbose.py
Modified: trunk/matplotlib/lib/matplotlib/config/verbose.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/verbose.py 2008-12-01 15:23:49 UTC (rev 6462)
+++ trunk/matplotlib/lib/matplotlib/config/verbose.py 2008-12-01 16:27:15 UTC (rev 6463)
@@ -69,7 +69,7 @@
if always is True, the report will occur on every function
call; otherwise only on the first time the function is called
"""
- assert(callable, func)
+ assert callable(func)
def wrapper(*args, **kwargs):
ret = func(*args, **kwargs)
@@ -86,4 +86,4 @@
return self.vald[self.level]>=self.vald[level]
-verbose=Verbose()
\ No newline at end of file
+verbose=Verbose()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|