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: <ry...@us...> - 2009-02-06 02:51:28
|
Revision: 6887
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6887&view=rev
Author: ryanmay
Date: 2009-02-06 02:51:24 +0000 (Fri, 06 Feb 2009)
Log Message:
-----------
Merged revisions 6886 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint
........
r6886 | ryanmay | 2009-02-05 20:48:19 -0600 (Thu, 05 Feb 2009) | 1 line
Fix missing colon in reference to patches. Thanks to Sandro Tosi.
........
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/__init__.py
Property Changed:
----------------
trunk/matplotlib/
trunk/matplotlib/doc/pyplots/README
trunk/matplotlib/doc/sphinxext/gen_gallery.py
trunk/matplotlib/doc/sphinxext/gen_rst.py
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6884
+ /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6886
Modified: svn:mergeinfo
- /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884
+ /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886
Property changes on: trunk/matplotlib/doc/pyplots/README
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884
+ /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886
Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884
+ /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886
Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884
+ /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886
Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py 2009-02-06 02:48:19 UTC (rev 6886)
+++ trunk/matplotlib/lib/matplotlib/__init__.py 2009-02-06 02:51:24 UTC (rev 6887)
@@ -36,7 +36,7 @@
defines the :class:`~matplotlib.lines.Line2D` class for
drawing lines and markers
- :mod`matplotlib.patches`
+ :mod:`matplotlib.patches`
defines classes for drawing polygons
:mod:`matplotlib.text`
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2009-02-06 02:48:29
|
Revision: 6886
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6886&view=rev
Author: ryanmay
Date: 2009-02-06 02:48:19 +0000 (Fri, 06 Feb 2009)
Log Message:
-----------
Fix missing colon in reference to patches. Thanks to Sandro Tosi.
Modified Paths:
--------------
branches/v0_98_5_maint/lib/matplotlib/__init__.py
Modified: branches/v0_98_5_maint/lib/matplotlib/__init__.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/__init__.py 2009-02-05 18:00:52 UTC (rev 6885)
+++ branches/v0_98_5_maint/lib/matplotlib/__init__.py 2009-02-06 02:48:19 UTC (rev 6886)
@@ -36,7 +36,7 @@
defines the :class:`~matplotlib.lines.Line2D` class for
drawing lines and markers
- :mod`matplotlib.patches`
+ :mod:`matplotlib.patches`
defines classes for drawing polygons
:mod:`matplotlib.text`
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2009-02-05 18:00:56
|
Revision: 6885
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6885&view=rev
Author: ryanmay
Date: 2009-02-05 18:00:52 +0000 (Thu, 05 Feb 2009)
Log Message:
-----------
Merged revisions 6883-6884 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint
........
r6883 | ryanmay | 2009-02-05 11:48:37 -0600 (Thu, 05 Feb 2009) | 1 line
Backport doc typo fixes from trunk.
........
r6884 | ryanmay | 2009-02-05 11:55:51 -0600 (Thu, 05 Feb 2009) | 1 line
Add an example that displays all of the colormaps available. This is based on code in the scipy.org cookbook. This should make a nice addition to the gallery.
........
Added Paths:
-----------
trunk/matplotlib/examples/pylab_examples/show_colormaps.py
Property Changed:
----------------
trunk/matplotlib/
trunk/matplotlib/doc/pyplots/README
trunk/matplotlib/doc/sphinxext/gen_gallery.py
trunk/matplotlib/doc/sphinxext/gen_rst.py
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6873
+ /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6884
Modified: svn:mergeinfo
- /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873
+ /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884
Property changes on: trunk/matplotlib/doc/pyplots/README
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873
+ /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884
Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873
+ /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884
Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873
+ /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884
Copied: trunk/matplotlib/examples/pylab_examples/show_colormaps.py (from rev 6884, branches/v0_98_5_maint/examples/pylab_examples/show_colormaps.py)
===================================================================
--- trunk/matplotlib/examples/pylab_examples/show_colormaps.py (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/show_colormaps.py 2009-02-05 18:00:52 UTC (rev 6885)
@@ -0,0 +1,25 @@
+# This example comes from the Cookbook on www.scipy.org. According to the
+# history, Andrew Straw did the conversion from an old page, but it is
+# unclear who the original author is.
+import numpy as np
+import matplotlib.pyplot as plt
+
+a = np.linspace(0, 1, 256).reshape(1,-1)
+a = np.vstack((a,a))
+
+# Get a list of the colormaps in matplotlib. Ignore the ones that end with
+# '_r' because these are simply reversed versions of ones that don't end
+# with '_r'
+maps = sorted(m for m in plt.cm.datad if not m.endswith("_r"))
+nmaps = len(maps) + 1
+
+fig = plt.figure(figsize=(5,10))
+fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99)
+for i,m in enumerate(maps):
+ ax = plt.subplot(nmaps, 1, i+1)
+ plt.axis("off")
+ plt.imshow(a, aspect='auto', cmap=plt.get_cmap(m), origin='lower')
+ pos = list(ax.get_position().bounds)
+ fig.text(pos[0] - 0.01, pos[1], m, fontsize=10, horizontalalignment='right')
+
+plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2009-02-05 17:55:54
|
Revision: 6884
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6884&view=rev
Author: ryanmay
Date: 2009-02-05 17:55:51 +0000 (Thu, 05 Feb 2009)
Log Message:
-----------
Add an example that displays all of the colormaps available. This is based on code in the scipy.org cookbook. This should make a nice addition to the gallery.
Added Paths:
-----------
branches/v0_98_5_maint/examples/pylab_examples/show_colormaps.py
Added: branches/v0_98_5_maint/examples/pylab_examples/show_colormaps.py
===================================================================
--- branches/v0_98_5_maint/examples/pylab_examples/show_colormaps.py (rev 0)
+++ branches/v0_98_5_maint/examples/pylab_examples/show_colormaps.py 2009-02-05 17:55:51 UTC (rev 6884)
@@ -0,0 +1,25 @@
+# This example comes from the Cookbook on www.scipy.org. According to the
+# history, Andrew Straw did the conversion from an old page, but it is
+# unclear who the original author is.
+import numpy as np
+import matplotlib.pyplot as plt
+
+a = np.linspace(0, 1, 256).reshape(1,-1)
+a = np.vstack((a,a))
+
+# Get a list of the colormaps in matplotlib. Ignore the ones that end with
+# '_r' because these are simply reversed versions of ones that don't end
+# with '_r'
+maps = sorted(m for m in plt.cm.datad if not m.endswith("_r"))
+nmaps = len(maps) + 1
+
+fig = plt.figure(figsize=(5,10))
+fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99)
+for i,m in enumerate(maps):
+ ax = plt.subplot(nmaps, 1, i+1)
+ plt.axis("off")
+ plt.imshow(a, aspect='auto', cmap=plt.get_cmap(m), origin='lower')
+ pos = list(ax.get_position().bounds)
+ fig.text(pos[0] - 0.01, pos[1], m, fontsize=10, horizontalalignment='right')
+
+plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2009-02-05 17:48:40
|
Revision: 6883
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6883&view=rev
Author: ryanmay
Date: 2009-02-05 17:48:37 +0000 (Thu, 05 Feb 2009)
Log Message:
-----------
Backport doc typo fixes from trunk.
Modified Paths:
--------------
branches/v0_98_5_maint/doc/users/shell.rst
Modified: branches/v0_98_5_maint/doc/users/shell.rst
===================================================================
--- branches/v0_98_5_maint/doc/users/shell.rst 2009-02-05 16:00:51 UTC (rev 6882)
+++ branches/v0_98_5_maint/doc/users/shell.rst 2009-02-05 17:48:37 UTC (rev 6883)
@@ -5,7 +5,7 @@
**********************************
By default, matplotlib defers drawing until the end of the script
-because drawing can be an expensive opertation, and you may not want
+because drawing can be an expensive operation, and you may not want
to update the plot every time a single property is changed, only once
after all the properties have changed.
@@ -76,7 +76,7 @@
With the TkAgg backend, that uses the Tkinter user interface toolkit,
you can use matplotlib from an arbitrary python shell. Just set your
``backend : TkAgg`` and ``interactive : True`` in your
-:file:matplotlibrc file (see :ref:`customizing-matplotlib`) and fire
+:file:`matplotlibrc` file (see :ref:`customizing-matplotlib`) and fire
up python. Then::
>>> from pylab import *
@@ -103,7 +103,7 @@
The *interactive* property of the pyplot interface controls whether a
figure canvas is drawn on every pyplot command. If *interactive* is
-*False*, then the figure state is updated on every plot commands, but
+*False*, then the figure state is updated on every plot command, but
will only be drawn on explicit calls to
:func:`~matplotlib.pyplot.draw`. When *interactive* is
*True*, then every pyplot command triggers a draw.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-02-05 16:01:02
|
Revision: 6882
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6882&view=rev
Author: mdboom
Date: 2009-02-05 16:00:51 +0000 (Thu, 05 Feb 2009)
Log Message:
-----------
Speed up nan-handling on curves. Add test case for this.
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/simplification_clipping_test.py
trunk/matplotlib/src/path_converters.h
Modified: trunk/matplotlib/examples/pylab_examples/simplification_clipping_test.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/simplification_clipping_test.py 2009-02-05 15:35:24 UTC (rev 6881)
+++ trunk/matplotlib/examples/pylab_examples/simplification_clipping_test.py 2009-02-05 16:00:51 UTC (rev 6882)
@@ -1,5 +1,8 @@
from pylab import *
import numpy as np
+from matplotlib import patches, path
+nan = np.nan
+Path = path.Path
t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
@@ -55,4 +58,15 @@
title("Original length: %d, simplified length: %d" % (len(path.vertices), len(simplified)))
+figure()
+pp1 = patches.PathPatch(
+ Path([(0, 0), (1, 0), (1, 1), (nan, 1), (0, 0), (2, 0), (2, 2), (0, 0)],
+ [Path.MOVETO, Path.CURVE3, Path.CURVE3, Path.CURVE3, Path.CURVE3, Path.CURVE3, Path.CURVE3, Path.CLOSEPOLY]),
+ fc="none")
+
+gca().add_patch(pp1)
+gca().set_xlim((0, 2))
+gca().set_ylim((0, 2))
+title("Should be one line with two curves below it")
+
show()
Modified: trunk/matplotlib/src/path_converters.h
===================================================================
--- trunk/matplotlib/src/path_converters.h 2009-02-05 15:35:24 UTC (rev 6881)
+++ trunk/matplotlib/src/path_converters.h 2009-02-05 16:00:51 UTC (rev 6882)
@@ -149,7 +149,7 @@
return code;
}
- bool skipped = false;
+ bool needs_move_to = false;
while (true) {
code = m_source->vertex(x, y);
if (code == agg::path_cmd_stop ||
@@ -158,38 +158,38 @@
return code;
}
+ if (needs_move_to) {
+ queue_push(agg::path_cmd_move_to, *x, *y);
+ }
+
size_t num_extra_points = num_extra_points_map[code & 0xF];
bool has_nan = (MPL_notisfinite64(*x) || MPL_notisfinite64(*y));
- double xc[2], yc[2];
+ queue_push(code, *x, *y);
/* Note: this test can not be short-circuited, since we need to
advance through the entire curve no matter what */
for (size_t i = 0; i < num_extra_points; ++i)
{
- m_source->vertex(&xc[i], &yc[i]);
- has_nan |= (MPL_notisfinite64(xc[i]) || MPL_notisfinite64(yc[i]));
+ m_source->vertex(x, y);
+ has_nan |= (MPL_notisfinite64(*x) || MPL_notisfinite64(*y));
+ queue_push(code, *x, *y);
}
- if (has_nan)
+ if (!has_nan)
{
- skipped = true;
+ break;
}
- else
- {
- if (skipped)
- {
- queue_push(agg::path_cmd_move_to, *x, *y);
- }
- if (!skipped || code != agg::path_cmd_line_to) {
- queue_push(code, *x, *y);
- for (size_t i = 0; i < num_extra_points; ++i)
- {
- queue_push(code, xc[i], yc[i]);
- }
- }
+ queue_clear();
- break;
+ if (!(MPL_notisfinite64(*x) || MPL_notisfinite64(*y)))
+ {
+ queue_push(agg::path_cmd_move_to, *x, *y);
+ needs_move_to = false;
}
+ else
+ {
+ needs_move_to = true;
+ }
}
if (queue_flush(&code, x, y))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-02-05 15:35:31
|
Revision: 6881
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6881&view=rev
Author: mdboom
Date: 2009-02-05 15:35:24 +0000 (Thu, 05 Feb 2009)
Log Message:
-----------
Fix shortening end of path bug in simplifier. Speed up clipper by not using a queue.
Modified Paths:
--------------
trunk/matplotlib/src/path_converters.h
Modified: trunk/matplotlib/src/path_converters.h
===================================================================
--- trunk/matplotlib/src/path_converters.h 2009-02-05 15:30:42 UTC (rev 6880)
+++ trunk/matplotlib/src/path_converters.h 2009-02-05 15:35:24 UTC (rev 6881)
@@ -246,7 +246,7 @@
clipped, but are always included in their entirety.
*/
template<class VertexSource>
-class PathClipper : protected EmbeddedQueue<2>
+class PathClipper
{
VertexSource* m_source;
bool m_do_clipping;
@@ -254,6 +254,9 @@
double m_lastX;
double m_lastY;
bool m_moveto;
+ double m_nextX;
+ double m_nextY;
+ bool m_has_next;
public:
PathClipper(VertexSource& source, bool do_clipping,
@@ -274,7 +277,8 @@
inline void rewind(unsigned path_id)
{
- queue_clear();
+ m_has_next = false;
+ m_moveto = true;
m_source->rewind(path_id);
}
@@ -283,18 +287,21 @@
unsigned code;
if (m_do_clipping) {
- // This is the slow path where we want to do clipping
- if (queue_flush(&code, x, y))
- {
- return code;
+ /* This is the slow path where we actually do clipping */
+
+ if (m_has_next) {
+ m_has_next = false;
+ *x = m_nextX;
+ *y = m_nextY;
+ return agg::path_cmd_line_to;
}
- while ((code = m_source->vertex(x, y)) != agg::path_cmd_stop)
- {
- if (code == agg::path_cmd_move_to || m_moveto)
+ while ((code = m_source->vertex(x, y)) != agg::path_cmd_stop) {
+ if (m_moveto)
{
m_moveto = false;
- queue_push(agg::path_cmd_move_to, *x, *y);
+ code = agg::path_cmd_move_to;
+ break;
}
else if (code == agg::path_cmd_line_to)
{
@@ -303,7 +310,8 @@
y0 = m_lastY;
x1 = *x;
y1 = *y;
-
+ m_lastX = *x;
+ m_lastY = *y;
unsigned moved = agg::clip_line_segment(&x0, &y0, &x1, &y1, m_cliprect);
// moved >= 4 - Fully clipped
// moved != 0 - First point has been moved
@@ -312,25 +320,26 @@
{
if (moved & 1)
{
- queue_push(agg::path_cmd_move_to, x0, y0);
+ *x = x0;
+ *y = y0;
+ m_nextX = x1;
+ m_nextY = y1;
+ m_has_next = true;
+ return agg::path_cmd_move_to;
}
- queue_push(agg::path_cmd_line_to, x1, y1);
+ *x = x1;
+ *y = y1;
+ return code;
}
}
else
{
- queue_push(code, *x, *y);
+ break;
}
-
- m_lastX = *x;
- m_lastY = *y;
-
- if (queue_flush(&code, x, y))
- {
- return code;
- }
}
+ m_lastX = *x;
+ m_lastY = *y;
return code;
}
else
@@ -474,6 +483,7 @@
inline void rewind(unsigned path_id)
{
queue_clear();
+ m_moveto = true;
m_source->rewind(path_id);
}
@@ -664,6 +674,7 @@
{
queue_push(agg::path_cmd_line_to, m_nextX, m_nextY);
}
+ queue_push(agg::path_cmd_line_to, m_lastx, m_lasty);
queue_push(agg::path_cmd_stop, 0.0, 0.0);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-02-05 15:30:47
|
Revision: 6880
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6880&view=rev
Author: mdboom
Date: 2009-02-05 15:30:42 +0000 (Thu, 05 Feb 2009)
Log Message:
-----------
Remove test code.
Modified Paths:
--------------
trunk/matplotlib/src/_path.cpp
Modified: trunk/matplotlib/src/_path.cpp
===================================================================
--- trunk/matplotlib/src/_path.cpp 2009-02-05 04:47:26 UTC (rev 6879)
+++ trunk/matplotlib/src/_path.cpp 2009-02-05 15:30:42 UTC (rev 6880)
@@ -56,10 +56,6 @@
"convert_path_to_polygons(path, trans, width, height)");
add_varargs_method("cleanup_path", &_path_module::cleanup_path,
"cleanup_path(path, trans, remove_nans, clip, quantize, simplify, curves)");
- /* TEST CODE -- REMOVE LATER */
- add_varargs_method("cleanup_path_test", &_path_module::cleanup_path_test,
- "TEST");
- /* **************************************** */
initialize("Helper functions for paths");
}
@@ -79,8 +75,6 @@
Py::Object path_intersects_path(const Py::Tuple& args);
Py::Object convert_path_to_polygons(const Py::Tuple& args);
Py::Object cleanup_path(const Py::Tuple& args);
- /* TEST CODE -- REMOVE LATER */
- Py::Object cleanup_path_test(const Py::Tuple& args);
};
//
@@ -1354,39 +1348,6 @@
return result;
}
-/************************************************************/
-/* TEST CODE */
-extern "C" {
- void* get_path_iterator(
- PyObject* path, PyObject* trans, int remove_nans, int do_clip,
- double rect[4], e_quantize_mode quantize_mode, int do_simplify);
-
- unsigned get_vertex(void* pipeline, double* x, double* y);
-
- void free_path_iterator(void* pipeline);
-}
-
-Py::Object _path_module::cleanup_path_test(const Py::Tuple& args)
-{
- args.verify_length(2);
-
- double rect[] = { 0.0, 0.0, 640.0, 480.0 };
-
- void* iterator = get_path_iterator(args[0].ptr(), args[1].ptr(), 1, 1, rect, QUANTIZE_AUTO, 1);
-
- unsigned cmd;
- double x, y;
- while ((cmd = get_vertex(iterator, &x, &y)) != 0 /* STOP */) {
- printf("%f %f %d\n", x, y, cmd);
- }
-
- free_path_iterator(iterator);
-
- return Py::None();
-}
-/* END OF TEST CODE */
-/************************************************************/
-
extern "C"
DL_EXPORT(void)
init_path(void)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-02-05 04:47:35
|
Revision: 6879
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6879&view=rev
Author: leejjoon
Date: 2009-02-05 04:47:26 +0000 (Thu, 05 Feb 2009)
Log Message:
-----------
some reorganization of the legend code.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/legend.py
trunk/matplotlib/lib/matplotlib/offsetbox.py
Added Paths:
-----------
trunk/matplotlib/examples/pylab_examples/anchored_text.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-02-04 21:48:49 UTC (rev 6878)
+++ trunk/matplotlib/CHANGELOG 2009-02-05 04:47:26 UTC (rev 6879)
@@ -1,3 +1,6 @@
+2009-02-04 Some reorgnization of the legend code. anchored_text.py
+ added as an example. - JJL
+
2009-02-04 Add extent keyword arg to hexbin - ADS
2009-02-04 Fix bug in mathtext related to \dots and \ldots - MGD
Added: trunk/matplotlib/examples/pylab_examples/anchored_text.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/anchored_text.py (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/anchored_text.py 2009-02-05 04:47:26 UTC (rev 6879)
@@ -0,0 +1,183 @@
+"""
+Place a text (or any offsetbox artist) at the corner of the axes, like a lenged.
+"""
+
+from matplotlib.offsetbox import TextArea, OffsetBox, DrawingArea
+from matplotlib.transforms import Bbox
+from matplotlib.font_manager import FontProperties
+from matplotlib import rcParams
+from matplotlib.patches import FancyBboxPatch
+from matplotlib.patches import Circle
+
+
+class AnchoredOffsetbox(OffsetBox):
+ def __init__(self, loc, pad=0.4, borderpad=0.5,
+ child=None, fontsize=None, frameon=True):
+
+ super(AnchoredOffsetbox, self).__init__()
+
+ self.set_child(child)
+
+ self.loc = loc
+ self.borderpad=borderpad
+ self.pad = pad
+
+ if fontsize is None:
+ prop=FontProperties(size=rcParams["legend.fontsize"])
+ self._fontsize = prop.get_size_in_points()
+ else:
+ self._fontsize = fontsize
+
+
+
+ self.patch = FancyBboxPatch(
+ xy=(0.0, 0.0), width=1., height=1.,
+ facecolor='w', edgecolor='k',
+ mutation_scale=self._fontsize,
+ snap=True
+ )
+ self.patch.set_boxstyle("square",pad=0)
+ self._drawFrame = frameon
+
+ def set_child(self, child):
+ self._child = child
+
+ def get_children(self):
+ return [self._child]
+
+ def get_child(self):
+ return self._child
+
+ def get_extent(self, renderer):
+ w, h, xd, yd = self.get_child().get_extent(renderer)
+ fontsize = renderer.points_to_pixels(self._fontsize)
+ pad = self.pad * fontsize
+
+ return w+2*pad, h+2*pad, xd+pad, yd+pad
+
+ def get_window_extent(self, renderer):
+ '''
+ get the bounding box in display space.
+ '''
+ w, h, xd, yd = self.get_extent(renderer)
+ ox, oy = self.get_offset(w, h, xd, yd)
+ return Bbox.from_bounds(ox-xd, oy-yd, w, h)
+
+ def draw(self, renderer):
+
+ if not self.get_visible(): return
+
+ fontsize = renderer.points_to_pixels(self._fontsize)
+
+ def _offset(w, h, xd, yd, fontsize=fontsize, self=self):
+ bbox = Bbox.from_bounds(0, 0, w, h)
+ borderpad = self.borderpad*fontsize
+ x0, y0 = self._get_anchored_bbox(self.loc,
+ bbox,
+ self.axes.bbox,
+ borderpad)
+ return x0+xd, y0+yd
+
+ self.set_offset(_offset)
+
+ if self._drawFrame:
+ # update the location and size of the legend
+ bbox = self.get_window_extent(renderer)
+ self.patch.set_bounds(bbox.x0, bbox.y0,
+ bbox.width, bbox.height)
+
+ self.patch.set_mutation_scale(fontsize)
+
+ self.patch.draw(renderer)
+
+
+ width, height, xdescent, ydescent = self.get_extent(renderer)
+
+ px, py = self.get_offset(width, height, xdescent, ydescent)
+
+ self.get_child().set_offset((px, py))
+ self.get_child().draw(renderer)
+
+
+
+ def _get_anchored_bbox(self, loc, bbox, parentbbox, borderpad):
+ assert loc in range(1,11) # called only internally
+
+ BEST, UR, UL, LL, LR, R, CL, CR, LC, UC, C = range(11)
+
+ anchor_coefs={UR:"NE",
+ UL:"NW",
+ LL:"SW",
+ LR:"SE",
+ R:"E",
+ CL:"W",
+ CR:"E",
+ LC:"S",
+ UC:"N",
+ C:"C"}
+
+ c = anchor_coefs[loc]
+
+ container = parentbbox.padded(-borderpad)
+ anchored_box = bbox.anchored(c, container=container)
+ return anchored_box.x0, anchored_box.y0
+
+
+class AnchoredText(AnchoredOffsetbox):
+ def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True):
+
+ self.txt = TextArea(s,
+ minimumdescent=False)
+
+
+ if prop is None:
+ self.prop=FontProperties(size=rcParams["legend.fontsize"])
+ else:
+ self.prop=prop
+
+
+ super(AnchoredText, self).__init__(loc, pad=pad, borderpad=borderpad,
+ child=self.txt,
+ fontsize=self.prop.get_size_in_points(),
+ frameon=frameon)
+
+
+class AnchoredDrawingArea(AnchoredOffsetbox):
+ def __init__(self, width, height, xdescent, ydescent,
+ loc, pad=0.4, borderpad=0.5, fontsize=None, frameon=True):
+
+ self.da = DrawingArea(width, height, xdescent, ydescent, clip=True)
+
+ super(AnchoredDrawingArea, self).__init__(loc, pad=pad, borderpad=borderpad,
+ child=self.da,
+ fontsize=fontsize,
+ frameon=frameon)
+
+
+
+if __name__ == "__main__":
+ import matplotlib.pyplot as plt
+
+ #ax = plt.subplot(1,1,1)
+ plt.clf()
+ plt.cla()
+ plt.draw()
+ ax = plt.gca()
+ #ax.set_aspect(1.)
+
+ at = AnchoredText("Figure 1(a)", loc=2, frameon=False)
+ ax.add_artist(at)
+
+ ada = AnchoredDrawingArea(20, 20, 0, 0, loc=3, pad=0., frameon=False)
+
+ p = Circle((10, 10), 10)
+ ada.da.add_artist(p)
+ ax.add_artist(ada)
+
+ ax.plot([0,1])
+ plt.draw()
+
+ plt.show()
+
+
+
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py 2009-02-04 21:48:49 UTC (rev 6878)
+++ trunk/matplotlib/lib/matplotlib/legend.py 2009-02-05 04:47:26 UTC (rev 6879)
@@ -34,7 +34,7 @@
from matplotlib.collections import LineCollection, RegularPolyCollection
from matplotlib.transforms import Bbox
-from matplotlib.offsetbox import HPacker, VPacker, PackerBase, TextArea, DrawingArea
+from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea
class Legend(Artist):
@@ -138,7 +138,7 @@
================ ==================================================================
The dimensions of pad and spacing are given as a fraction of the
-fontsize. Values from rcParams will be used if None.
+_fontsize. Values from rcParams will be used if None.
"""
from matplotlib.axes import Axes # local import only to avoid circularity
from matplotlib.figure import Figure # local import only to avoid circularity
@@ -149,7 +149,7 @@
self.prop=FontProperties(size=rcParams["legend.fontsize"])
else:
self.prop=prop
- self.fontsize = self.prop.get_size_in_points()
+ self._fontsize = self.prop.get_size_in_points()
propnames=['numpoints', 'markerscale', 'shadow', "columnspacing",
"scatterpoints"]
@@ -175,7 +175,7 @@
# conversion factor
bbox = parent.bbox
- axessize_fontsize = min(bbox.width, bbox.height)/self.fontsize
+ axessize_fontsize = min(bbox.width, bbox.height)/self._fontsize
for k, v in deprecated_kwds.items():
# use deprecated value if not None and if their newer
@@ -253,7 +253,7 @@
self.legendPatch = FancyBboxPatch(
xy=(0.0, 0.0), width=1., height=1.,
facecolor='w', edgecolor='k',
- mutation_scale=self.fontsize,
+ mutation_scale=self._fontsize,
snap=True
)
@@ -276,7 +276,7 @@
# init with null renderer
self._init_legend_box(handles, labels)
- self._last_fontsize_points = self.fontsize
+ self._last_fontsize_points = self._fontsize
def _set_artist_props(self, a):
@@ -313,7 +313,6 @@
"Draw everything that belongs to the legend"
if not self.get_visible(): return
- self._update_legend_box(renderer)
renderer.open_group('legend')
@@ -330,7 +329,7 @@
self._legend_box.set_offset(findoffset)
- fontsize = renderer.points_to_pixels(self.fontsize)
+ fontsize = renderer.points_to_pixels(self._fontsize)
# if mode == fill, set the width of the legend_box to the
# width of the paret (minus pads)
@@ -363,9 +362,9 @@
the legend handle.
"""
if renderer is None:
- return self.fontsize
+ return self._fontsize
else:
- return renderer.points_to_pixels(self.fontsize)
+ return renderer.points_to_pixels(self._fontsize)
def _init_legend_box(self, handles, labels):
@@ -376,7 +375,7 @@
drawing time.
"""
- fontsize = self.fontsize
+ fontsize = self._fontsize
# legend_box is a HPacker, horizontally packed with
# columns. Each column is a VPacker, vertically packed with
@@ -415,9 +414,6 @@
# (0, -descent, width, height). And their corrdinates should
# be given in the display coordinates.
- # NOTE : the coordinates will be updated again in
- # _update_legend_box() method.
-
# The transformation of each handle will be automatically set
# to self.get_trasnform(). If the artist does not uses its
# default trasnform (eg, Collections), you need to
@@ -567,9 +563,9 @@
sep = self.columnspacing*fontsize
self._legend_box = HPacker(pad=self.borderpad*fontsize,
- sep=sep, align="baseline",
- mode=mode,
- children=columnbox)
+ sep=sep, align="baseline",
+ mode=mode,
+ children=columnbox)
self._legend_box.set_figure(self.figure)
@@ -577,97 +573,6 @@
self.legendHandles = handle_list
-
-
- def _update_legend_box(self, renderer):
- """
- Update the dimension of the legend_box. This is required
- becuase the paddings, the hadle size etc. depends on the dpi
- of the renderer.
- """
-
- # fontsize in points.
- fontsize = renderer.points_to_pixels(self.fontsize)
-
- if self._last_fontsize_points == fontsize:
- # no update is needed
- return
-
- # each handle needs to be drawn inside a box of
- # (x, y, w, h) = (0, -descent, width, height).
- # And their corrdinates should be given in the display coordinates.
-
- # The approximate height and descent of text. These values are
- # only used for plotting the legend handle.
- height = self._approx_text_height(renderer) * 0.7
- descent = 0.
-
- for handle in self.legendHandles:
- if isinstance(handle, RegularPolyCollection):
- npoints = self.scatterpoints
- else:
- npoints = self.numpoints
- if npoints > 1:
- # we put some pad here to compensate the size of the
- # marker
- xdata = np.linspace(0.3*fontsize,
- (self.handlelength-0.3)*fontsize,
- npoints)
- xdata_marker = xdata
- elif npoints == 1:
- xdata = np.linspace(0, self.handlelength*fontsize, 2)
- xdata_marker = [0.5*self.handlelength*fontsize]
-
- if isinstance(handle, Line2D):
- legline = handle
- ydata = ((height-descent)/2.)*np.ones(xdata.shape, float)
- legline.set_data(xdata, ydata)
-
- # if a line collection is added, the legmarker attr is
- # not set so we don't need to handle it
- if hasattr(handle, "_legmarker"):
- legline_marker = legline._legmarker
- legline_marker.set_data(xdata_marker, ydata[:len(xdata_marker)])
-
- elif isinstance(handle, Patch):
- p = handle
- p.set_bounds(0., 0.,
- self.handlelength*fontsize,
- (height-descent),
- )
-
- elif isinstance(handle, RegularPolyCollection):
-
- p = handle
- ydata = height*self._scatteryoffsets
- p.set_offsets(zip(xdata_marker,ydata))
-
-
- # correction factor
- cor = fontsize / self._last_fontsize_points
-
- # helper function to iterate over all children
- def all_children(parent):
- yield parent
- for c in parent.get_children():
- for cc in all_children(c): yield cc
-
-
- #now update paddings
- for box in all_children(self._legend_box):
- if isinstance(box, PackerBase):
- box.pad = box.pad * cor
- box.sep = box.sep * cor
-
- elif isinstance(box, DrawingArea):
- box.width = self.handlelength*fontsize
- box.height = height
- box.xdescent = 0.
- box.ydescent=descent
-
- self._last_fontsize_points = fontsize
-
-
def _auto_legend_data(self):
"""
Returns list of vertices and extents covered by the plot.
@@ -769,7 +674,7 @@
c = anchor_coefs[loc]
- fontsize = renderer.points_to_pixels(self.fontsize)
+ fontsize = renderer.points_to_pixels(self._fontsize)
container = parentbbox.padded(-(self.borderaxespad) * fontsize)
anchored_box = bbox.anchored(c, container=container)
return anchored_box.x0, anchored_box.y0
Modified: trunk/matplotlib/lib/matplotlib/offsetbox.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/offsetbox.py 2009-02-04 21:48:49 UTC (rev 6878)
+++ trunk/matplotlib/lib/matplotlib/offsetbox.py 2009-02-05 04:47:26 UTC (rev 6879)
@@ -38,7 +38,7 @@
total width and the x-offset positions of each items according to
*mode*. xdescent is analagous to the usual descent, but along the
x-direction. xdescent values are currently ignored.
-
+
*wd_list* : list of (width, xdescent) of boxes to be packed.
*sep* : spacing between boxes
*total* : Intended total length. None if not used.
@@ -47,14 +47,14 @@
w_list, d_list = zip(*wd_list)
# d_list is currently not used.
-
+
if mode == "fixed":
offsets_ = np.add.accumulate([0]+[w + sep for w in w_list])
offsets = offsets_[:-1]
if total is None:
total = offsets_[-1] - sep
-
+
return total, offsets
elif mode == "expand":
@@ -86,7 +86,7 @@
total width and the offset positions of each items according to
*mode*. xdescent is analagous to the usual descent, but along the
x-direction. xdescent values are currently ignored.
-
+
*hd_list* : list of (width, xdescent) of boxes to be aligned.
*sep* : spacing between boxes
*height* : Intended total length. None if not used.
@@ -120,13 +120,13 @@
class OffsetBox(martist.Artist):
"""
The OffsetBox is a simple container artist. The child artist are meant
- to be drawn at a relative position to its parent.
+ to be drawn at a relative position to its parent.
"""
def __init__(self, *args, **kwargs):
super(OffsetBox, self).__init__(*args, **kwargs)
-
- self._children = []
+
+ self._children = []
self._offset = (0, 0)
def set_figure(self, fig):
@@ -138,7 +138,7 @@
martist.Artist.set_figure(self, fig)
for c in self.get_children():
c.set_figure(fig)
-
+
def set_offset(self, xy):
"""
Set the offset
@@ -173,7 +173,7 @@
accepts float
"""
self.height = height
-
+
def get_children(self):
"""
Return a list of artists it contains.
@@ -213,8 +213,8 @@
c.draw(renderer)
bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
-
+
class PackerBase(OffsetBox):
def __init__(self, pad=None, sep=None, width=None, height=None,
align=None, mode=None,
@@ -224,8 +224,14 @@
*sep* : spacing between items
*width*, *height* : width and height of the container box.
calculated if None.
- *align* : alignment of boxes
+ *align* : alignment of boxes. Can be one of 'top', 'bottom',
+ 'left', 'right', 'center' and 'baseline'
*mode* : packing mode
+
+ .. note::
+ *pad* and *sep* need to given in points and will be
+ scale with the renderer dpi, while *width* and *hight*
+ need to be in pixels.
"""
super(PackerBase, self).__init__()
@@ -254,9 +260,14 @@
calculated if None.
*align* : alignment of boxes
*mode* : packing mode
+
+ .. note::
+ *pad* and *sep* need to given in points and will be
+ scale with the renderer dpi, while *width* and *hight*
+ need to be in pixels.
"""
super(VPacker, self).__init__(pad, sep, width, height,
- align, mode,
+ align, mode,
children)
@@ -266,6 +277,10 @@
update offset of childrens and return the extents of the box
"""
+ dpicor = renderer.points_to_pixels(1.)
+ pad = self.pad * dpicor
+ sep = self.sep * dpicor
+
whd_list = [c.get_extent(renderer) for c in self.get_children()]
whd_list = [(w, h, xd, (h-yd)) for w, h, xd, yd in whd_list]
@@ -277,8 +292,8 @@
pack_list = [(h, yd) for w,h,xd,yd in whd_list]
height, yoffsets_ = _get_packed_offsets(pack_list, self.height,
- self.sep, self.mode)
-
+ sep, self.mode)
+
yoffsets = yoffsets_ + [yd for w,h,xd,yd in whd_list]
ydescent = height - yoffsets[0]
yoffsets = height - yoffsets
@@ -286,8 +301,9 @@
#w, h, xd, h_yd = whd_list[-1]
yoffsets = yoffsets - ydescent
- return width + 2*self.pad, height + 2*self.pad, \
- xdescent+self.pad, ydescent+self.pad, \
+
+ return width + 2*pad, height + 2*pad, \
+ xdescent+pad, ydescent+pad, \
zip(xoffsets, yoffsets)
@@ -296,7 +312,7 @@
The HPacker has its children packed horizontally. It automatically
adjust the relative postisions of children in the drawing time.
"""
- def __init__(self, pad=None, sep=None, width=None, height=None,
+ def __init__(self, pad=None, sep=None, width=None, height=None,
align="baseline", mode="fixed",
children=None):
"""
@@ -306,6 +322,11 @@
calculated if None.
*align* : alignment of boxes
*mode* : packing mode
+
+ .. note::
+ *pad* and *sep* need to given in points and will be
+ scale with the renderer dpi, while *width* and *hight*
+ need to be in pixels.
"""
super(HPacker, self).__init__(pad, sep, width, height,
align, mode, children)
@@ -316,14 +337,18 @@
update offset of childrens and return the extents of the box
"""
+ dpicor = renderer.points_to_pixels(1.)
+ pad = self.pad * dpicor
+ sep = self.sep * dpicor
+
whd_list = [c.get_extent(renderer) for c in self.get_children()]
if self.height is None:
- height_descent = max([h-yd for w,h,xd,yd in whd_list])
+ height_descent = max([h-yd for w,h,xd,yd in whd_list])
ydescent = max([yd for w,h,xd,yd in whd_list])
height = height_descent + ydescent
else:
- height = self.height - 2*self._pad # width w/o pad
+ height = self.height - 2*pad # width w/o pad
hd_list = [(h, yd) for w, h, xd, yd in whd_list]
height, ydescent, yoffsets = _get_aligned_offsets(hd_list,
@@ -333,26 +358,26 @@
pack_list = [(w, xd) for w,h,xd,yd in whd_list]
width, xoffsets_ = _get_packed_offsets(pack_list, self.width,
- self.sep, self.mode)
+ sep, self.mode)
xoffsets = xoffsets_ + [xd for w,h,xd,yd in whd_list]
xdescent=whd_list[0][2]
xoffsets = xoffsets - xdescent
-
- return width + 2*self.pad, height + 2*self.pad, \
- xdescent + self.pad, ydescent + self.pad, \
+
+ return width + 2*pad, height + 2*pad, \
+ xdescent + pad, ydescent + pad, \
zip(xoffsets, yoffsets)
-
+
class DrawingArea(OffsetBox):
"""
The DrawingArea can contain any Artist as a child. The DrawingArea
has a fixed width and height. The position of children relative to
the parent is fixed.
"""
-
+
def __init__(self, width, height, xdescent=0.,
ydescent=0., clip=True):
"""
@@ -371,13 +396,16 @@
self.offset_transform.clear()
self.offset_transform.translate(0, 0)
+ self.dpi_transform = mtransforms.Affine2D()
+
+
def get_transform(self):
"""
Return the :class:`~matplotlib.transforms.Transform` applied
to the children
"""
- return self.offset_transform
+ return self.dpi_transform + self.offset_transform
def set_transform(self, t):
"""
@@ -404,7 +432,7 @@
"""
return self._offset
-
+
def get_window_extent(self, renderer):
'''
get the bounding box in display space.
@@ -418,10 +446,13 @@
"""
Return with, height, xdescent, ydescent of box
"""
- return self.width, self.height, self.xdescent, self.ydescent
+ dpi_cor = renderer.points_to_pixels(1.)
+ return self.width*dpi_cor, self.height*dpi_cor, \
+ self.xdescent*dpi_cor, self.ydescent*dpi_cor
+
def add_artist(self, a):
'Add any :class:`~matplotlib.artist.Artist` to the container box'
self._children.append(a)
@@ -433,6 +464,10 @@
Draw the children
"""
+ dpi_cor = renderer.points_to_pixels(1.)
+ self.dpi_transform.clear()
+ self.dpi_transform.scale(dpi_cor, dpi_cor)
+
for c in self._children:
c.draw(renderer)
@@ -448,7 +483,7 @@
"""
-
+
def __init__(self, s,
textprops=None,
multilinebaseline=None,
@@ -473,8 +508,8 @@
OffsetBox.__init__(self)
self._children = [self._text]
-
+
self.offset_transform = mtransforms.Affine2D()
self.offset_transform.clear()
self.offset_transform.translate(0, 0)
@@ -483,8 +518,8 @@
self._multilinebaseline = multilinebaseline
self._minimumdescent = minimumdescent
-
+
def set_multilinebaseline(self, t):
"""
Set multilinebaseline .
@@ -507,7 +542,7 @@
"""
Set minimumdescent .
- If True, extent of the single line text is adjusted so that
+ If True, extent of the single line text is adjusted so that
it has minimum descent of "p"
"""
self._minimumdescent = t
@@ -545,7 +580,7 @@
"""
return self._offset
-
+
def get_window_extent(self, renderer):
'''
get the bounding box in display space.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <as...@us...> - 2009-02-04 22:22:19
|
Revision: 6878
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6878&view=rev
Author: astraw
Date: 2009-02-04 21:48:49 +0000 (Wed, 04 Feb 2009)
Log Message:
-----------
more git instructions
Modified Paths:
--------------
trunk/matplotlib/doc/devel/coding_guide.rst
Modified: trunk/matplotlib/doc/devel/coding_guide.rst
===================================================================
--- trunk/matplotlib/doc/devel/coding_guide.rst 2009-02-04 21:44:05 UTC (rev 6877)
+++ trunk/matplotlib/doc/devel/coding_guide.rst 2009-02-04 21:48:49 UTC (rev 6878)
@@ -224,6 +224,14 @@
git checkout whizbang-branch
git rebase master
+If you get the dreaded "Unable to determine upstream SVN information
+from working tree history" error when running "git svn rebase", try
+creating a new git branch based on subversion trunk and cherry pick
+your patches onto that::
+
+ git checkout -b work remotes/trunk # create a new "work" branch
+ git cherry-pick <commit> # where <commit> will get applied to new branch
+
Working on a maintenance branch from git
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <as...@us...> - 2009-02-04 22:22:11
|
Revision: 6876
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6876&view=rev
Author: astraw
Date: 2009-02-04 21:43:08 +0000 (Wed, 04 Feb 2009)
Log Message:
-----------
Add extent keyword arg to hexbin
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-02-04 20:06:17 UTC (rev 6875)
+++ trunk/matplotlib/CHANGELOG 2009-02-04 21:43:08 UTC (rev 6876)
@@ -1,3 +1,5 @@
+2009-02-04 Add extent keyword arg to hexbin - ADS
+
2009-02-04 Fix bug in mathtext related to \dots and \ldots - MGD
2009-02-03 Change default joinstyle to round - MGD
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-02-04 20:06:17 UTC (rev 6875)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-02-04 21:43:08 UTC (rev 6876)
@@ -5242,7 +5242,7 @@
scatter.__doc__ = cbook.dedent(scatter.__doc__) % martist.kwdocd
def hexbin(self, x, y, C = None, gridsize = 100, bins = None,
- xscale = 'linear', yscale = 'linear',
+ xscale = 'linear', yscale = 'linear', extent = None,
cmap=None, norm=None, vmin=None, vmax=None,
alpha=1.0, linewidths=None, edgecolors='none',
reduce_C_function = np.mean, mincnt=None, marginals=False,
@@ -5311,6 +5311,10 @@
colormapped rectagles along the bottom of the x-axis and
left of the y-axis
+ *extent*: [ None | scalars (left, right, bottom, top) ]
+ The limits of the bins. The default assigns the limits
+ based on gridsize, x, y, xscale and yscale.
+
Other keyword arguments controlling color mapping and normalization
arguments:
@@ -5389,10 +5393,13 @@
x = np.log10(x)
if yscale=='log':
y = np.log10(y)
- xmin = np.amin(x)
- xmax = np.amax(x)
- ymin = np.amin(y)
- ymax = np.amax(y)
+ if extent is not None:
+ xmin, xmax, ymin, ymax = extent
+ else:
+ xmin = np.amin(x)
+ xmax = np.amax(x)
+ ymin = np.amin(y)
+ ymax = np.amax(y)
# In the x-direction, the hexagons exactly cover the region from
# xmin to xmax. Need some padding to avoid roundoff errors.
padding = 1.e-9 * (xmax - xmin)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <as...@us...> - 2009-02-04 22:22:06
|
Revision: 6877
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6877&view=rev
Author: astraw
Date: 2009-02-04 21:44:05 +0000 (Wed, 04 Feb 2009)
Log Message:
-----------
update docs to fetch less from svn when using git
Modified Paths:
--------------
trunk/matplotlib/doc/devel/coding_guide.rst
Modified: trunk/matplotlib/doc/devel/coding_guide.rst
===================================================================
--- trunk/matplotlib/doc/devel/coding_guide.rst 2009-02-04 21:43:08 UTC (rev 6876)
+++ trunk/matplotlib/doc/devel/coding_guide.rst 2009-02-04 21:44:05 UTC (rev 6877)
@@ -177,7 +177,7 @@
git svn init --branches=branches --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
+ git svn fetch -r 6800: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: <ry...@us...> - 2009-02-04 20:06:20
|
Revision: 6875
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6875&view=rev
Author: ryanmay
Date: 2009-02-04 20:06:17 +0000 (Wed, 04 Feb 2009)
Log Message:
-----------
Remove unused imports.
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/pythonic_matplotlib.py
Modified: trunk/matplotlib/examples/pylab_examples/pythonic_matplotlib.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/pythonic_matplotlib.py 2009-02-04 13:37:24 UTC (rev 6874)
+++ trunk/matplotlib/examples/pylab_examples/pythonic_matplotlib.py 2009-02-04 20:06:17 UTC (rev 6875)
@@ -53,7 +53,7 @@
"""
-from pylab import figure, close, axes, subplot, show
+from pylab import figure, show
from numpy import arange, sin, pi
t = arange(0.0, 1.0, 0.01)
@@ -80,5 +80,3 @@
l.set_fontsize('large')
show()
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-02-04 13:37:28
|
Revision: 6874
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6874&view=rev
Author: mdboom
Date: 2009-02-04 13:37:24 +0000 (Wed, 04 Feb 2009)
Log Message:
-----------
Merged revisions 6861,6873 via svnmerge from
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint
........
r6861 | mdboom | 2009-01-30 11:31:47 -0500 (Fri, 30 Jan 2009) | 2 lines
Document how to find the currently active matplotlibrc file.
........
r6873 | mdboom | 2009-02-04 08:22:35 -0500 (Wed, 04 Feb 2009) | 2 lines
Fix bug in mathtext related to \dots and \ldots (Thanks, Fernando Perez)
........
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/doc/users/customizing.rst
trunk/matplotlib/examples/pylab_examples/mathtext_examples.py
trunk/matplotlib/lib/matplotlib/_mathtext_data.py
trunk/matplotlib/lib/matplotlib/mathtext.py
Property Changed:
----------------
trunk/matplotlib/
trunk/matplotlib/doc/pyplots/README
trunk/matplotlib/doc/sphinxext/gen_gallery.py
trunk/matplotlib/doc/sphinxext/gen_rst.py
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6859
+ /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6873
Modified: svn:mergeinfo
- /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859
+ /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-02-04 13:22:35 UTC (rev 6873)
+++ trunk/matplotlib/CHANGELOG 2009-02-04 13:37:24 UTC (rev 6874)
@@ -1,3 +1,5 @@
+2009-02-04 Fix bug in mathtext related to \dots and \ldots - MGD
+
2009-02-03 Change default joinstyle to round - MGD
2009-02-02 Reduce number of marker XObjects in pdf output - JKS
Property changes on: trunk/matplotlib/doc/pyplots/README
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859
+ /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873
Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859
+ /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873
Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859
+ /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873
Modified: trunk/matplotlib/doc/users/customizing.rst
===================================================================
--- trunk/matplotlib/doc/users/customizing.rst 2009-02-04 13:22:35 UTC (rev 6873)
+++ trunk/matplotlib/doc/users/customizing.rst 2009-02-04 13:37:24 UTC (rev 6874)
@@ -27,7 +27,13 @@
customizations to be saved, please move this file to you :file:`.matplotlib`
directory.
+To display where the currently active :file:`matplotlibrc` file was
+loaded from, one can do the following::
+ >>> import matplotlib
+ >>> matplotlib.matplotlib_fname()
+ '/home/foo/.matplotlib/matplotlibrc'
+
See below for a sample :ref:`matplotlibrc file<matplotlibrc-sample>`.
.. _customizing-with-dynamic-rc-settings:
Modified: trunk/matplotlib/examples/pylab_examples/mathtext_examples.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/mathtext_examples.py 2009-02-04 13:22:35 UTC (rev 6873)
+++ trunk/matplotlib/examples/pylab_examples/mathtext_examples.py 2009-02-04 13:37:24 UTC (rev 6874)
@@ -5,6 +5,7 @@
import gc
stests = [
+ r'$a+b+\dots+\dot{s}+\ldots$',
r'$x \doteq y$',
r'\$100.00 $\alpha \_$',
r'$\frac{\$100.00}{y}$',
Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2009-02-04 13:22:35 UTC (rev 6873)
+++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py 2009-02-04 13:37:24 UTC (rev 6874)
@@ -1805,7 +1805,7 @@
'Game': 0x2141,
'hbar': 0x0127,
'hslash': 0x210f,
-'ldots': 0x22ef,
+'ldots': 0x2026,
'vdots': 0x22ee,
'doteqdot': 0x2251,
'doteq': 8784,
@@ -2100,7 +2100,7 @@
'propto': 8733,
'pi': 960,
'pm': 177,
-'dots': 8230,
+'dots': 0x2026,
'nrightarrow': 8603,
'textasciiacute': 180,
'Doteq': 8785,
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2009-02-04 13:22:35 UTC (rev 6873)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2009-02-04 13:37:24 UTC (rev 6874)
@@ -2037,7 +2037,7 @@
\sqsubset \sqsupset \neq \smile
\sqsubseteq \sqsupseteq \doteq \frown
\in \ni \propto
- \vdash \dashv'''.split())
+ \vdash \dashv \dots'''.split())
_arrow_symbols = set(r'''
\leftarrow \longleftarrow \uparrow
@@ -2180,9 +2180,9 @@
+ (group | Error("Expected \sqrt{value}"))
).setParseAction(self.sqrt).setName("sqrt")
- placeable <<(accent
- ^ function
+ placeable <<(function
^ (c_over_c | symbol)
+ ^ accent
^ group
^ frac
^ sqrt
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-02-04 13:22:39
|
Revision: 6873
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6873&view=rev
Author: mdboom
Date: 2009-02-04 13:22:35 +0000 (Wed, 04 Feb 2009)
Log Message:
-----------
Fix bug in mathtext related to \dots and \ldots (Thanks, Fernando Perez)
Modified Paths:
--------------
branches/v0_98_5_maint/CHANGELOG
branches/v0_98_5_maint/examples/pylab_examples/mathtext_examples.py
branches/v0_98_5_maint/lib/matplotlib/_mathtext_data.py
branches/v0_98_5_maint/lib/matplotlib/mathtext.py
Modified: branches/v0_98_5_maint/CHANGELOG
===================================================================
--- branches/v0_98_5_maint/CHANGELOG 2009-02-03 22:29:30 UTC (rev 6872)
+++ branches/v0_98_5_maint/CHANGELOG 2009-02-04 13:22:35 UTC (rev 6873)
@@ -1,3 +1,5 @@
+2009-02-04 Fix bug in mathtext related to \dots and \ldots - MGD
+
2009-01-29 Document 'resolution' kwarg for polar plots. Support it
when using pyplot.polar, not just Figure.add_axes. - MGD
Modified: branches/v0_98_5_maint/examples/pylab_examples/mathtext_examples.py
===================================================================
--- branches/v0_98_5_maint/examples/pylab_examples/mathtext_examples.py 2009-02-03 22:29:30 UTC (rev 6872)
+++ branches/v0_98_5_maint/examples/pylab_examples/mathtext_examples.py 2009-02-04 13:22:35 UTC (rev 6873)
@@ -5,6 +5,7 @@
import gc
stests = [
+ r'$a+b+\dots+\dot{s}+\ldots$',
r'$x \doteq y$',
r'\$100.00 $\alpha \_$',
r'$\frac{\$100.00}{y}$',
Modified: branches/v0_98_5_maint/lib/matplotlib/_mathtext_data.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/_mathtext_data.py 2009-02-03 22:29:30 UTC (rev 6872)
+++ branches/v0_98_5_maint/lib/matplotlib/_mathtext_data.py 2009-02-04 13:22:35 UTC (rev 6873)
@@ -1805,7 +1805,7 @@
'Game': 0x2141,
'hbar': 0x0127,
'hslash': 0x210f,
-'ldots': 0x22ef,
+'ldots': 0x2026,
'vdots': 0x22ee,
'doteqdot': 0x2251,
'doteq': 8784,
@@ -2100,7 +2100,7 @@
'propto': 8733,
'pi': 960,
'pm': 177,
-'dots': 8230,
+'dots': 0x2026,
'nrightarrow': 8603,
'textasciiacute': 180,
'Doteq': 8785,
Modified: branches/v0_98_5_maint/lib/matplotlib/mathtext.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/mathtext.py 2009-02-03 22:29:30 UTC (rev 6872)
+++ branches/v0_98_5_maint/lib/matplotlib/mathtext.py 2009-02-04 13:22:35 UTC (rev 6873)
@@ -2035,7 +2035,7 @@
\sqsubset \sqsupset \neq \smile
\sqsubseteq \sqsupseteq \doteq \frown
\in \ni \propto
- \vdash \dashv'''.split())
+ \vdash \dashv \dots'''.split())
_arrow_symbols = set(r'''
\leftarrow \longleftarrow \uparrow
@@ -2178,9 +2178,9 @@
+ (group | Error("Expected \sqrt{value}"))
).setParseAction(self.sqrt).setName("sqrt")
- placeable <<(accent
- ^ function
+ placeable <<(function
^ (c_over_c | symbol)
+ ^ accent
^ group
^ frac
^ sqrt
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jr...@us...> - 2009-02-03 22:29:34
|
Revision: 6872
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6872&view=rev
Author: jrevans
Date: 2009-02-03 22:29:30 +0000 (Tue, 03 Feb 2009)
Log Message:
-----------
Fixed a bug in RRuleLocator that generated invalid datetimes when padding the axes bounds for large ranges of times or with times that are close to the boundaries of valid datetimes.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/dates.py
Modified: trunk/matplotlib/lib/matplotlib/dates.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/dates.py 2009-02-03 19:52:02 UTC (rev 6871)
+++ trunk/matplotlib/lib/matplotlib/dates.py 2009-02-03 22:29:30 UTC (rev 6872)
@@ -481,7 +481,20 @@
if dmin>dmax:
dmax, dmin = dmin, dmax
delta = relativedelta(dmax, dmin)
- self.rule.set(dtstart=dmin-delta, until=dmax+delta)
+
+ # We need to cap at the endpoints of valid datetime
+ try:
+ start = dmin - delta
+ except ValueError:
+ start = _from_ordinalf( 1.0 )
+
+ try:
+ stop = dmax + delta
+ except ValueError:
+ # The magic number!
+ stop = _from_ordinalf( 3652059.9999999 )
+
+ self.rule.set(dtstart=start, until=stop)
dates = self.rule.between(dmin, dmax, True)
return date2num(dates)
@@ -518,7 +531,20 @@
dmax, dmin = dmin, dmax
delta = relativedelta(dmax, dmin)
- self.rule.set(dtstart=dmin-delta, until=dmax+delta)
+
+ # We need to cap at the endpoints of valid datetime
+ try:
+ start = dmin - delta
+ except ValueError:
+ start = _from_ordinalf( 1.0 )
+
+ try:
+ stop = dmax + delta
+ except ValueError:
+ # The magic number!
+ stop = _from_ordinalf( 3652059.9999999 )
+
+ self.rule.set(dtstart=start, until=stop)
dmin, dmax = self.datalim_to_dt()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-02-03 19:52:06
|
Revision: 6871
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6871&view=rev
Author: mdboom
Date: 2009-02-03 19:52:02 +0000 (Tue, 03 Feb 2009)
Log Message:
-----------
Change default joinstyle to round
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backend_bases.py
trunk/matplotlib/lib/matplotlib/config/mplconfig.py
trunk/matplotlib/lib/matplotlib/config/rcsetup.py
trunk/matplotlib/lib/matplotlib/rcsetup.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-02-03 17:25:49 UTC (rev 6870)
+++ trunk/matplotlib/CHANGELOG 2009-02-03 19:52:02 UTC (rev 6871)
@@ -1,3 +1,5 @@
+2009-02-03 Change default joinstyle to round - MGD
+
2009-02-02 Reduce number of marker XObjects in pdf output - JKS
2009-02-02 Change default resolution on polar plot to 1 - MGD
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-02-03 17:25:49 UTC (rev 6870)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-02-03 19:52:02 UTC (rev 6871)
@@ -434,7 +434,7 @@
self._cliprect = None
self._clippath = None
self._dashes = None, None
- self._joinstyle = 'miter'
+ self._joinstyle = 'round'
self._linestyle = 'solid'
self._linewidth = 1
self._rgb = (0.0, 0.0, 0.0)
Modified: trunk/matplotlib/lib/matplotlib/config/mplconfig.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2009-02-03 17:25:49 UTC (rev 6870)
+++ trunk/matplotlib/lib/matplotlib/config/mplconfig.py 2009-02-03 19:52:02 UTC (rev 6871)
@@ -105,9 +105,9 @@
linewidth = T.Float(1.0)
linestyle = T.Trait('-','--','-.', ':', 'steps', '', ' ', None)
color = T.Trait('blue',mplT.ColorHandler())
- solid_joinstyle = T.Trait('miter', 'miter', 'round', 'bevel')
+ solid_joinstyle = T.Trait('round', 'miter', 'round', 'bevel')
solid_capstyle = T.Trait('butt', 'butt', 'round', 'projecting')
- dash_joinstyle = T.Trait('miter', 'miter', 'round', 'bevel')
+ dash_joinstyle = T.Trait('round', 'miter', 'round', 'bevel')
dash_capstyle = T.Trait('butt', 'butt', 'round', 'projecting')
marker = T.Trait('None', 'None', 'o', '.', ',', '^', 'v', '<', '>', 's',
'+', 'x', 'D','d', '1', '2', '3', '4', 'h', 'H', 'p',
Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2009-02-03 17:25:49 UTC (rev 6870)
+++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py 2009-02-03 19:52:02 UTC (rev 6871)
@@ -317,8 +317,8 @@
'lines.markeredgewidth' : [0.5, validate_float],
'lines.markersize' : [6, validate_float], # markersize, in points
'lines.antialiased' : [True, validate_bool], # antialised (no jaggies)
- 'lines.dash_joinstyle' : ['miter', validate_joinstyle],
- 'lines.solid_joinstyle' : ['miter', validate_joinstyle],
+ 'lines.dash_joinstyle' : ['round', validate_joinstyle],
+ 'lines.solid_joinstyle' : ['round', validate_joinstyle],
'lines.dash_capstyle' : ['butt', validate_capstyle],
'lines.solid_capstyle' : ['projecting', validate_capstyle],
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py 2009-02-03 17:25:49 UTC (rev 6870)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2009-02-03 19:52:02 UTC (rev 6871)
@@ -343,8 +343,8 @@
'lines.markeredgewidth' : [0.5, validate_float],
'lines.markersize' : [6, validate_float], # markersize, in points
'lines.antialiased' : [True, validate_bool], # antialised (no jaggies)
- 'lines.dash_joinstyle' : ['miter', validate_joinstyle],
- 'lines.solid_joinstyle' : ['miter', validate_joinstyle],
+ 'lines.dash_joinstyle' : ['round', validate_joinstyle],
+ 'lines.solid_joinstyle' : ['round', validate_joinstyle],
'lines.dash_capstyle' : ['butt', validate_capstyle],
'lines.solid_capstyle' : ['projecting', validate_capstyle],
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jr...@us...> - 2009-02-03 17:25:52
|
Revision: 6870
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6870&view=rev
Author: jrevans
Date: 2009-02-03 17:25:49 +0000 (Tue, 03 Feb 2009)
Log Message:
-----------
User specified tickers and labels for any given axis will now take precedence over "default" values.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/axis.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-02-03 13:59:00 UTC (rev 6869)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-02-03 17:25:49 UTC (rev 6870)
@@ -2672,12 +2672,7 @@
:meth:`text`
for information on how override and the optional args work
"""
-
- label = self.xaxis.get_label()
- label.set_text(xlabel)
- if fontdict is not None: label.update(fontdict)
- label.update(kwargs)
- return label
+ return self.xaxis.set_label_text(xlabel, fontdict, **kwargs)
set_xlabel.__doc__ = cbook.dedent(set_xlabel.__doc__) % martist.kwdocd
def get_ylabel(self):
@@ -2704,11 +2699,7 @@
:meth:`text`
for information on how override and the optional args work
"""
- label = self.yaxis.get_label()
- label.set_text(ylabel)
- if fontdict is not None: label.update(fontdict)
- label.update(kwargs)
- return label
+ return self.yaxis.set_label_text(ylabel, fontdict, **kwargs)
set_ylabel.__doc__ = cbook.dedent(set_ylabel.__doc__) % martist.kwdocd
def text(self, x, y, s, fontdict=None,
Modified: trunk/matplotlib/lib/matplotlib/axis.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis.py 2009-02-03 13:59:00 UTC (rev 6869)
+++ trunk/matplotlib/lib/matplotlib/axis.py 2009-02-03 17:25:49 UTC (rev 6870)
@@ -514,6 +514,15 @@
artist.Artist.__init__(self)
self.set_figure(axes.figure)
+ # Keep track of setting to the default value, this allows use to know
+ # if any of the following values is explicitly set by the user, so as
+ # to not overwrite their settings with any of our 'auto' settings.
+ self.isDefault_majloc = True
+ self.isDefault_minloc = True
+ self.isDefault_majfmt = True
+ self.isDefault_minfmt = True
+ self.isDefault_label = True
+
self.axes = axes
self.major = Ticker()
self.minor = Ticker()
@@ -568,6 +577,11 @@
self._scale = mscale.scale_factory(value, self, **kwargs)
self._scale.set_default_locators_and_formatters(self)
+ self.isDefault_majloc = True
+ self.isDefault_minloc = True
+ self.isDefault_majfmt = True
+ self.isDefault_minfmt = True
+
def limit_range_for_scale(self, vmin, vmax):
return self._scale.limit_range_for_scale(vmin, vmax, self.get_minpos())
@@ -587,6 +601,18 @@
self.set_minor_locator(mticker.NullLocator())
self.set_minor_formatter(mticker.NullFormatter())
+ self.set_label_text('')
+ self._set_artist_props(self.label)
+
+ # Keep track of setting to the default value, this allows use to know
+ # if any of the following values is explicitly set by the user, so as
+ # to not overwrite their settings with any of our 'auto' settings.
+ self.isDefault_majloc = True
+ self.isDefault_minloc = True
+ self.isDefault_majfmt = True
+ self.isDefault_minfmt = True
+ self.isDefault_label = True
+
# Clear the callback registry for this axis, or it may "leak"
self.callbacks = cbook.CallbackRegistry(('units', 'units finalize'))
@@ -836,6 +862,10 @@
dest.label1On = src.label1On
dest.label2On = src.label2On
+ def get_label_text(self):
+ 'Get the text of the label'
+ return self.label.get_text()
+
def get_major_locator(self):
'Get the locator of the major ticker'
return self.major.locator
@@ -958,17 +988,21 @@
info = self.converter.axisinfo(self.units, self)
if info is None:
return
- if info.majloc is not None and self.major.locator!=info.majloc:
+ if info.majloc is not None and self.major.locator!=info.majloc and self.isDefault_majloc:
self.set_major_locator(info.majloc)
- if info.minloc is not None and self.minor.locator!=info.minloc:
+ self.isDefault_majloc = True
+ if info.minloc is not None and self.minor.locator!=info.minloc and self.isDefault_minloc:
self.set_minor_locator(info.minloc)
- if info.majfmt is not None and self.major.formatter!=info.majfmt:
+ self.isDefault_minloc = True
+ if info.majfmt is not None and self.major.formatter!=info.majfmt and self.isDefault_majfmt:
self.set_major_formatter(info.majfmt)
- if info.minfmt is not None and self.minor.formatter!=info.minfmt:
+ self.isDefault_majfmt = True
+ if info.minfmt is not None and self.minor.formatter!=info.minfmt and self.isDefault_minfmt:
self.set_minor_formatter(info.minfmt)
- if info.label is not None:
- label = self.get_label()
- label.set_text(info.label)
+ self.isDefault_minfmt = True
+ if info.label is not None and self.isDefault_label:
+ self.set_label_text(info.label)
+ self.isDefault_label = True
def have_units(self):
@@ -1010,12 +1044,24 @@
'return the units for axis'
return self.units
+ def set_label_text(self, label, fontdict = None, **kwargs):
+ """ Sets the text value of the axis label
+
+ ACCEPTS: A string value for the label
+ """
+ self.isDefault_label = False
+ self.label.set_text(label)
+ if fontdict is not None: self.label.update(fontdict)
+ self.label.update(kwargs)
+ return self.label
+
def set_major_formatter(self, formatter):
"""
Set the formatter of the major ticker
ACCEPTS: A :class:`~matplotlib.ticker.Formatter` instance
"""
+ self.isDefault_majfmt = False
self.major.formatter = formatter
formatter.set_axis(self)
@@ -1026,6 +1072,7 @@
ACCEPTS: A :class:`~matplotlib.ticker.Formatter` instance
"""
+ self.isDefault_minfmt = False
self.minor.formatter = formatter
formatter.set_axis(self)
@@ -1036,6 +1083,7 @@
ACCEPTS: a :class:`~matplotlib.ticker.Locator` instance
"""
+ self.isDefault_majloc = False
self.major.locator = locator
locator.set_axis(self)
@@ -1046,6 +1094,7 @@
ACCEPTS: a :class:`~matplotlib.ticker.Locator` instance
"""
+ self.isDefault_minloc = False
self.minor.locator = locator
locator.set_axis(self)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-02-03 13:59:07
|
Revision: 6869
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6869&view=rev
Author: mdboom
Date: 2009-02-03 13:59:00 +0000 (Tue, 03 Feb 2009)
Log Message:
-----------
Fix TkAgg backend.
Modified Paths:
--------------
trunk/matplotlib/setupext.py
Modified: trunk/matplotlib/setupext.py
===================================================================
--- trunk/matplotlib/setupext.py 2009-02-02 19:35:43 UTC (rev 6868)
+++ trunk/matplotlib/setupext.py 2009-02-03 13:59:00 UTC (rev 6869)
@@ -1124,12 +1124,13 @@
def build_tkagg(ext_modules, packages):
global BUILT_TKAGG
if BUILT_TKAGG: return # only build it if you you haven't already
- deps = ['src/_tkagg.cpp']
+ deps = ['src/agg_py_transforms.cpp', 'src/_tkagg.cpp']
deps.extend(glob.glob('CXX/*.cxx'))
deps.extend(glob.glob('CXX/*.c'))
module = Extension('matplotlib.backends._tkagg',
deps,
+ define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')]
)
add_tk_flags(module) # do this first
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jo...@us...> - 2009-02-02 19:35:47
|
Revision: 6868
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6868&view=rev
Author: jouni
Date: 2009-02-02 19:35:43 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
Reduce number of marker objects in pdf output
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-02-02 17:58:48 UTC (rev 6867)
+++ trunk/matplotlib/CHANGELOG 2009-02-02 19:35:43 UTC (rev 6868)
@@ -1,3 +1,5 @@
+2009-02-02 Reduce number of marker XObjects in pdf output - JKS
+
2009-02-02 Change default resolution on polar plot to 1 - MGD
2009-02-02 Avoid malloc errors in ttconv for fonts that don't have
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-02-02 17:58:48 UTC (rev 6867)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-02-02 19:35:43 UTC (rev 6868)
@@ -1109,26 +1109,28 @@
def markerObject(self, path, trans, fillp, lw):
"""Return name of a marker XObject representing the given path."""
- key = (path, trans, fillp is not None, lw)
+ pathops = self.pathOperations(path, trans)
+ key = (tuple(pathops), bool(fillp))
result = self.markers.get(key)
if result is None:
name = Name('M%d' % len(self.markers))
ob = self.reserveObject('marker %d' % len(self.markers))
- self.markers[key] = (name, ob, path, trans, fillp, lw)
+ bbox = path.get_extents(trans)
+ self.markers[key] = [name, ob, bbox, lw]
else:
+ if result[-1] < lw:
+ result[-1] = lw
name = result[0]
return name
def writeMarkers(self):
- for tup in self.markers.values():
- name, object, path, trans, fillp, lw = tup
- bbox = path.get_extents(trans)
+ for (pathops, fillp),(name, ob, bbox, lw) in self.markers.iteritems():
bbox = bbox.padded(lw * 0.5)
self.beginStream(
- object.id, None,
+ ob.id, None,
{'Type': Name('XObject'), 'Subtype': Name('Form'),
'BBox': list(bbox.extents) })
- self.writePath(path, trans)
+ self.output(*pathops)
if fillp:
self.output(Op.fill_stroke)
else:
@@ -1280,10 +1282,17 @@
def draw_path(self, gc, path, transform, rgbFace=None):
self.check_gc(gc, rgbFace)
- stream = self.file.writePath(path, transform, rgbFace is None)
+ self.file.writePath(path, transform, rgbFace is None)
self.file.output(self.gc.paint())
def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None):
+ # For simple paths or small numbers of markers, don't bother
+ # making an XObject
+ if len(path) * len(marker_path) <= 10:
+ RendererBase.draw_markers(self, gc, marker_path, marker_trans,
+ path, trans, rgbFace)
+ return
+
self.check_gc(gc, rgbFace)
fillp = rgbFace is not None
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-02-02 17:58:53
|
Revision: 6867
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6867&view=rev
Author: mdboom
Date: 2009-02-02 17:58:48 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
Make resolution of 1 be the default on a polar plot.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/projections/polar.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-02-02 17:12:27 UTC (rev 6866)
+++ trunk/matplotlib/CHANGELOG 2009-02-02 17:58:48 UTC (rev 6867)
@@ -1,3 +1,5 @@
+2009-02-02 Change default resolution on polar plot to 1 - MGD
+
2009-02-02 Avoid malloc errors in ttconv for fonts that don't have
e.g. PostName (a version of Tahoma triggered this) - JKS
Modified: trunk/matplotlib/lib/matplotlib/projections/polar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/projections/polar.py 2009-02-02 17:12:27 UTC (rev 6866)
+++ trunk/matplotlib/lib/matplotlib/projections/polar.py 2009-02-02 17:58:48 UTC (rev 6867)
@@ -177,7 +177,7 @@
return 0, vmax
- RESOLUTION = 75
+ RESOLUTION = 1
def __init__(self, *args, **kwargs):
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-02-02 17:12:30
|
Revision: 6866
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6866&view=rev
Author: mdboom
Date: 2009-02-02 17:12:27 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
Fix markevery -- the tuple form was not working (if it ever was).
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/lines.py
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py 2009-02-02 16:29:37 UTC (rev 6865)
+++ trunk/matplotlib/lib/matplotlib/lines.py 2009-02-02 17:12:27 UTC (rev 6866)
@@ -508,12 +508,12 @@
startind, stride = markevery
else:
startind, stride = 0, markevery
- if tpath.codes is not None:
- codes = tpath.codes[startind::stride]
- else:
- codes = None
- vertices = tpath.vertices[startind::stride]
- subsampled = Path(vertices, codes)
+ if tpath.codes is not None:
+ codes = tpath.codes[startind::stride]
+ else:
+ codes = None
+ vertices = tpath.vertices[startind::stride]
+ subsampled = Path(vertices, codes)
else:
subsampled = tpath
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-02-02 16:29:41
|
Revision: 6865
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6865&view=rev
Author: mdboom
Date: 2009-02-02 16:29:37 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
Create path_cleanup code for use by the Mac OS-X backend. Refactor C++ code to follow Numpy's guidelines for linking multiple C files into a single extension. Remove dependency of Agg backend on _image.cpp and _ft2font.cpp (simplifies linking problems and reduces generated code size).
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp
trunk/matplotlib/setupext.py
trunk/matplotlib/src/_backend_agg.cpp
trunk/matplotlib/src/_backend_gdk.c
trunk/matplotlib/src/_gtkagg.cpp
trunk/matplotlib/src/_image.cpp
trunk/matplotlib/src/_image.h
trunk/matplotlib/src/_path.cpp
trunk/matplotlib/src/agg_py_path_iterator.h
trunk/matplotlib/src/agg_py_transforms.h
trunk/matplotlib/src/ft2font.cpp
trunk/matplotlib/src/numerix.h
trunk/matplotlib/src/path_converters.h
Added Paths:
-----------
trunk/matplotlib/src/agg_py_transforms.cpp
trunk/matplotlib/src/path_cleanup.cpp
trunk/matplotlib/src/path_cleanup.h
Modified: trunk/matplotlib/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp
===================================================================
--- trunk/matplotlib/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp 2009-02-02 16:29:37 UTC (rev 6865)
@@ -12,9 +12,9 @@
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
-/*
- * This code was originally written by Stephan Fortune in C code. Shane O'Sullivan,
- * have since modified it, encapsulating it in a C++ class and, fixing memory leaks and
+/*
+ * This code was originally written by Stephan Fortune in C code. Shane O'Sullivan,
+ * have since modified it, encapsulating it in a C++ class and, fixing memory leaks and
* adding accessors to the Voronoi Edges.
* Permission to use, copy, modify, and distribute this software for any
* purpose without fee is hereby granted, provided that this entire notice
@@ -26,13 +26,17 @@
* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
*/
-
+
/*
* Subsequently, Robert Kern modified it to yield Python objects.
* Copyright 2005 Robert Kern <rob...@gm...>
* See LICENSE.txt in the scipy source directory.
*/
+#include <Python.h>
+#define NO_IMPORT_ARRAY
+#include "numpy/arrayobject.h"
+
#include "VoronoiDiagramGenerator.h"
VoronoiDiagramGenerator::VoronoiDiagramGenerator()
@@ -74,9 +78,9 @@
nsites=numPoints;
plot = 0;
- triangulate = 0;
+ triangulate = 0;
debug = 1;
- sorted = 0;
+ sorted = 0;
freeinit(&sfl, sizeof (Site));
sites = (struct Site *) myalloc(nsites*sizeof( *sites));
@@ -108,9 +112,9 @@
//printf("\n%f %f\n",xValues[i],yValues[i]);
}
-
+
qsort(sites, nsites, sizeof (*sites), scomp);
-
+
siteidx = 0;
geominit();
double temp = 0;
@@ -130,9 +134,9 @@
borderMinY = minY;
borderMaxX = maxX;
borderMaxY = maxY;
-
- siteidx = 0;
+ siteidx = 0;
+
voronoi(triangulate);
return true;
@@ -187,25 +191,25 @@
struct Halfedge * VoronoiDiagramGenerator::ELgethash(int b)
{
struct Halfedge *he;
-
- if(b<0 || b>=ELhashsize)
+
+ if(b<0 || b>=ELhashsize)
return((struct Halfedge *) NULL);
- he = ELhash[b];
- if (he == (struct Halfedge *) NULL || he->ELedge != (struct Edge *) DELETED )
+ he = ELhash[b];
+ if (he == (struct Halfedge *) NULL || he->ELedge != (struct Edge *) DELETED )
return (he);
-
+
/* Hash table points to deleted half edge. Patch as necessary. */
ELhash[b] = (struct Halfedge *) NULL;
- if ((he -> ELrefcnt -= 1) == 0)
+ if ((he -> ELrefcnt -= 1) == 0)
makefree((Freenode*)he, &hfl);
return ((struct Halfedge *) NULL);
-}
+}
struct Halfedge * VoronoiDiagramGenerator::ELleftbnd(struct Point *p)
{
int i, bucket;
struct Halfedge *he;
-
+
/* Use hash table to get close to desired halfedge */
bucket = (int)((p->x - xmin)/deltax * ELhashsize); //use the hash function to find the place in the hash map that this HalfEdge should be
@@ -214,12 +218,12 @@
he = ELgethash(bucket);
if(he == (struct Halfedge *) NULL) //if the HE isn't found, search backwards and forwards in the hash map for the first non-null entry
- {
+ {
for(i=1; 1 ; i += 1)
- {
- if ((he=ELgethash(bucket-i)) != (struct Halfedge *) NULL)
+ {
+ if ((he=ELgethash(bucket-i)) != (struct Halfedge *) NULL)
break;
- if ((he=ELgethash(bucket+i)) != (struct Halfedge *) NULL)
+ if ((he=ELgethash(bucket+i)) != (struct Halfedge *) NULL)
break;
};
totalsearch += i;
@@ -228,22 +232,22 @@
/* Now search linear list of halfedges for the correct one */
if (he==ELleftend || (he != ELrightend && right_of(he,p)))
{
- do
+ do
{
he = he -> ELright;
} while (he!=ELrightend && right_of(he,p)); //keep going right on the list until either the end is reached, or you find the 1st edge which the point
he = he -> ELleft; //isn't to the right of
}
else //if the point is to the left of the HalfEdge, then search left for the HE just to the left of the point
- do
+ do
{
he = he -> ELleft;
} while (he!=ELleftend && !right_of(he,p));
-
+
/* Update hash table and reference counts */
if(bucket > 0 && bucket <ELhashsize-1)
- {
- if(ELhash[bucket] != (struct Halfedge *) NULL)
+ {
+ if(ELhash[bucket] != (struct Halfedge *) NULL)
{
ELhash[bucket] -> ELrefcnt -= 1;
}
@@ -277,9 +281,9 @@
struct Site * VoronoiDiagramGenerator::leftreg(struct Halfedge *he)
{
- if(he -> ELedge == (struct Edge *)NULL)
+ if(he -> ELedge == (struct Edge *)NULL)
return(bottomsite);
- return( he -> ELpm == le ?
+ return( he -> ELpm == le ?
he -> ELedge -> reg[le] : he -> ELedge -> reg[re]);
}
@@ -293,7 +297,7 @@
}
void VoronoiDiagramGenerator::geominit()
-{
+{
double sn;
freeinit(&efl, sizeof(Edge));
@@ -309,17 +313,17 @@
struct Edge * VoronoiDiagramGenerator::bisect(struct Site *s1, struct Site *s2)
{
double dx,dy,adx,ady;
- struct Edge *newedge;
+ struct Edge *newedge;
newedge = (struct Edge *) getfree(&efl);
-
+
newedge -> reg[0] = s1; //store the sites that this edge is bisecting
newedge -> reg[1] = s2;
- ref(s1);
+ ref(s1);
ref(s2);
newedge -> ep[0] = (struct Site *) NULL; //to begin with, there are no endpoints on the bisector - it goes to infinity
newedge -> ep[1] = (struct Site *) NULL;
-
+
dx = s2->coord.x - s1->coord.x; //get the difference in x dist between the sites
dy = s2->coord.y - s1->coord.y;
adx = dx>0 ? dx : -dx; //make sure that the difference in positive
@@ -327,18 +331,18 @@
newedge -> c = (double)(s1->coord.x * dx + s1->coord.y * dy + (dx*dx + dy*dy)*0.5);//get the slope of the line
if (adx>ady)
- {
+ {
newedge -> a = 1.0; newedge -> b = dy/dx; newedge -> c /= dx;//set formula of line, with x fixed to 1
}
else
- {
+ {
newedge -> b = 1.0; newedge -> a = dx/dy; newedge -> c /= dy;//set formula of line, with y fixed to 1
};
-
+
newedge -> edgenbr = nedges;
//printf("\nbisect(%d) ((%f,%f) and (%f,%f)",nedges,s1->coord.x,s1->coord.y,s2->coord.x,s2->coord.y);
-
+
nedges += 1;
return(newedge);
}
@@ -351,40 +355,40 @@
double d, xint, yint;
int right_of_site;
struct Site *v;
-
+
e1 = el1 -> ELedge;
e2 = el2 -> ELedge;
- if(e1 == (struct Edge*)NULL || e2 == (struct Edge*)NULL)
+ if(e1 == (struct Edge*)NULL || e2 == (struct Edge*)NULL)
return ((struct Site *) NULL);
//if the two edges bisect the same parent, return null
- if (e1->reg[1] == e2->reg[1])
+ if (e1->reg[1] == e2->reg[1])
return ((struct Site *) NULL);
-
+
d = e1->a * e2->b - e1->b * e2->a;
- if (-1.0e-10<d && d<1.0e-10)
+ if (-1.0e-10<d && d<1.0e-10)
return ((struct Site *) NULL);
-
+
xint = (e1->c*e2->b - e2->c*e1->b)/d;
yint = (e2->c*e1->a - e1->c*e2->a)/d;
-
+
if( (e1->reg[1]->coord.y < e2->reg[1]->coord.y) ||
(e1->reg[1]->coord.y == e2->reg[1]->coord.y &&
e1->reg[1]->coord.x < e2->reg[1]->coord.x) )
- {
- el = el1;
+ {
+ el = el1;
e = e1;
}
else
- {
- el = el2;
+ {
+ el = el2;
e = e2;
};
-
+
right_of_site = xint >= e -> reg[1] -> coord.x;
- if ((right_of_site && el -> ELpm == le) || (!right_of_site && el -> ELpm == re))
+ if ((right_of_site && el -> ELpm == le) || (!right_of_site && el -> ELpm == re))
return ((struct Site *) NULL);
-
+
//create a new site at the point of intersection - this is a new vector event waiting to happen
v = (struct Site *) getfree(&sfl);
v -> refcnt = 0;
@@ -400,22 +404,22 @@
struct Site *topsite;
int right_of_site, above, fast;
double dxp, dyp, dxs, t1, t2, t3, yl;
-
+
e = el -> ELedge;
topsite = e -> reg[1];
right_of_site = p -> x > topsite -> coord.x;
if(right_of_site && el -> ELpm == le) return(1);
if(!right_of_site && el -> ELpm == re) return (0);
-
+
if (e->a == 1.0)
{ dyp = p->y - topsite->coord.y;
dxp = p->x - topsite->coord.x;
fast = 0;
if ((!right_of_site & (e->b<0.0)) | (right_of_site & (e->b>=0.0)) )
- { above = dyp>= e->b*dxp;
+ { above = dyp>= e->b*dxp;
fast = above;
}
- else
+ else
{ above = p->x + p->y*e->b > e-> c;
if(e->b<0.0) above = !above;
if (!above) fast = 1;
@@ -442,7 +446,7 @@
{
e -> ep[lr] = s;
ref(s);
- if(e -> ep[re-lr]== (struct Site *) NULL)
+ if(e -> ep[re-lr]== (struct Site *) NULL)
return;
clip_line(e);
@@ -473,7 +477,7 @@
void VoronoiDiagramGenerator::deref(struct Site *v)
{
v -> refcnt -= 1;
- if (v -> refcnt == 0 )
+ if (v -> refcnt == 0 )
makefree((Freenode*)v, &sfl);
}
@@ -486,7 +490,7 @@
void VoronoiDiagramGenerator::PQinsert(struct Halfedge *he,struct Site * v, double offset)
{
struct Halfedge *last, *next;
-
+
he -> vertex = v;
ref(v);
he -> ystar = (double)(v -> coord.y + offset);
@@ -494,23 +498,23 @@
while ((next = last -> PQnext) != (struct Halfedge *) NULL &&
(he -> ystar > next -> ystar ||
(he -> ystar == next -> ystar && v -> coord.x > next->vertex->coord.x)))
- {
+ {
last = next;
};
- he -> PQnext = last -> PQnext;
+ he -> PQnext = last -> PQnext;
last -> PQnext = he;
PQcount += 1;
}
-//remove the HalfEdge from the list of vertices
+//remove the HalfEdge from the list of vertices
void VoronoiDiagramGenerator::PQdelete(struct Halfedge *he)
{
struct Halfedge *last;
-
+
if(he -> vertex != (struct Site *) NULL)
- {
+ {
last = &PQhash[PQbucket(he)];
- while (last -> PQnext != he)
+ while (last -> PQnext != he)
last = last -> PQnext;
last -> PQnext = he -> PQnext;
@@ -523,7 +527,7 @@
int VoronoiDiagramGenerator::PQbucket(struct Halfedge *he)
{
int bucket;
-
+
bucket = (int)((he->ystar - ymin)/deltay * PQhashsize);
if (bucket<0) bucket = 0;
if (bucket>=PQhashsize) bucket = PQhashsize-1 ;
@@ -542,7 +546,7 @@
struct Point VoronoiDiagramGenerator::PQ_min()
{
struct Point answer;
-
+
while(PQhash[PQmin].PQnext == (struct Halfedge *)NULL) {PQmin += 1;};
answer.x = PQhash[PQmin].PQnext -> vertex -> coord.x;
answer.y = PQhash[PQmin].PQnext -> ystar;
@@ -552,7 +556,7 @@
struct Halfedge * VoronoiDiagramGenerator::PQextractmin()
{
struct Halfedge *curr;
-
+
curr = PQhash[PQmin].PQnext;
PQhash[PQmin].PQnext = curr -> PQnext;
PQcount -= 1;
@@ -562,8 +566,8 @@
bool VoronoiDiagramGenerator::PQinitialize()
{
- int i;
-
+ int i;
+
PQcount = 0;
PQmin = 0;
PQhashsize = 4 * sqrt_nsites;
@@ -586,23 +590,23 @@
char * VoronoiDiagramGenerator::getfree(struct Freelist *fl)
{
- int i;
+ int i;
struct Freenode *t;
if(fl->head == (struct Freenode *) NULL)
- {
+ {
t = (struct Freenode *) myalloc(sqrt_nsites * fl->nodesize);
if(t == 0)
return 0;
-
+
currentMemoryBlock->next = new FreeNodeArrayList;
currentMemoryBlock = currentMemoryBlock->next;
currentMemoryBlock->memory = t;
currentMemoryBlock->next = 0;
- for(i=0; i<sqrt_nsites; i+=1)
- makefree((struct Freenode *)((char *)t+i*fl->nodesize), fl);
+ for(i=0; i<sqrt_nsites; i+=1)
+ makefree((struct Freenode *)((char *)t+i*fl->nodesize), fl);
};
t = fl -> head;
fl -> head = (fl -> head) -> nextfree;
@@ -721,7 +725,7 @@
char * VoronoiDiagramGenerator::myalloc(unsigned n)
{
- char *t=0;
+ char *t=0;
t=(char*)malloc(n);
total_alloc += n;
return(t);
@@ -732,7 +736,7 @@
/* #include <plot.h> */
void VoronoiDiagramGenerator::openpl(){}
void VoronoiDiagramGenerator::line(double x1, double y1, double x2, double y2)
-{
+{
pushGraphEdge(x1,y1,x2,y2);
}
@@ -743,20 +747,20 @@
void VoronoiDiagramGenerator::out_bisector(struct Edge *e)
{
-
+
}
void VoronoiDiagramGenerator::out_ep(struct Edge *e)
{
-
-
+
+
}
void VoronoiDiagramGenerator::out_vertex(struct Site *v)
{
-
+
}
@@ -764,13 +768,13 @@
{
if(!triangulate & plot & !debug)
circle (s->coord.x, s->coord.y, cradius);
-
+
}
void VoronoiDiagramGenerator::out_triple(struct Site *s1, struct Site *s2,struct Site * s3)
{
-
+
}
@@ -778,7 +782,7 @@
void VoronoiDiagramGenerator::plotinit()
{
// double dx,dy,d;
-//
+//
// dy = ymax - ymin;
// dx = xmax - xmin;
// d = (double)(( dx > dy ? dx : dy) * 1.1);
@@ -804,7 +808,7 @@
// y1 = e->reg[0]->coord.y;
// y2 = e->reg[1]->coord.y;
//
-// //if the distance between the two points this line was created from is less than
+// //if the distance between the two points this line was created from is less than
// //the square root of 2, then ignore it
// if(sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))) < minDistanceBetweenSites)
// {
@@ -816,16 +820,16 @@
// pymax = borderMaxY;
//
// if(e -> a == 1.0 && e ->b >= 0.0)
-// {
+// {
// s1 = e -> ep[1];
// s2 = e -> ep[0];
// }
-// else
+// else
// {
// s1 = e -> ep[0];
// s2 = e -> ep[1];
// };
-//
+//
// if(e -> a == 1.0)
// {
// y1 = pymin;
@@ -833,7 +837,7 @@
// {
// y1 = s1->coord.y;
// }
-// if(y1>pymax)
+// if(y1>pymax)
// {
// // printf("\nClipped (1) y1 = %f to %f",y1,pymax);
// y1 = pymax;
@@ -841,17 +845,17 @@
// }
// x1 = e -> c - e -> b * y1;
// y2 = pymax;
-// if (s2!=(struct Site *)NULL && s2->coord.y < pymax)
+// if (s2!=(struct Site *)NULL && s2->coord.y < pymax)
// y2 = s2->coord.y;
//
-// if(y2<pymin)
+// if(y2<pymin)
// {
// //printf("\nClipped (2) y2 = %f to %f",y2,pymin);
// y2 = pymin;
// //return;
// }
// x2 = (e->c) - (e->b) * y2;
-// if (((x1> pxmax) & (x2>pxmax)) | ((x1<pxmin)&(x2<pxmin)))
+// if (((x1> pxmax) & (x2>pxmax)) | ((x1<pxmin)&(x2<pxmin)))
// {
// //printf("\nClipLine jumping out(3), x1 = %f, pxmin = %f, pxmax = %f",x1,pxmin,pxmax);
// return;
@@ -868,9 +872,9 @@
// else
// {
// x1 = pxmin;
-// if (s1!=(struct Site *)NULL && s1->coord.x > pxmin)
+// if (s1!=(struct Site *)NULL && s1->coord.x > pxmin)
// x1 = s1->coord.x;
-// if(x1>pxmax)
+// if(x1>pxmax)
// {
// //printf("\nClipped (3) x1 = %f to %f",x1,pxmin);
// //return;
@@ -878,16 +882,16 @@
// }
// y1 = e -> c - e -> a * x1;
// x2 = pxmax;
-// if (s2!=(struct Site *)NULL && s2->coord.x < pxmax)
+// if (s2!=(struct Site *)NULL && s2->coord.x < pxmax)
// x2 = s2->coord.x;
-// if(x2<pxmin)
+// if(x2<pxmin)
// {
// //printf("\nClipped (4) x2 = %f to %f",x2,pxmin);
// //return;
// x2 = pxmin;
// }
// y2 = e -> c - e -> a * x2;
-// if (((y1> pymax) & (y2>pymax)) | ((y1<pymin)&(y2<pymin)))
+// if (((y1> pymax) & (y2>pymax)) | ((y1<pymin)&(y2<pymin)))
// {
// //printf("\nClipLine jumping out(6), y1 = %f, pymin = %f, pymax = %f",y2,pymin,pymax);
// return;
@@ -901,7 +905,7 @@
// if(y2<pymin)
// { y2 = pymin; x2 = (e -> c - y2)/e -> a;};
// };
-//
+//
// //printf("\nPushing line (%f,%f,%f,%f)",x1,y1,x2,y2);
// line(x1,y1,x2,y2);
}
@@ -920,7 +924,7 @@
int pm;
struct Halfedge *lbnd, *rbnd, *llbnd, *rrbnd, *bisector;
struct Edge *e;
-
+
PQinitialize();
bottomsite = nextone();
out_site(bottomsite);
@@ -928,16 +932,16 @@
if(!retval)
return false;
-
+
newsite = nextone();
while(1)
{
- if(!PQempty())
+ if(!PQempty())
newintstar = PQ_min();
-
+
//if the lowest site has a smaller y value than the lowest vector intersection, process the site
- //otherwise process the vector intersection
+ //otherwise process the vector intersection
if (newsite != (struct Site *)NULL && (PQempty() || newsite -> coord.y < newintstar.y
|| (newsite->coord.y == newintstar.y && newsite->coord.x < newintstar.x)))
@@ -946,31 +950,31 @@
lbnd = ELleftbnd(&(newsite->coord)); //get the first HalfEdge to the LEFT of the new site
rbnd = ELright(lbnd); //get the first HalfEdge to the RIGHT of the new site
bot = rightreg(lbnd); //if this halfedge has no edge, , bot = bottom site (whatever that is)
- e = bisect(bot, newsite); //create a new edge that bisects
- bisector = HEcreate(e, le); //create a new HalfEdge, setting its ELpm field to 0
- ELinsert(lbnd, bisector); //insert this new bisector edge between the left and right vectors in a linked list
+ e = bisect(bot, newsite); //create a new edge that bisects
+ bisector = HEcreate(e, le); //create a new HalfEdge, setting its ELpm field to 0
+ ELinsert(lbnd, bisector); //insert this new bisector edge between the left and right vectors in a linked list
if ((p = intersect(lbnd, bisector)) != (struct Site *) NULL) //if the new bisector intersects with the left edge, remove the left edge's vertex, and put in the new one
- {
+ {
PQdelete(lbnd);
PQinsert(lbnd, p, dist(p,newsite));
};
- lbnd = bisector;
+ lbnd = bisector;
bisector = HEcreate(e, re); //create a new HalfEdge, setting its ELpm field to 1
ELinsert(lbnd, bisector); //insert the new HE to the right of the original bisector earlier in the IF stmt
if ((p = intersect(bisector, rbnd)) != (struct Site *) NULL) //if this new bisector intersects with the
- {
+ {
PQinsert(bisector, p, dist(p,newsite)); //push the HE into the ordered linked list of vertices
};
- newsite = nextone();
+ newsite = nextone();
}
- else if (!PQempty()) /* intersection is smallest - this is a vector event */
- {
- lbnd = PQextractmin(); //pop the HalfEdge with the lowest vector off the ordered list of vectors
+ else if (!PQempty()) /* intersection is smallest - this is a vector event */
+ {
+ lbnd = PQextractmin(); //pop the HalfEdge with the lowest vector off the ordered list of vectors
llbnd = ELleft(lbnd); //get the HalfEdge to the left of the above HE
rbnd = ELright(lbnd); //get the HalfEdge to the right of the above HE
- rrbnd = ELright(rbnd); //get the HalfEdge to the right of the HE to the right of the lowest HE
+ rrbnd = ELright(rbnd); //get the HalfEdge to the right of the HE to the right of the lowest HE
bot = leftreg(lbnd); //get the Site to the left of the left HE which it bisects
top = rightreg(rbnd); //get the Site to the right of the right HE which it bisects
@@ -980,16 +984,16 @@
makevertex(v); //set the vertex number - couldn't do this earlier since we didn't know when it would be processed
endpoint(lbnd->ELedge,lbnd->ELpm,v); //set the endpoint of the left HalfEdge to be this vector
endpoint(rbnd->ELedge,rbnd->ELpm,v); //set the endpoint of the right HalfEdge to be this vector
- ELdelete(lbnd); //mark the lowest HE for deletion - can't delete yet because there might be pointers to it in Hash Map
+ ELdelete(lbnd); //mark the lowest HE for deletion - can't delete yet because there might be pointers to it in Hash Map
PQdelete(rbnd); //remove all vertex events to do with the right HE
- ELdelete(rbnd); //mark the right HE for deletion - can't delete yet because there might be pointers to it in Hash Map
+ ELdelete(rbnd); //mark the right HE for deletion - can't delete yet because there might be pointers to it in Hash Map
pm = le; //set the pm variable to zero
-
+
if (bot->coord.y > top->coord.y) //if the site to the left of the event is higher than the Site
{ //to the right of it, then swap them and set the 'pm' variable to 1
- temp = bot;
- bot = top;
- top = temp;
+ temp = bot;
+ bot = top;
+ top = temp;
pm = re;
}
e = bisect(bot, top); //create an Edge (or line) that is between the two Sites. This creates
@@ -1001,27 +1005,27 @@
//Site, then this endpoint is put in position 0; otherwise in pos 1
deref(v); //delete the vector 'v'
- //if left HE and the new bisector don't intersect, then delete the left HE, and reinsert it
+ //if left HE and the new bisector don't intersect, then delete the left HE, and reinsert it
if((p = intersect(llbnd, bisector)) != (struct Site *) NULL)
- {
+ {
PQdelete(llbnd);
PQinsert(llbnd, p, dist(p,bot));
};
- //if right HE and the new bisector don't intersect, then reinsert it
+ //if right HE and the new bisector don't intersect, then reinsert it
if ((p = intersect(bisector, rrbnd)) != (struct Site *) NULL)
- {
+ {
PQinsert(bisector, p, dist(p,bot));
};
}
else break;
};
-
+
for(lbnd=ELright(ELleftend); lbnd != ELrightend; lbnd=ELright(lbnd))
- {
+ {
e = lbnd -> ELedge;
clip_line(e);
@@ -1031,7 +1035,7 @@
cleanup();
return true;
-
+
}
@@ -1050,16 +1054,16 @@
{
struct Site *s;
if(siteidx < nsites)
- {
+ {
s = &sites[siteidx];
siteidx += 1;
return(s);
}
- else
+ else
return( (struct Site *)NULL);
}
-bool VoronoiDiagramGenerator::getNextDelaunay(int& ep0, double& ep0x, double& ep0y,
+bool VoronoiDiagramGenerator::getNextDelaunay(int& ep0, double& ep0x, double& ep0y,
int& ep1, double& ep1x, double& ep1y,
int& reg0, int& reg1)
{
@@ -1076,7 +1080,7 @@
reg1 = iterEdgeList->reg1nbr;
iterEdgeList = iterEdgeList->next;
-
+
return true;
}
Modified: trunk/matplotlib/setupext.py
===================================================================
--- trunk/matplotlib/setupext.py 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/setupext.py 2009-02-02 16:29:37 UTC (rev 6865)
@@ -1079,7 +1079,8 @@
deps.extend(glob.glob('CXX/*.cxx'))
deps.extend(glob.glob('CXX/*.c'))
- module = Extension('matplotlib.ft2font', deps)
+ module = Extension('matplotlib.ft2font', deps,
+ define_macros=[('PY_ARRAYAUNIQUE_SYMBOL', 'MPL_ARRAY_API')])
add_ft2font_flags(module)
ext_modules.append(module)
BUILT_FT2FONT = True
@@ -1100,12 +1101,13 @@
def build_gtkagg(ext_modules, packages):
global BUILT_GTKAGG
if BUILT_GTKAGG: return # only build it if you you haven't already
- deps = ['src/_gtkagg.cpp', 'src/mplutils.cpp']#, 'src/_transforms.cpp']
+ deps = ['src/agg_py_transforms.cpp', 'src/_gtkagg.cpp', 'src/mplutils.cpp']
deps.extend(glob.glob('CXX/*.cxx'))
deps.extend(glob.glob('CXX/*.c'))
module = Extension('matplotlib.backends._gtkagg',
deps,
+ define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')]
)
# add agg flags before pygtk because agg only supports freetype1
@@ -1164,6 +1166,7 @@
module = Extension('matplotlib.backends._macosx',
['src/_macosx.m'],
extra_link_args = ['-framework','Cocoa'],
+ define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')]
)
add_numpy_flags(module)
ext_modules.append(module)
@@ -1182,6 +1185,7 @@
'matplotlib._png',
deps,
include_dirs=numpy_inc_dirs,
+ define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')]
)
add_png_flags(module)
@@ -1194,7 +1198,6 @@
global BUILT_AGG
if BUILT_AGG: return # only build it if you you haven't already
-
agg = (
'agg_trans_affine.cpp',
'agg_bezier_arc.cpp',
@@ -1204,22 +1207,20 @@
'agg_image_filters.cpp',
)
-
deps = ['%s/src/%s'%(AGG_VERSION, name) for name in agg]
- deps.extend(('src/_image.cpp', 'src/ft2font.cpp', 'src/mplutils.cpp'))
+ deps.extend(['src/mplutils.cpp', 'src/agg_py_transforms.cpp'])
deps.extend(glob.glob('CXX/*.cxx'))
deps.extend(glob.glob('CXX/*.c'))
-
temp_copy('src/_backend_agg.cpp', 'src/backend_agg.cpp')
deps.append('src/backend_agg.cpp')
module = Extension(
'matplotlib.backends._backend_agg',
deps,
include_dirs=numpy_inc_dirs,
+ define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')]
)
add_numpy_flags(module)
-
add_agg_flags(module)
add_ft2font_flags(module)
ext_modules.append(module)
@@ -1242,11 +1243,14 @@
deps.extend(glob.glob('CXX/*.c'))
temp_copy('src/_path.cpp', 'src/path.cpp')
- deps.extend(['src/path.cpp'])
+ deps.extend(['src/agg_py_transforms.cpp',
+ 'src/path_cleanup.cpp',
+ 'src/path.cpp'])
module = Extension(
'matplotlib._path',
deps,
include_dirs=numpy_inc_dirs,
+ define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')]
)
add_numpy_flags(module)
@@ -1275,6 +1279,7 @@
'matplotlib._image',
deps,
include_dirs=numpy_inc_dirs,
+ define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')]
)
add_numpy_flags(module)
@@ -1294,7 +1299,9 @@
"delaunay_utils.cpp", "natneighbors.cpp"]
sourcefiles = [os.path.join('lib/matplotlib/delaunay',s) for s in sourcefiles]
delaunay = Extension('matplotlib._delaunay',sourcefiles,
- include_dirs=numpy_inc_dirs)
+ include_dirs=numpy_inc_dirs,
+ define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')]
+ )
add_numpy_flags(delaunay)
add_base_flags(delaunay)
ext_modules.append(delaunay)
@@ -1310,6 +1317,7 @@
'matplotlib._cntr',
[ 'src/cntr.c'],
include_dirs=numpy_inc_dirs,
+ define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')]
)
add_numpy_flags(module)
add_base_flags(module)
@@ -1325,6 +1333,7 @@
'matplotlib.nxutils',
[ 'src/nxutils.c'],
include_dirs=numpy_inc_dirs,
+ define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')]
)
add_numpy_flags(module)
add_base_flags(module)
@@ -1343,6 +1352,7 @@
['src/backend_gdk.c'],
libraries = [],
include_dirs=numpy_inc_dirs,
+ define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')]
)
add_numpy_flags(module)
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/src/_backend_agg.cpp 2009-02-02 16:29:37 UTC (rev 6865)
@@ -37,7 +37,6 @@
#include "swig_runtime.h"
#include "MPL_isnan.h"
-#define PY_ARRAY_TYPES_PREFIX NumPy
#include "numpy/arrayobject.h"
#include "agg_py_transforms.h"
@@ -253,7 +252,7 @@
Py::Tuple path_and_transform = method.apply(Py::Tuple());
if (path_and_transform[0].ptr() != Py_None) {
clippath = path_and_transform[0];
- clippath_trans = py_to_agg_transformation_matrix(path_and_transform[1]);
+ clippath_trans = py_to_agg_transformation_matrix(path_and_transform[1].ptr());
}
}
@@ -471,9 +470,9 @@
Py::Object gc_obj = args[0];
Py::Object marker_path_obj = args[1];
- agg::trans_affine marker_trans = py_to_agg_transformation_matrix(args[2]);
+ agg::trans_affine marker_trans = py_to_agg_transformation_matrix(args[2].ptr());
Py::Object path_obj = args[3];
- agg::trans_affine trans = py_to_agg_transformation_matrix(args[4]);
+ agg::trans_affine trans = py_to_agg_transformation_matrix(args[4].ptr());
Py::Object face_obj;
if (args.size() == 6)
face_obj = args[5];
@@ -748,7 +747,7 @@
rendererBase.reset_clipping(true);
if (args.size() == 6) {
clippath = args[4];
- clippath_trans = py_to_agg_transformation_matrix(args[5], false);
+ clippath_trans = py_to_agg_transformation_matrix(args[5].ptr(), false);
has_clippath = render_clippath(clippath, clippath_trans);
}
@@ -963,7 +962,7 @@
Py::Object gc_obj = args[0];
Py::Object path_obj = args[1];
- agg::trans_affine trans = py_to_agg_transformation_matrix(args[2]);
+ agg::trans_affine trans = py_to_agg_transformation_matrix(args[2].ptr());
Py::Object face_obj;
if (args.size() == 4)
face_obj = args[3];
@@ -1071,7 +1070,7 @@
transforms.reserve(Ntransforms);
for (i = 0; i < Ntransforms; ++i) {
agg::trans_affine trans = py_to_agg_transformation_matrix
- (transforms_obj[i], false);
+ (transforms_obj[i].ptr(), false);
trans *= master_transform;
transforms.push_back(trans);
@@ -1212,14 +1211,14 @@
args.verify_length(14);
//segments, trans, clipbox, colors, linewidths, antialiaseds
- agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0]);
+ agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0].ptr());
Py::Object cliprect = args[1];
Py::Object clippath = args[2];
- agg::trans_affine clippath_trans = py_to_agg_transformation_matrix(args[3], false);
+ agg::trans_affine clippath_trans = py_to_agg_transformation_matrix(args[3].ptr(), false);
Py::SeqBase<Py::Object> paths = args[4];
Py::SeqBase<Py::Object> transforms_obj = args[5];
Py::Object offsets_obj = args[6];
- agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7]);
+ agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7].ptr());
Py::Object facecolors_obj = args[8];
Py::Object edgecolors_obj = args[9];
Py::SeqBase<Py::Float> linewidths = args[10];
@@ -1328,15 +1327,15 @@
//segments, trans, clipbox, colors, linewidths, antialiaseds
- agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0]);
+ agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0].ptr());
Py::Object cliprect = args[1];
Py::Object clippath = args[2];
- agg::trans_affine clippath_trans = py_to_agg_transformation_matrix(args[3], false);
+ agg::trans_affine clippath_trans = py_to_agg_transformation_matrix(args[3].ptr(), false);
size_t mesh_width = Py::Int(args[4]);
size_t mesh_height = Py::Int(args[5]);
PyObject* coordinates = args[6].ptr();
Py::Object offsets_obj = args[7];
- agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[8]);
+ agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[8].ptr());
Py::Object facecolors_obj = args[9];
bool antialiased = (bool)Py::Int(args[10]);
bool showedges = (bool)Py::Int(args[11]);
Modified: trunk/matplotlib/src/_backend_gdk.c
===================================================================
--- trunk/matplotlib/src/_backend_gdk.c 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/src/_backend_gdk.c 2009-02-02 16:29:37 UTC (rev 6865)
@@ -3,7 +3,6 @@
*/
#include "Python.h"
-#define PY_ARRAY_TYPES_PREFIX NumPy
#include "numpy/arrayobject.h"
#include <pygtk/pygtk.h>
Modified: trunk/matplotlib/src/_gtkagg.cpp
===================================================================
--- trunk/matplotlib/src/_gtkagg.cpp 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/src/_gtkagg.cpp 2009-02-02 16:29:37 UTC (rev 6865)
@@ -10,9 +10,8 @@
#include <fstream>
#include "agg_basics.h"
-#include "_backend_agg.h"
-#define PY_ARRAY_TYPES_PREFIX NumPy
#include "numpy/arrayobject.h"
+#include "_backend_agg.h"
#include "agg_py_transforms.h"
// the extension module
Modified: trunk/matplotlib/src/_image.cpp
===================================================================
--- trunk/matplotlib/src/_image.cpp 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/src/_image.cpp 2009-02-02 16:29:37 UTC (rev 6865)
@@ -11,7 +11,6 @@
#include <cmath>
#include <cstdio>
-#define PY_ARRAY_TYPES_PREFIX NumPy
#include "numpy/arrayobject.h"
#include "agg_color_rgba.h"
@@ -98,18 +97,7 @@
"\n"
"Flip the output image upside down"
;
-Py::Object
-Image::flipud_out(const Py::Tuple& args) {
- _VERBOSE("Image::flipud_out");
- args.verify_length(0);
- int stride = rbufOut->stride();
- //std::cout << "flip before: " << rbufOut->stride() << std::endl;
- rbufOut->attach(bufferOut, colsOut, rowsOut, -stride);
- //std::cout << "flip after: " << rbufOut->stride() << std::endl;
- return Py::Object();
-}
-
char Image::flipud_in__doc__[] =
"flipud()\n"
"\n"
@@ -1756,8 +1744,6 @@
d["ASPECT_FREE"] = Py::Int(Image::ASPECT_FREE);
d["ASPECT_PRESERVE"] = Py::Int(Image::ASPECT_PRESERVE);
-
-
}
Modified: trunk/matplotlib/src/_image.h
===================================================================
--- trunk/matplotlib/src/_image.h 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/src/_image.h 2009-02-02 16:29:37 UTC (rev 6865)
@@ -39,7 +39,15 @@
Py::Object set_interpolation(const Py::Tuple& args);
Py::Object set_aspect(const Py::Tuple& args);
Py::Object set_bg(const Py::Tuple& args);
- Py::Object flipud_out(const Py::Tuple& args);
+ inline Py::Object flipud_out(const Py::Tuple& args) {
+ args.verify_length(0);
+ int stride = rbufOut->stride();
+ //std::cout << "flip before: " << rbufOut->stride() << std::endl;
+ rbufOut->attach(bufferOut, colsOut, rowsOut, -stride);
+ //std::cout << "flip after: " << rbufOut->stride() << std::endl;
+ return Py::Object();
+ }
+
Py::Object flipud_in(const Py::Tuple& args);
Py::Object set_resample(const Py::Tuple& args);
Py::Object get_resample(const Py::Tuple& args);
Modified: trunk/matplotlib/src/_path.cpp
===================================================================
--- trunk/matplotlib/src/_path.cpp 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/src/_path.cpp 2009-02-02 16:29:37 UTC (rev 6865)
@@ -56,7 +56,10 @@
"convert_path_to_polygons(path, trans, width, height)");
add_varargs_method("cleanup_path", &_path_module::cleanup_path,
"cleanup_path(path, trans, remove_nans, clip, quantize, simplify, curves)");
-
+ /* TEST CODE -- REMOVE LATER */
+ add_varargs_method("cleanup_path_test", &_path_module::cleanup_path_test,
+ "TEST");
+ /* **************************************** */
initialize("Helper functions for paths");
}
@@ -76,6 +79,8 @@
Py::Object path_intersects_path(const Py::Tuple& args);
Py::Object convert_path_to_polygons(const Py::Tuple& args);
Py::Object cleanup_path(const Py::Tuple& args);
+ /* TEST CODE -- REMOVE LATER */
+ Py::Object cleanup_path_test(const Py::Tuple& args);
};
//
@@ -244,7 +249,7 @@
double x = Py::Float(args[0]);
double y = Py::Float(args[1]);
PathIterator path(args[2]);
- agg::trans_affine trans = py_to_agg_transformation_matrix(args[3], false);
+ agg::trans_affine trans = py_to_agg_transformation_matrix(args[3].ptr(), false);
if (::point_in_path(x, y, path, trans))
return Py::Int(1);
@@ -259,7 +264,7 @@
double y = Py::Float(args[1]);
double r = Py::Float(args[2]);
PathIterator path(args[3]);
- agg::trans_affine trans = py_to_agg_transformation_matrix(args[4]);
+ agg::trans_affine trans = py_to_agg_transformation_matrix(args[4].ptr());
if (::point_on_path(x, y, r, path, trans))
return Py::Int(1);
@@ -305,7 +310,7 @@
args.verify_length(2);
PathIterator path(args[0]);
- agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false);
+ agg::trans_affine trans = py_to_agg_transformation_matrix(args[1].ptr(), false);
npy_intp extent_dims[] = { 2, 2, 0 };
double* extents_data = NULL;
@@ -347,7 +352,7 @@
double x0, y0, x1, y1;
PathIterator path(args[0]);
- agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false);
+ agg::trans_affine trans = py_to_agg_transformation_matrix(args[1].ptr(), false);
if (!py_convert_bbox(args[2].ptr(), x0, y0, x1, y1))
{
throw Py::ValueError("Must pass Bbox object as arg 3 of update_path_extents");
@@ -465,11 +470,11 @@
args.verify_length(5);
//segments, trans, clipbox, colors, linewidths, antialiaseds
- agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0]);
+ agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0].ptr());
Py::SeqBase<Py::Object> paths = args[1];
Py::SeqBase<Py::Object> transforms_obj = args[2];
Py::Object offsets_obj = args[3];
- agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[4], false);
+ agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[4].ptr(), false);
PyArrayObject* offsets = NULL;
double x0, y0, x1, y1, xm, ym;
@@ -497,7 +502,7 @@
for (i = 0; i < Ntransforms; ++i)
{
agg::trans_affine trans = py_to_agg_transformation_matrix
- (transforms_obj[i], false);
+ (transforms_obj[i].ptr(), false);
trans *= master_transform;
transforms.push_back(trans);
}
@@ -558,11 +563,11 @@
double x = Py::Float(args[0]);
double y = Py::Float(args[1]);
double radius = Py::Float(args[2]);
- agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[3]);
+ agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[3].ptr());
Py::SeqBase<Py::Object> paths = args[4];
Py::SeqBase<Py::Object> transforms_obj = args[5];
Py::SeqBase<Py::Object> offsets_obj = args[6];
- agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7]);
+ agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7].ptr());
bool filled = Py::Int(args[8]);
PyArrayObject* offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 0, 2);
@@ -586,7 +591,7 @@
for (i = 0; i < Ntransforms; ++i)
{
agg::trans_affine trans = py_to_agg_transformation_matrix
- (transforms_obj[i], false);
+ (transforms_obj[i].ptr(), false);
trans *= master_transform;
transforms.push_back(trans);
}
@@ -658,9 +663,9 @@
args.verify_length(4);
PathIterator a(args[0]);
- agg::trans_affine atrans = py_to_agg_transformation_matrix(args[1], false);
+ agg::trans_affine atrans = py_to_agg_transformation_matrix(args[1].ptr(), false);
PathIterator b(args[2]);
- agg::trans_affine btrans = py_to_agg_transformation_matrix(args[3], false);
+ agg::trans_affine btrans = py_to_agg_transformation_matrix(args[3].ptr(), false);
return Py::Int(::path_in_path(a, atrans, b, btrans));
}
@@ -1153,7 +1158,7 @@
args.verify_length(4);
PathIterator path(args[0]);
- agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false);
+ agg::trans_affine trans = py_to_agg_transformation_matrix(args[1].ptr(), false);
double width = Py::Float(args[2]);
double height = Py::Float(args[3]);
@@ -1256,7 +1261,7 @@
args.verify_length(7);
PathIterator path(args[0]);
- agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false);
+ agg::trans_affine trans = py_to_agg_transformation_matrix(args[1].ptr(), false);
bool remove_nans = args[2].isTrue();
Py::Object clip_obj = args[3];
@@ -1349,6 +1354,39 @@
return result;
}
+/************************************************************/
+/* TEST CODE */
+extern "C" {
+ void* get_path_iterator(
+ PyObject* path, PyObject* trans, int remove_nans, int do_clip,
+ double rect[4], e_quantize_mode quantize_mode, int do_simplify);
+
+ unsigned get_vertex(void* pipeline, double* x, double* y);
+
+ void free_path_iterator(void* pipeline);
+}
+
+Py::Object _path_module::cleanup_path_test(const Py::Tuple& args)
+{
+ args.verify_length(2);
+
+ double rect[] = { 0.0, 0.0, 640.0, 480.0 };
+
+ void* iterator = get_path_iterator(args[0].ptr(), args[1].ptr(), 1, 1, rect, QUANTIZE_AUTO, 1);
+
+ unsigned cmd;
+ double x, y;
+ while ((cmd = get_vertex(iterator, &x, &y)) != 0 /* STOP */) {
+ printf("%f %f %d\n", x, y, cmd);
+ }
+
+ free_path_iterator(iterator);
+
+ return Py::None();
+}
+/* END OF TEST CODE */
+/************************************************************/
+
extern "C"
DL_EXPORT(void)
init_path(void)
Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/src/agg_py_path_iterator.h 2009-02-02 16:29:37 UTC (rev 6865)
@@ -2,7 +2,6 @@
#define __AGG_PY_PATH_ITERATOR_H__
#include "CXX/Objects.hxx"
-#define PY_ARRAY_TYPES_PREFIX NumPy
#include "numpy/arrayobject.h"
#include "agg_path_storage.h"
@@ -39,7 +38,7 @@
public:
/* path_obj is an instance of the class Path as defined in path.py */
- PathIterator(const Py::Object& path_obj) :
+ inline PathIterator(const Py::Object& path_obj) :
m_vertices(NULL), m_codes(NULL), m_iterator(0), m_should_simplify(false),
m_simplify_threshold(1.0 / 9.0)
{
Added: trunk/matplotlib/src/agg_py_transforms.cpp
===================================================================
--- trunk/matplotlib/src/agg_py_transforms.cpp (rev 0)
+++ trunk/matplotlib/src/agg_py_transforms.cpp 2009-02-02 16:29:37 UTC (rev 6865)
@@ -0,0 +1,98 @@
+#include <Python.h>
+
+#define NO_IMPORT_ARRAY
+#include "numpy/arrayobject.h"
+
+#include "CXX/Objects.hxx"
+#include "agg_trans_affine.h"
+
+/** A helper function to convert from a Numpy affine transformation matrix
+ * to an agg::trans_affine.
+ */
+agg::trans_affine
+py_to_agg_transformation_matrix(PyObject* obj, bool errors = true)
+{
+ PyArrayObject* matrix = NULL;
+
+ try
+ {
+ if (obj == Py_None)
+ throw std::exception();
+ matrix = (PyArrayObject*) PyArray_FromObject(obj, PyArray_DOUBLE, 2, 2);
+ if (!matrix)
+ throw std::exception();
+ if (PyArray_NDIM(matrix) == 2 || PyArray_DIM(matrix, 0) == 3 || PyArray_DIM(matrix, 1) == 3)
+ {
+ size_t stride0 = PyArray_STRIDE(matrix, 0);
+ size_t stride1 = PyArray_STRIDE(matrix, 1);
+ char* row0 = PyArray_BYTES(matrix);
+ char* row1 = row0 + stride0;
+
+ double a = *(double*)(row0);
+ row0 += stride1;
+ double c = *(double*)(row0);
+ row0 += stride1;
+ double e = *(double*)(row0);
+
+ double b = *(double*)(row1);
+ row1 += stride1;
+ double d = *(double*)(row1);
+ row1 += stride1;
+ double f = *(double*)(row1);
+
+ Py_XDECREF(matrix);
+
+ return agg::trans_affine(a, b, c, d, e, f);
+ }
+
+ throw std::exception();
+ }
+ catch (...)
+ {
+ if (errors)
+ {
+ Py_XDECREF(matrix);
+ throw Py::TypeError("Invalid affine transformation matrix");
+ }
+ }
+
+ Py_XDECREF(matrix);
+ return agg::trans_affine();
+}
+
+bool
+py_convert_bbox(PyObject* bbox_obj, double& l, double& b, double& r, double& t)
+{
+ PyArrayObject* bbox = NULL;
+
+ if (bbox_obj == Py_None)
+ return false;
+
+ try
+ {
+ bbox = (PyArrayObject*) PyArray_FromObject(bbox_obj, PyArray_DOUBLE, 2, 2);
+
+ if (!bbox || PyArray_NDIM(bbox) != 2 || PyArray_DIM(bbox, 0) != 2 || PyArray_DIM(bbox, 1) != 2)
+ {
+ throw Py::TypeError
+ ("Argument 3 to agg_to_gtk_drawable must be a Bbox object.");
+ }
+
+ l = *(double*)PyArray_GETPTR2(bbox, 0, 0);
+ b = *(double*)PyArray_GETPTR2(bbox, 0, 1);
+ r = *(double*)PyArray_GETPTR2(bbox, 1, 0);
+ t = *(double*)PyArray_GETPTR2(bbox, 1, 1);
+
+ Py_XDECREF(bbox);
+ bbox = NULL;
+ return true;
+ }
+ catch (...)
+ {
+ Py_XDECREF(bbox);
+ bbox = NULL;
+ throw;
+ }
+
+ return false;
+}
Modified: trunk/matplotlib/src/agg_py_transforms.h
===================================================================
--- trunk/matplotlib/src/agg_py_transforms.h 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/src/agg_py_transforms.h 2009-02-02 16:29:37 UTC (rev 6865)
@@ -1,99 +1,15 @@
#ifndef __AGG_PY_TRANSFORMS_H__
#define __AGG_PY_TRANSFORMS_H__
-#define PY_ARRAY_TYPES_PREFIX NumPy
-#include "numpy/arrayobject.h"
-
-#include "CXX/Objects.hxx"
#include "agg_trans_affine.h"
/** A helper function to convert from a Numpy affine transformation matrix
* to an agg::trans_affine.
*/
-agg::trans_affine py_to_agg_transformation_matrix(const Py::Object& obj, bool errors = true)
-{
- PyArrayObject* matrix = NULL;
+agg::trans_affine
+py_to_agg_transformation_matrix(PyObject* obj, bool errors = true);
- try
- {
- if (obj.ptr() == Py_None)
- throw std::exception();
- matrix = (PyArrayObject*) PyArray_FromObject(obj.ptr(), PyArray_DOUBLE, 2, 2);
- if (!matrix)
- throw std::exception();
- if (PyArray_NDIM(matrix) == 2 || PyArray_DIM(matrix, 0) == 3 || PyArray_DIM(matrix, 1) == 3)
- {
- size_t stride0 = PyArray_STRIDE(matrix, 0);
- size_t stride1 = PyArray_STRIDE(matrix, 1);
- char* row0 = PyArray_BYTES(matrix);
- char* row1 = row0 + stride0;
+bool
+py_convert_bbox(PyObject* bbox_obj, double& l, double& b, double& r, double& t);
- double a = *(double*)(row0);
- row0 += stride1;
- double c = *(double*)(row0);
- row0 += stride1;
- double e = *(double*)(row0);
-
- double b = *(double*)(row1);
- row1 += stride1;
- double d = *(double*)(row1);
- row1 += stride1;
- double f = *(double*)(row1);
-
- Py_XDECREF(matrix);
-
- return agg::trans_affine(a, b, c, d, e, f);
- }
-
- throw std::exception();
- }
- catch (...)
- {
- if (errors)
- {
- Py_XDECREF(matrix);
- throw Py::TypeError("Invalid affine transformation matrix");
- }
- }
-
- Py_XDECREF(matrix);
- return agg::trans_affine();
-}
-
-bool py_convert_bbox(PyObject* bbox_obj, double& l, double& b, double& r, double& t)
-{
- PyArrayObject* bbox = NULL;
-
- if (bbox_obj == Py_None)
- return false;
-
- try
- {
- bbox = (PyArrayObject*) PyArray_FromObject(bbox_obj, PyArray_DOUBLE, 2, 2);
-
- if (!bbox || PyArray_NDIM(bbox) != 2 || PyArray_DIM(bbox, 0) != 2 || PyArray_DIM(bbox, 1) != 2)
- {
- throw Py::TypeError
- ("Argument 3 to agg_to_gtk_drawable must be a Bbox object.");
- }
-
- l = *(double*)PyArray_GETPTR2(bbox, 0, 0);
- b = *(double*)PyArray_GETPTR2(bbox, 0, 1);
- r = *(double*)PyArray_GETPTR2(bbox, 1, 0);
- t = *(double*)PyArray_GETPTR2(bbox, 1, 1);
-
- Py_XDECREF(bbox);
- bbox = NULL;
- return true;
- }
- catch (...)
- {
- Py_XDECREF(bbox);
- bbox = NULL;
- throw;
- }
-
- return false;
-}
-
#endif // __AGG_PY_TRANSFORMS_H__
Modified: trunk/matplotlib/src/ft2font.cpp
===================================================================
--- trunk/matplotlib/src/ft2font.cpp 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/src/ft2font.cpp 2009-02-02 16:29:37 UTC (rev 6865)
@@ -2,7 +2,6 @@
#include "mplutils.h"
#include <sstream>
-#define PY_ARRAY_TYPES_PREFIX NumPy
#include "numpy/arrayobject.h"
#define FIXED_MAJOR(val) (*((short *) &val+1))
Modified: trunk/matplotlib/src/numerix.h
===================================================================
--- trunk/matplotlib/src/numerix.h 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/src/numerix.h 2009-02-02 16:29:37 UTC (rev 6865)
@@ -3,7 +3,6 @@
#ifndef _NUMERIX_H
#define _NUMERIX_H
-#define PY_ARRAY_TYPES_PREFIX NumPy
#include "numpy/arrayobject.h"
#if (NDARRAY_VERSION >= 0x00090908)
#include "numpy/oldnumeric.h"
Added: trunk/matplotlib/src/path_cleanup.cpp
===================================================================
--- trunk/matplotlib/src/path_cleanup.cpp (rev 0)
+++ trunk/matplotlib/src/path_cleanup.cpp 2009-02-02 16:29:37 UTC (rev 6865)
@@ -0,0 +1,84 @@
+#include <Python.h>
+#define NO_IMPORT_ARRAY
+#include "numpy/arrayobject.h"
+
+#include "agg_py_path_iterator.h"
+#include "agg_conv_transform.h"
+#include "agg_py_transforms.h"
+#include "path_converters.h"
+
+class PathCleanupIterator {
+ typedef agg::conv_transform<PathIterator> transformed_path_t;
+ typedef PathNanRemover<transformed_path_t> nan_removal_t;
+ typedef PathClipper<nan_removal_t> clipped_t;
+ typedef PathQuantizer<clipped_t> quantized_t;
+ typedef PathSimplifier<quantized_t> simplify_t;
+
+ Py::Object m_path_obj;
+ PathIterator m_path_iter;
+ agg::trans_affine m_transform;
+ transformed_path_t m_transformed;
+ nan_removal_t m_nan_removed;
+ clipped_t m_clipped;
+ quantized_t m_quantized;
+ simplify_t m_simplify;
+
+public:
+ PathCleanupIterator(PyObject* path, agg::trans_affine trans,
+ bool remove_nans, bool do_clip,
+ const agg::rect_base<double>& rect,
+ e_quantize_mode quantize_mode, bool do_simplify) :
+ m_path_obj(path, true),
+ m_path_iter(m_path_obj),
+ m_transform(trans),
+ m_transformed(m_path_iter, m_transform),
+ m_nan_removed(m_transformed, remove_nans, m_path_iter.has_curves()),
+ m_clipped(m_nan_removed, do_clip, rect),
+ m_quantized(m_clipped, quantize_mode, m_path_iter.total_vertices()),
+ m_simplify(m_quantized, do_simplify && m_path_iter.should_simplify(),
+ m_path_iter.simplify_threshold())
+ {
+ Py_INCREF(path);
+ m_path_iter.rewind(0);
+ }
+
+ unsigned vertex(double* x, double* y)
+ {
+ return m_simplify.vertex(x, y);
+ }
+};
+
+extern "C" {
+ void*
+ get_path_iterator(
+ PyObject* path, PyObject* trans, int remove_nans, int do_clip,
+ double rect[4], e_quantize_mode quantize_mode, int do_simplify)
+ {
+ agg::trans_affine agg_trans = py_to_agg_transformation_matrix(trans, false);
+ agg::rect_base<double> clip_rect(rect[0], rect[1], rect[2], rect[3]);
+
+ PathCleanupIterator* pipeline = new PathCleanupIterator(
+ path, agg_trans, remove_nans != 0, do_clip != 0,
+ clip_rect, quantize_mode, do_simplify != 0);
+
+ return (void*)pipeline;
+ }
+
+ unsigned
+ get_vertex(void* pipeline, double* x, double* y)
+ {
+ PathCleanupIterator* pipeline_iter = (PathCleanupIterator*)pipeline;
+
+ unsigned code = pipeline_iter->vertex(x, y);
+ return code;
+ }
+
+ void
+ free_path_iterator(void* pipeline)
+ {
+ PathCleanupIterator* pipeline_iter = (PathCleanupIterator*)pipeline;
+
+ delete pipeline_iter;
+ }
+}
+
Added: trunk/matplotlib/src/path_cleanup.h
===================================================================
--- trunk/matplotlib/src/path_cleanup.h (rev 0)
+++ trunk/matplotlib/src/path_cleanup.h 2009-02-02 16:29:37 UTC (rev 6865)
@@ -0,0 +1,24 @@
+#ifndef PATH_CLEANUP_H
+#define PATH_CLEANUP_H
+
+#include <Python.h>
+
+enum e_quantize_mode
+{
+ QUANTIZE_AUTO,
+ QUANTIZE_FALSE,
+ QUANTIZE_TRUE
+};
+
+void*
+get_path_iterator(
+ PyObject* path, PyObject* trans, int remove_nans, int do_clip,
+ double rect[4], e_quantize_mode quantize_mode, int do_simplify);
+
+unsigned
+get_vertex(void* pipeline, double* x, double* y);
+
+void
+free_path_iterator(void* pipeline);
+
+#endif /* PATH_CLEANUP_H */
Modified: trunk/matplotlib/src/path_converters.h
===================================================================
--- trunk/matplotlib/src/path_converters.h 2009-02-02 16:19:33 UTC (rev 6864)
+++ trunk/matplotlib/src/path_converters.h 2009-02-02 16:29:37 UTC (rev 6865)
@@ -2,7 +2,6 @@
#define __PATH_CONVERTERS_H__
#include "CXX/Objects.hxx"
-#define PY_ARRAY_TYPES_PREFIX NumPy
#include "numpy/arrayobject.h"
#include "agg_path_storage.h"
#include "agg_clip_liang_barsky.h"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <md...@us...> - 2009-02-02 16:19:37
|
Revision: 6864
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6864&view=rev
Author: mdboom
Date: 2009-02-02 16:19:33 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
Fix bug in markevery where markers were being recursively removed.
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/lines.py
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py 2009-02-02 12:42:08 UTC (rev 6863)
+++ trunk/matplotlib/lib/matplotlib/lines.py 2009-02-02 16:19:33 UTC (rev 6864)
@@ -509,12 +509,16 @@
else:
startind, stride = 0, markevery
if tpath.codes is not None:
- tpath.codes = tpath.codes[startind::stride]
- tpath.vertices = tpath.vertices[startind::stride]
+ codes = tpath.codes[startind::stride]
+ else:
+ codes = None
+ vertices = tpath.vertices[startind::stride]
+ subsampled = Path(vertices, codes)
+ else:
+ subsampled = tpath
-
markerFunc = getattr(self, funcname)
- markerFunc(renderer, gc, tpath, affine.frozen())
+ markerFunc(renderer, gc, subsampled, affine.frozen())
renderer.close_group('line2d')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-02-02 12:42:11
|
Revision: 6863
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6863&view=rev
Author: jdh2358
Date: 2009-02-02 12:42:08 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
addplied Fernando's sphinxext patch
Modified Paths:
--------------
trunk/matplotlib/doc/sphinxext/inheritance_diagram.py
trunk/matplotlib/doc/sphinxext/ipython_console_highlighting.py
trunk/matplotlib/doc/sphinxext/mathmpl.py
trunk/matplotlib/doc/sphinxext/only_directives.py
Modified: trunk/matplotlib/doc/sphinxext/inheritance_diagram.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/inheritance_diagram.py 2009-02-02 08:29:18 UTC (rev 6862)
+++ trunk/matplotlib/doc/sphinxext/inheritance_diagram.py 2009-02-02 12:42:08 UTC (rev 6863)
@@ -42,6 +42,17 @@
from docutils.parsers.rst import directives
from sphinx.roles import xfileref_role
+def my_import(name):
+ """Module importer - taken from the python documentation.
+
+ This function allows importing names with dots in them."""
+
+ mod = __import__(name)
+ components = name.split('.')
+ for comp in components[1:]:
+ mod = getattr(mod, comp)
+ return mod
+
class DotException(Exception):
pass
@@ -84,6 +95,13 @@
path = base
try:
module = __import__(path, None, None, [])
+ # We must do an import of the fully qualified name. Otherwise if a
+ # subpackage 'a.b' is requested where 'import a' does NOT provide
+ # 'a.b' automatically, then 'a.b' will not be found below. This
+ # second call will force the equivalent of 'import a.b' to happen
+ # after the top-level import above.
+ my_import(fullname)
+
except ImportError:
raise ValueError(
"Could not import class or module '%s' specified for inheritance diagram" % name)
Modified: trunk/matplotlib/doc/sphinxext/ipython_console_highlighting.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/ipython_console_highlighting.py 2009-02-02 08:29:18 UTC (rev 6862)
+++ trunk/matplotlib/doc/sphinxext/ipython_console_highlighting.py 2009-02-02 12:42:08 UTC (rev 6863)
@@ -1,18 +1,32 @@
+"""reST directive for syntax-highlighting ipython interactive sessions.
+"""
+
+#-----------------------------------------------------------------------------
+# Needed modules
+
+# Standard library
+import re
+
+# Third party
from pygments.lexer import Lexer, do_insertions
-from pygments.lexers.agile import PythonConsoleLexer, PythonLexer, \
- PythonTracebackLexer
+from pygments.lexers.agile import (PythonConsoleLexer, PythonLexer,
+ PythonTracebackLexer)
from pygments.token import Comment, Generic
+
from sphinx import highlighting
-import re
+
+#-----------------------------------------------------------------------------
+# Global constants
line_re = re.compile('.*?\n')
+#-----------------------------------------------------------------------------
+# Code begins - classes and functions
+
class IPythonConsoleLexer(Lexer):
"""
For IPython console output or doctests, such as:
- Tracebacks are not currently supported.
-
.. sourcecode:: ipython
In [1]: a = 'foo'
@@ -24,7 +38,14 @@
foo
In [4]: 1 / 0
+
+ Notes:
+
+ - Tracebacks are not currently supported.
+
+ - It assumes the default IPython prompts, not customized ones.
"""
+
name = 'IPython console session'
aliases = ['ipython']
mimetypes = ['text/x-ipython-console']
@@ -72,4 +93,6 @@
pylexer.get_tokens_unprocessed(curcode)):
yield item
+#-----------------------------------------------------------------------------
+# Register the extension as a valid pygments lexer
highlighting.lexers['ipython'] = IPythonConsoleLexer()
Modified: trunk/matplotlib/doc/sphinxext/mathmpl.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/mathmpl.py 2009-02-02 08:29:18 UTC (rev 6862)
+++ trunk/matplotlib/doc/sphinxext/mathmpl.py 2009-02-02 12:42:08 UTC (rev 6863)
@@ -1,3 +1,25 @@
+"""matplotlib-based directive for math rendering in reST using sphinx.
+
+To use this extension, add ``mathmpl`` to the list of extensions in
+:file:`conf.py`.
+
+Note:
+
+Current SVN versions of Sphinx now include built-in support for math.
+There are two flavors:
+
+ - pngmath: uses dvipng to render the equation
+
+ - jsmath: renders the math in the browser using Javascript
+
+To use these extensions instead of the code in this module, add
+``sphinx.ext.pngmath`` or ``sphinx.ext.jsmath`` to the list of extensions in
+:file:`conf.py` instead of ``mathmpl``.
+
+All three of these options for math are designed to behave in the same
+way.
+"""
+
import os
import sys
try:
Modified: trunk/matplotlib/doc/sphinxext/only_directives.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/only_directives.py 2009-02-02 08:29:18 UTC (rev 6862)
+++ trunk/matplotlib/doc/sphinxext/only_directives.py 2009-02-02 12:42:08 UTC (rev 6863)
@@ -1,11 +1,15 @@
-#
-# A pair of directives for inserting content that will only appear in
-# either html or latex.
-#
+"""Sphinx directives for selective inclusion of contents.
+A pair of directives for inserting content that will only appear in
+either html or latex.
+"""
+
+# Required modules
from docutils.nodes import Body, Element
from docutils.parsers.rst import directives
+
+# Code begins
class only_base(Body, Element):
def dont_traverse(self, *args, **kwargs):
return []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|