SF.net SVN: matplotlib:[6628] trunk/matplotlib/CHANGELOG
Revision: 6628 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6628&view=rev Author: jdh2358 Date: 2008-12-16 16:12:33 + (Tue, 16 Dec 2008) Log Message: --- applied Darren's sphinx patch, cleaned up some docstrings Modified Paths: -- trunk/matplotlib/CHANGELOG Modified: trunk/matplotlib/CHANGELOG === --- trunk/matplotlib/CHANGELOG 2008-12-16 14:44:09 UTC (rev 6627) +++ trunk/matplotlib/CHANGELOG 2008-12-16 16:12:33 UTC (rev 6628) @@ -1,5 +1,5 @@ 2008-12-15 Fix \$ in non-math text with usetex off. Document -differences between usetex on/off - MGD + differences between usetex on/off - MGD 2008-12-15 Fix anti-aliasing when auto-snapping - MGD This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[6629] branches/v0_98_5_maint
Revision: 6629
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6629&view=rev
Author: jdh2358
Date: 2008-12-16 16:13:07 + (Tue, 16 Dec 2008)
Log Message:
---
applied Darren's sphinx patch, cleaned up some docstrings
Modified Paths:
--
branches/v0_98_5_maint/doc/api/api_changes.rst
branches/v0_98_5_maint/doc/api/font_manager_api.rst
branches/v0_98_5_maint/doc/pyplots/plotmap.py
branches/v0_98_5_maint/doc/sphinxext/inheritance_diagram.py
branches/v0_98_5_maint/doc/sphinxext/mathmpl.py
branches/v0_98_5_maint/doc/sphinxext/only_directives.py
branches/v0_98_5_maint/doc/users/event_handling.rst
branches/v0_98_5_maint/lib/matplotlib/collections.py
branches/v0_98_5_maint/lib/matplotlib/pyplot.py
branches/v0_98_5_maint/lib/matplotlib/ticker.py
Modified: branches/v0_98_5_maint/doc/api/api_changes.rst
===
--- branches/v0_98_5_maint/doc/api/api_changes.rst 2008-12-16 16:12:33 UTC
(rev 6628)
+++ branches/v0_98_5_maint/doc/api/api_changes.rst 2008-12-16 16:13:07 UTC
(rev 6629)
@@ -253,7 +253,7 @@
`Axes.toggle_log_lineary()` has been removed.
:mod:`matplotlib.artist`
-~~~
+~~
Old method New method
Modified: branches/v0_98_5_maint/doc/api/font_manager_api.rst
===
--- branches/v0_98_5_maint/doc/api/font_manager_api.rst 2008-12-16 16:12:33 UTC
(rev 6628)
+++ branches/v0_98_5_maint/doc/api/font_manager_api.rst 2008-12-16 16:13:07 UTC
(rev 6629)
@@ -11,7 +11,7 @@
:show-inheritance:
:mod:`matplotlib.fontconfig_pattern`
-==
+
.. automodule:: matplotlib.fontconfig_pattern
:members:
Modified: branches/v0_98_5_maint/doc/pyplots/plotmap.py
===
--- branches/v0_98_5_maint/doc/pyplots/plotmap.py 2008-12-16 16:12:33 UTC
(rev 6628)
+++ branches/v0_98_5_maint/doc/pyplots/plotmap.py 2008-12-16 16:13:07 UTC
(rev 6629)
@@ -11,7 +11,7 @@
# read in topo data (on a regular lat/lon grid)
# longitudes go from 20 to 380.
# you can get this data from matplolib svn matplotlib/htdocs/screenshots/data/
-datadir = '/home/jdhunter/python/svn/matplotlib/htdocs/screenshots/data/'
+datadir = '/home/jdhunter/python/svn/matplotlib/trunk/htdocs/screenshots/data/'
if not os.path.exists(datadir):
raise SystemExit('You need to download the data with svn co
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/htdocs/screenshots/data/";
and set the datadir variable in %s'%__file__)
Modified: branches/v0_98_5_maint/doc/sphinxext/inheritance_diagram.py
===
--- branches/v0_98_5_maint/doc/sphinxext/inheritance_diagram.py 2008-12-16
16:12:33 UTC (rev 6628)
+++ branches/v0_98_5_maint/doc/sphinxext/inheritance_diagram.py 2008-12-16
16:13:07 UTC (rev 6629)
@@ -39,8 +39,6 @@
from md5 import md5
from docutils.nodes import Body, Element
-from docutils.writers.html4css1 import HTMLTranslator
-from sphinx.latexwriter import LaTeXTranslator
from docutils.parsers.rst import directives
from sphinx.roles import xfileref_role
@@ -409,12 +407,9 @@
inheritance_diagram_directive)
def setup(app):
-app.add_node(inheritance_diagram)
-
-HTMLTranslator.visit_inheritance_diagram = \
-visit_inheritance_diagram(html_output_graph)
-HTMLTranslator.depart_inheritance_diagram = do_nothing
-
-LaTeXTranslator.visit_inheritance_diagram = \
-visit_inheritance_diagram(latex_output_graph)
-LaTeXTranslator.depart_inheritance_diagram = do_nothing
+app.add_node(inheritance_diagram,
+ html=(visit_inheritance_diagram(html_output_graph),
+ do_nothing))
+app.add_node(inheritance_diagram,
+ latex=(visit_inheritance_diagram(latex_output_graph),
+do_nothing))
Modified: branches/v0_98_5_maint/doc/sphinxext/mathmpl.py
===
--- branches/v0_98_5_maint/doc/sphinxext/mathmpl.py 2008-12-16 16:12:33 UTC
(rev 6628)
+++ branches/v0_98_5_maint/doc/sphinxext/mathmpl.py 2008-12-16 16:13:07 UTC
(rev 6629)
@@ -6,8 +6,6 @@
from docutils import nodes
from docutils.parsers.rst import directives
-from docutils.writers.html4css1 import HTMLTranslator
-from sphinx.latexwriter import LaTeXTranslator
import warnings
# Define LaTeX math node:
@@ -69,8 +67,6 @@
self.body.append(latex2html(node, source))
def depart_latex_math_html(self, node):
pass
-HTMLTransl
SF.net SVN: matplotlib:[6630] trunk/matplotlib
Revision: 6630 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6630&view=rev Author: jdh2358 Date: 2008-12-16 16:19:21 + (Tue, 16 Dec 2008) Log Message: --- Merged revisions 6627,6629 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint r6627 | jdh2358 | 2008-12-16 06:44:09 -0800 (Tue, 16 Dec 2008) | 1 line removed mpl_data link r6629 | jdh2358 | 2008-12-16 08:13:07 -0800 (Tue, 16 Dec 2008) | 1 line applied Darren's sphinx patch, cleaned up some docstrings Modified Paths: -- trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/README.txt trunk/matplotlib/doc/api/api_changes.rst trunk/matplotlib/doc/api/font_manager_api.rst trunk/matplotlib/doc/devel/documenting_mpl.rst trunk/matplotlib/doc/make.py trunk/matplotlib/doc/pyplots/plotmap.py trunk/matplotlib/doc/sphinxext/inheritance_diagram.py trunk/matplotlib/doc/sphinxext/mathmpl.py trunk/matplotlib/doc/sphinxext/only_directives.py trunk/matplotlib/doc/users/customizing.rst trunk/matplotlib/doc/users/navigation_toolbar.rst trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/pyplot.py Property Changed: trunk/matplotlib/ Property changes on: trunk/matplotlib ___ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6625 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6629 Modified: trunk/matplotlib/CHANGELOG === --- trunk/matplotlib/CHANGELOG 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/CHANGELOG 2008-12-16 16:19:21 UTC (rev 6630) @@ -1,3 +1,10 @@ +2008-12-15 Removed mpl_data symlink in docs. On platforms that do not + support symlinks, these become copies, and the font files + are large, so the distro becomes unneccessarily bloaded. + Keeping the mpl_examples dir because relative links are + harder for the plot directive and the *.py files are not so + large. - JDH + 2008-12-15 Fix \$ in non-math text with usetex off. Document differences between usetex on/off - MGD Modified: trunk/matplotlib/doc/README.txt === --- trunk/matplotlib/doc/README.txt 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/README.txt 2008-12-16 16:19:21 UTC (rev 6630) @@ -27,9 +27,6 @@ * sphinxext - Sphinx extensions for the mpl docs -* mpl_data - a symbolic link to the matplotlib data for reference by - sphinx documentation - * mpl_examples - a link to the matplotlib examples in case any documentation wants to literal include them Modified: trunk/matplotlib/doc/api/api_changes.rst === --- trunk/matplotlib/doc/api/api_changes.rst2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/api/api_changes.rst2008-12-16 16:19:21 UTC (rev 6630) @@ -260,7 +260,7 @@ `Axes.toggle_log_lineary()` has been removed. :mod:`matplotlib.artist` - +~~ Old method New method Modified: trunk/matplotlib/doc/api/font_manager_api.rst === --- trunk/matplotlib/doc/api/font_manager_api.rst 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/api/font_manager_api.rst 2008-12-16 16:19:21 UTC (rev 6630) @@ -11,7 +11,7 @@ :show-inheritance: :mod:`matplotlib.fontconfig_pattern` - + .. automodule:: matplotlib.fontconfig_pattern :members: Modified: trunk/matplotlib/doc/devel/documenting_mpl.rst === --- trunk/matplotlib/doc/devel/documenting_mpl.rst 2008-12-16 16:13:07 UTC (rev 6629) +++ trunk/matplotlib/doc/devel/documenting_mpl.rst 2008-12-16 16:19:21 UTC (rev 6630) @@ -271,26 +271,41 @@ == In the documentation, you may want to include to a document in the -matplotlib src, e.g. a license file, an image file from `mpl-data`, or an -example. When you include these files, include them using a symbolic -link from the documentation parent directory. This way, if we -relocate the mpl documentation directory, all of the internal pointers -to files will not have to change, just the top level symlinks. For -example, In the top level doc directory we have symlinks pointing to -the mpl `examples` and `mpl-data`:: +matplotlib src, e.g. a license file or an image file fr
SF.net SVN: matplotlib:[6632] trunk/matplotlib/unit/nose_tests.py
Revision: 6632
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6632&view=rev
Author: jdh2358
Date: 2008-12-16 16:58:37 + (Tue, 16 Dec 2008)
Log Message:
---
added legend to markevery tests
Modified Paths:
--
trunk/matplotlib/unit/nose_tests.py
Modified: trunk/matplotlib/unit/nose_tests.py
===
--- trunk/matplotlib/unit/nose_tests.py 2008-12-16 16:54:10 UTC (rev 6631)
+++ trunk/matplotlib/unit/nose_tests.py 2008-12-16 16:58:37 UTC (rev 6632)
@@ -3,6 +3,7 @@
import nose, nose.tools as nt
import numpy.testing as nptest
+
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
@@ -20,20 +21,22 @@
# check marker only plot
fig = plt.figure()
ax = fig.add_subplot(111)
-ax.plot(x, y, 'o')
-ax.plot(x, y, 'd', markevery=None)
-ax.plot(x, y, 's', markevery=10)
-ax.plot(x, y, '+', markevery=(5, 20))
+ax.plot(x, y, 'o', label='default')
+ax.plot(x, y, 'd', markevery=None, label='mark all')
+ax.plot(x, y, 's', markevery=10, label='mark every 10')
+ax.plot(x, y, '+', markevery=(5, 20), label='mark every 5 starting at 10')
+ax.legend()
fig.canvas.draw()
plt.close(fig)
# check line/marker combos
fig = plt.figure()
ax = fig.add_subplot(111)
-ax.plot(x, y, '-o')
-ax.plot(x, y, '-d', markevery=None)
-ax.plot(x, y, '-s', markevery=10)
-ax.plot(x, y, '-+', markevery=(5, 20))
+ax.plot(x, y, '-o', label='default')
+ax.plot(x, y, '-d', markevery=None, label='mark all')
+ax.plot(x, y, '-s', markevery=10, label='mark every 10')
+ax.plot(x, y, '-+', markevery=(5, 20), label='mark every 5 starting at 10')
+ax.legend()
fig.canvas.draw()
plt.close(fig)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[6631] trunk/matplotlib
Revision: 6631
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6631&view=rev
Author: jdh2358
Date: 2008-12-16 16:54:10 + (Tue, 16 Dec 2008)
Log Message:
---
added markevery property to Line2D
Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/doc/users/pyplot_tutorial.rst
trunk/matplotlib/lib/matplotlib/lines.py
trunk/matplotlib/unit/nose_tests.py
Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG 2008-12-16 16:19:21 UTC (rev 6630)
+++ trunk/matplotlib/CHANGELOG 2008-12-16 16:54:10 UTC (rev 6631)
@@ -1,3 +1,6 @@
+2008-12-16 Added markevery property to Line2D to support subsampling
+ of markers - JDH
+
2008-12-15 Removed mpl_data symlink in docs. On platforms that do not
support symlinks, these become copies, and the font files
are large, so the distro becomes unneccessarily bloaded.
Modified: trunk/matplotlib/doc/users/pyplot_tutorial.rst
===
--- trunk/matplotlib/doc/users/pyplot_tutorial.rst 2008-12-16 16:19:21 UTC
(rev 6630)
+++ trunk/matplotlib/doc/users/pyplot_tutorial.rst 2008-12-16 16:54:10 UTC
(rev 6631)
@@ -117,6 +117,7 @@
markeredgewidth or mew float value in points
markerfacecolor or mfc any matplotlib color
markersize or ms float
+markevery None | integer | (startind, stride)
picker used in interactive line selection
pickradius the line pick selection radius
solid_capstyle ['butt' | 'round' | 'projecting']
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===
--- trunk/matplotlib/lib/matplotlib/lines.py2008-12-16 16:19:21 UTC (rev
6630)
+++ trunk/matplotlib/lib/matplotlib/lines.py2008-12-16 16:54:10 UTC (rev
6631)
@@ -177,6 +177,7 @@
solid_joinstyle = None,
pickradius = 5,
drawstyle = None,
+ markevery = None,
**kwargs
):
"""
@@ -226,6 +227,7 @@
self.set_linewidth(linewidth)
self.set_color(color)
self.set_marker(marker)
+self.set_markevery(markevery)
self.set_antialiased(antialiased)
self.set_markersize(markersize)
self._dashSeq = None
@@ -320,6 +322,32 @@
"""
self.pickradius = d
+
+def set_markevery(self, every):
+"""
+Set the markevery property to subsample the plot when using
+markers. Eg if ``markevery=5``, every 5-th marker will be
+plotted. *every* can be
+
+None
+Every point will be plotted
+
+an integer N
+Every N-th marker will be plotted starting with marker 0
+
+A length-2 tuple of integers
+every=(start, N) will start at point start and plot every N-th
marker
+
+
+ACCEPTS: None | integer | (startind, stride)
+
+"""
+self._markevery = every
+
+def get_markevery(self):
+'return the markevery setting'
+return self._markevery
+
def set_picker(self,p):
"""Sets the event picker details for the line.
@@ -472,6 +500,19 @@
funcname = self._markers.get(self._marker, '_draw_nothing')
if funcname != '_draw_nothing':
tpath, affine =
self._transformed_path.get_transformed_points_and_affine()
+
+# subsample the markers if markevery is not None
+markevery = self.get_markevery()
+if markevery is not None:
+if iterable(markevery):
+startind, stride = markevery
+else:
+startind, stride = 0, markevery
+if tpath.codes is not None:
+tpath.codes = tpath.codes[startind::stride]
+tpath.vertices = tpath.vertices[startind::stride]
+
+
markerFunc = getattr(self, funcname)
markerFunc(renderer, gc, tpath, affine.frozen())
Modified: trunk/matplotlib/unit/nose_tests.py
===
--- trunk/matplotlib/unit/nose_tests.py 2008-12-16 16:19:21 UTC (rev 6630)
+++ trunk/matplotlib/unit/nose_tests.py 2008-12-16 16:54:10 UTC (rev 6631)
@@ -1,3 +1,5 @@
+import numpy as np
+
import nose, nose.tools as nt
import numpy.testing as nptest
@@ -3,5 +5,4 @@
import matplotlib
matplotlib.use('Agg')
-import numpy as np
import matplotlib.pyplot as plt
import matplotlib.axes as maxes
@@ -11,7 +12,32 @@
fig = plt.figure()
ax = maxes.Subplot(fig, 1, 1, 1)
fig.add_subplot(ax)
+plt.close(fig)
+def test_markevery():
+x, y = np.random.rand(2, 100)
+
+# check marker only plot
+fig = plt.
SF.net SVN: matplotlib:[6627] branches/v0_98_5_maint
Revision: 6627
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6627&view=rev
Author: jdh2358
Date: 2008-12-16 14:44:09 + (Tue, 16 Dec 2008)
Log Message:
---
removed mpl_data link
Modified Paths:
--
branches/v0_98_5_maint/CHANGELOG
branches/v0_98_5_maint/doc/README.txt
branches/v0_98_5_maint/doc/devel/documenting_mpl.rst
branches/v0_98_5_maint/doc/make.py
branches/v0_98_5_maint/doc/users/customizing.rst
branches/v0_98_5_maint/doc/users/navigation_toolbar.rst
Modified: branches/v0_98_5_maint/CHANGELOG
===
--- branches/v0_98_5_maint/CHANGELOG2008-12-15 21:04:03 UTC (rev 6626)
+++ branches/v0_98_5_maint/CHANGELOG2008-12-16 14:44:09 UTC (rev 6627)
@@ -1,3 +1,10 @@
+2008-12-15 Removed mpl_data symlink in docs. On platforms that do not
+ support symlinks, these become copies, and the font files
+ are large, so the distro becomes unneccessarily bloaded.
+ Keeping the mpl_examples dir because relative links are
+ harder for the plot directive and the *.py files are not so
+ large. - JDH
+
2008-12-15 Fix \$ in non-math text with usetex off. Document
differences between usetex on/off - MGD
Modified: branches/v0_98_5_maint/doc/README.txt
===
--- branches/v0_98_5_maint/doc/README.txt 2008-12-15 21:04:03 UTC (rev
6626)
+++ branches/v0_98_5_maint/doc/README.txt 2008-12-16 14:44:09 UTC (rev
6627)
@@ -27,9 +27,6 @@
* sphinxext - Sphinx extensions for the mpl docs
-* mpl_data - a symbolic link to the matplotlib data for reference by
- sphinx documentation
-
* mpl_examples - a link to the matplotlib examples in case any
documentation wants to literal include them
Modified: branches/v0_98_5_maint/doc/devel/documenting_mpl.rst
===
--- branches/v0_98_5_maint/doc/devel/documenting_mpl.rst2008-12-15
21:04:03 UTC (rev 6626)
+++ branches/v0_98_5_maint/doc/devel/documenting_mpl.rst2008-12-16
14:44:09 UTC (rev 6627)
@@ -271,26 +271,41 @@
==
In the documentation, you may want to include to a document in the
-matplotlib src, e.g. a license file, an image file from `mpl-data`, or an
-example. When you include these files, include them using a symbolic
-link from the documentation parent directory. This way, if we
-relocate the mpl documentation directory, all of the internal pointers
-to files will not have to change, just the top level symlinks. For
-example, In the top level doc directory we have symlinks pointing to
-the mpl `examples` and `mpl-data`::
+matplotlib src, e.g. a license file or an image file from `mpl-data`,
+refer to it via a relative path from the document where the rst file
+resides, eg, in :file:`users/navigation_toolbar.rst`, we refer to the
+image icons with::
-home:~/mpl/doc2> ls -l mpl_*
-mpl_data -> ../lib/matplotlib/mpl-data
-mpl_examples -> ../examples
+.. image:: ../../lib/matplotlib/mpl-data/images/subplots.png
-
In the `users` subdirectory, if I want to refer to a file in the mpl-data
directory, I use the symlink directory. For example, from
`customizing.rst`::
- .. literalinclude:: ../mpl_data/matplotlibrc
+.. literalinclude:: ../../lib/matplotlib/mpl-data/matplotlibrc
+On exception to this is when referring to the examples dir. Relative
+paths are extremely confusing in the sphinx plot extensions, so
+without getting into the dirty details, it is easier to simply include
+a symlink to the files at the top doc level directory. This way, API
+documents like :meth:`matplotlib.pyplot.plot` can refer to the
+examples in a known location.
+In the top level doc directory we have symlinks pointing to
+the mpl `examples`::
+
+home:~/mpl/doc> ls -l mpl_*
+mpl_examples -> ../examples
+
+So we can include plots from the examples dir using the symlink::
+
+.. plot:: mpl_examples/pylab_examples/simple_plot.py
+
+
+We used to use a symlink for :file:`mpl-data` too, but the distro
+becomes very large on platforms that do not support links (eg the font
+files are duplicated and large)
+
.. _internal-section-refs:
Internal section references
Modified: branches/v0_98_5_maint/doc/make.py
===
--- branches/v0_98_5_maint/doc/make.py 2008-12-15 21:04:03 UTC (rev 6626)
+++ branches/v0_98_5_maint/doc/make.py 2008-12-16 14:44:09 UTC (rev 6627)
@@ -41,7 +41,7 @@
check_build()
if not os.path.exists('examples/index.rst'):
examples()
-shutil.copy('mpl_data/matplotlibrc', '_static/matplotlibrc')
+shutil.copy('../lib/matplotlib/mpl-data/matplotlibrc',
'_static/matplotlibrc')
#figs()
if os.system('sphinx-build -b html -d build/doctrees . build/html'):
raise SystemExit("Build
SF.net SVN: matplotlib:[6633] branches/v0_98_5_maint/setup.py
Revision: 6633 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6633&view=rev Author: jdh2358 Date: 2008-12-16 19:00:38 + (Tue, 16 Dec 2008) Log Message: --- fixed os.link problem for win32 Modified Paths: -- branches/v0_98_5_maint/setup.py Modified: branches/v0_98_5_maint/setup.py === --- branches/v0_98_5_maint/setup.py 2008-12-16 16:58:37 UTC (rev 6632) +++ branches/v0_98_5_maint/setup.py 2008-12-16 19:00:38 UTC (rev 6633) @@ -10,7 +10,10 @@ # distutils will copy if os.link is not available, so this is a hack # to force copying import os -del os.link +try: +del os.link +except AttributeError: +pass # This dict will be updated as we try to select the best option during # the build process. However, values in setup.cfg will be used, if This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[6634] trunk/matplotlib
Revision: 6634 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6634&view=rev Author: jdh2358 Date: 2008-12-16 19:01:45 + (Tue, 16 Dec 2008) Log Message: --- Merged revisions 6633 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint r6633 | jdh2358 | 2008-12-16 11:00:38 -0800 (Tue, 16 Dec 2008) | 1 line fixed os.link problem for win32 Modified Paths: -- trunk/matplotlib/setup.py Property Changed: trunk/matplotlib/ Property changes on: trunk/matplotlib ___ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6629 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6633 Modified: trunk/matplotlib/setup.py === --- trunk/matplotlib/setup.py 2008-12-16 19:00:38 UTC (rev 6633) +++ trunk/matplotlib/setup.py 2008-12-16 19:01:45 UTC (rev 6634) @@ -10,7 +10,10 @@ # distutils will copy if os.link is not available, so this is a hack # to force copying import os -del os.link +try: +del os.link +except AttributeError: +pass # This dict will be updated as we try to select the best option during # the build process. However, values in setup.cfg will be used, if This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[6635] branches/v0_98_5_maint
Revision: 6635
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6635&view=rev
Author: leejjoon
Date: 2008-12-16 19:02:39 + (Tue, 16 Dec 2008)
Log Message:
---
fixed dpi-dependent behavior of legend and text fancybox.
Modified Paths:
--
branches/v0_98_5_maint/CHANGELOG
branches/v0_98_5_maint/lib/matplotlib/legend.py
branches/v0_98_5_maint/lib/matplotlib/text.py
Modified: branches/v0_98_5_maint/CHANGELOG
===
--- branches/v0_98_5_maint/CHANGELOG2008-12-16 19:01:45 UTC (rev 6634)
+++ branches/v0_98_5_maint/CHANGELOG2008-12-16 19:02:39 UTC (rev 6635)
@@ -1,3 +1,6 @@
+2008-12-16 Fixed dpi-dependent behavior of Legend and fancybox in Text.
+ -JJL
+
2008-12-15 Removed mpl_data symlink in docs. On platforms that do not
support symlinks, these become copies, and the font files
are large, so the distro becomes unneccessarily bloaded.
Modified: branches/v0_98_5_maint/lib/matplotlib/legend.py
===
--- branches/v0_98_5_maint/lib/matplotlib/legend.py 2008-12-16 19:01:45 UTC
(rev 6634)
+++ branches/v0_98_5_maint/lib/matplotlib/legend.py 2008-12-16 19:02:39 UTC
(rev 6635)
@@ -207,6 +207,11 @@
reps = int(self.numpoints / len(self._scatteryoffsets)) + 1
self._scatteryoffsets = np.tile(self._scatteryoffsets,
reps)[:self.scatterpoints]
+# handles & labels (which can be iterators) need to be
+# explicitly converted to list.
+self._handles_labels = list(handles), list(labels)
+
+
# _legend_box is an OffsetBox instance that contains all
# legend items and will be initialized from _init_legend_box()
# method.
@@ -273,9 +278,9 @@
self._drawFrame = True
-# populate the legend_box with legend items.
-self._init_legend_box(handles, labels)
-self._legend_box.set_figure(self.figure)
+# init with null renderer
+#self._init_legend_box(handles, labels, None)
+#self._legend_box.set_figure(self.figure)
def _set_artist_props(self, a):
@@ -294,7 +299,7 @@
ox, oy = self._find_best_position(width, height)
return ox+xdescent, oy+ydescent
-def _findoffset_loc(self, width, height, xdescent, ydescent):
+def _findoffset_loc(self, width, height, xdescent, ydescent, renderer):
"Heper function to locate the legend using the location code"
if iterable(self._loc) and len(self._loc)==2:
@@ -304,7 +309,7 @@
x, y = bbox.x0 + bbox.width * fx, bbox.y0 + bbox.height * fy
else:
bbox = Bbox.from_bounds(0, 0, width, height)
-x, y = self._get_anchored_bbox(self._loc, bbox, self.parent.bbox)
+x, y = self._get_anchored_bbox(self._loc, bbox, self.parent.bbox,
renderer)
return x+xdescent, y+ydescent
@@ -312,6 +317,11 @@
"Draw everything that belongs to the legend"
if not self.get_visible(): return
+# populate the legend_box with legend items.
+handles, labels = self._handles_labels
+self._init_legend_box(handles, labels, renderer)
+self._legend_box.set_figure(self.figure)
+
renderer.open_group('legend')
# find_offset function will be provided to _legend_box and
@@ -320,12 +330,16 @@
if self._loc == 0:
self._legend_box.set_offset(self._findoffset_best)
else:
-self._legend_box.set_offset(self._findoffset_loc)
+def _findoffset_loc(width, height, xdescent, ydescent):
+return self._findoffset_loc(width, height, xdescent, ydescent,
renderer)
+self._legend_box.set_offset(_findoffset_loc)
+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)
if self._mode in ["expand"]:
-pad = 2*(self.borderaxespad+self.borderpad)*self.fontsize
+pad = 2*(self.borderaxespad+self.borderpad)*fontsize
self._legend_box.set_width(self.parent.bbox.width-pad)
if self._drawFrame:
@@ -334,6 +348,8 @@
self.legendPatch.set_bounds(bbox.x0, bbox.y0,
bbox.width, bbox.height)
+self.legendPatch.set_mutation_scale(fontsize)
+
if self.shadow:
shadow = Shadow(self.legendPatch, 2, -2)
shadow.draw(renderer)
@@ -353,7 +369,7 @@
return self.fontsize/72.0*self.figure.dpi
-def _init_legend_box(self, handles, labels):
+def _init_legend_box(self, handles, labels, renderer=None):
"""
Initiallize the legend_box. The legend_box is an instance of
the OffsetBox, which is packed with legend handles and
@@ -361,6 +377,11 @@
drawing tim
SF.net SVN: matplotlib:[6636] trunk/matplotlib
Revision: 6636
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6636&view=rev
Author: leejjoon
Date: 2008-12-16 19:09:30 + (Tue, 16 Dec 2008)
Log Message:
---
r6635 | leejjoon | 2008-12-16 14:02:39 -0500 (Tue, 16 Dec 2008) | 2 lines
fixed dpi-dependent behavior of legend and text fancybox.
Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/legend.py
trunk/matplotlib/lib/matplotlib/text.py
Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG 2008-12-16 19:02:39 UTC (rev 6635)
+++ trunk/matplotlib/CHANGELOG 2008-12-16 19:09:30 UTC (rev 6636)
@@ -1,3 +1,6 @@
+2008-12-16 Fixed dpi-dependent behavior of Legend and fancybox in Text.
+ -JJL
+
2008-12-16 Added markevery property to Line2D to support subsampling
of markers - JDH
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===
--- trunk/matplotlib/lib/matplotlib/legend.py 2008-12-16 19:02:39 UTC (rev
6635)
+++ trunk/matplotlib/lib/matplotlib/legend.py 2008-12-16 19:09:30 UTC (rev
6636)
@@ -207,6 +207,11 @@
reps = int(self.numpoints / len(self._scatteryoffsets)) + 1
self._scatteryoffsets = np.tile(self._scatteryoffsets,
reps)[:self.scatterpoints]
+# handles & labels (which can be iterators) need to be
+# explicitly converted to list.
+self._handles_labels = list(handles), list(labels)
+
+
# _legend_box is an OffsetBox instance that contains all
# legend items and will be initialized from _init_legend_box()
# method.
@@ -273,9 +278,9 @@
self._drawFrame = True
-# populate the legend_box with legend items.
-self._init_legend_box(handles, labels)
-self._legend_box.set_figure(self.figure)
+# init with null renderer
+#self._init_legend_box(handles, labels, None)
+#self._legend_box.set_figure(self.figure)
def _set_artist_props(self, a):
@@ -294,7 +299,7 @@
ox, oy = self._find_best_position(width, height)
return ox+xdescent, oy+ydescent
-def _findoffset_loc(self, width, height, xdescent, ydescent):
+def _findoffset_loc(self, width, height, xdescent, ydescent, renderer):
"Heper function to locate the legend using the location code"
if iterable(self._loc) and len(self._loc)==2:
@@ -304,7 +309,7 @@
x, y = bbox.x0 + bbox.width * fx, bbox.y0 + bbox.height * fy
else:
bbox = Bbox.from_bounds(0, 0, width, height)
-x, y = self._get_anchored_bbox(self._loc, bbox, self.parent.bbox)
+x, y = self._get_anchored_bbox(self._loc, bbox, self.parent.bbox,
renderer)
return x+xdescent, y+ydescent
@@ -312,6 +317,11 @@
"Draw everything that belongs to the legend"
if not self.get_visible(): return
+# populate the legend_box with legend items.
+handles, labels = self._handles_labels
+self._init_legend_box(handles, labels, renderer)
+self._legend_box.set_figure(self.figure)
+
renderer.open_group('legend')
# find_offset function will be provided to _legend_box and
@@ -320,12 +330,16 @@
if self._loc == 0:
self._legend_box.set_offset(self._findoffset_best)
else:
-self._legend_box.set_offset(self._findoffset_loc)
+def _findoffset_loc(width, height, xdescent, ydescent):
+return self._findoffset_loc(width, height, xdescent, ydescent,
renderer)
+self._legend_box.set_offset(_findoffset_loc)
+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)
if self._mode in ["expand"]:
-pad = 2*(self.borderaxespad+self.borderpad)*self.fontsize
+pad = 2*(self.borderaxespad+self.borderpad)*fontsize
self._legend_box.set_width(self.parent.bbox.width-pad)
if self._drawFrame:
@@ -334,6 +348,8 @@
self.legendPatch.set_bounds(bbox.x0, bbox.y0,
bbox.width, bbox.height)
+self.legendPatch.set_mutation_scale(fontsize)
+
if self.shadow:
shadow = Shadow(self.legendPatch, 2, -2)
shadow.draw(renderer)
@@ -353,7 +369,7 @@
return self.fontsize/72.0*self.figure.dpi
-def _init_legend_box(self, handles, labels):
+def _init_legend_box(self, handles, labels, renderer=None):
"""
Initiallize the legend_box. The legend_box is an instance of
the OffsetBox, which is packed with legend handles and
@@ -361,6 +377,11 @@
drawing time.
"""
+if renderer is None:
+fontsize = sel
SF.net SVN: matplotlib:[6637] branches/v0_98_5_maint/CHANGELOG
Revision: 6637 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6637&view=rev Author: jdh2358 Date: 2008-12-16 19:34:32 + (Tue, 16 Dec 2008) Log Message: --- tagged for bugfix release 98.5.1 Modified Paths: -- branches/v0_98_5_maint/CHANGELOG Modified: branches/v0_98_5_maint/CHANGELOG === --- branches/v0_98_5_maint/CHANGELOG2008-12-16 19:09:30 UTC (rev 6636) +++ branches/v0_98_5_maint/CHANGELOG2008-12-16 19:34:32 UTC (rev 6637) @@ -1,3 +1,6 @@ +== +2008-12-16 Release 0.98.5.1 at r6636 + 2008-12-16 Fixed dpi-dependent behavior of Legend and fancybox in Text. -JJL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[6638] trunk/matplotlib
Revision: 6638 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6638&view=rev Author: jdh2358 Date: 2008-12-16 20:03:07 + (Tue, 16 Dec 2008) Log Message: --- fixed merge between 98 branch and trunk Modified Paths: -- trunk/matplotlib/CHANGELOG Property Changed: trunk/matplotlib/ Property changes on: trunk/matplotlib ___ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6633 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6637 Modified: trunk/matplotlib/CHANGELOG === --- trunk/matplotlib/CHANGELOG 2008-12-16 19:34:32 UTC (rev 6637) +++ trunk/matplotlib/CHANGELOG 2008-12-16 20:03:07 UTC (rev 6638) @@ -1,9 +1,8 @@ + 2008-12-16 Fixed dpi-dependent behavior of Legend and fancybox in Text. - -JJL 2008-12-16 Added markevery property to Line2D to support subsampling of markers - JDH - 2008-12-15 Removed mpl_data symlink in docs. On platforms that do not support symlinks, these become copies, and the font files are large, so the distro becomes unneccessarily bloaded. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[6639] trunk/matplotlib/release/osx
Revision: 6639
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6639&view=rev
Author: jdh2358
Date: 2008-12-16 22:26:11 + (Tue, 16 Dec 2008)
Log Message:
---
export universal flags before making
Modified Paths:
--
trunk/matplotlib/release/osx/Makefile
trunk/matplotlib/release/osx/data/setup.cfg
Modified: trunk/matplotlib/release/osx/Makefile
===
--- trunk/matplotlib/release/osx/Makefile 2008-12-16 20:03:07 UTC (rev
6638)
+++ trunk/matplotlib/release/osx/Makefile 2008-12-16 22:26:11 UTC (rev
6639)
@@ -2,18 +2,22 @@
ZLIBVERSION=1.2.3
PNGVERSION=1.2.33
FREETYPEVERSION=2.3.7
-MPLVERSION=0.98.5
-MPLSRC=matplotlib-0.98.5
+MPLVERSION=0.98.5.1
+MPLSRC=matplotlib-${MPLVERSION}
MACOSX_DEPLOYMENT_TARGET=10.4
## You shouldn't need to configure past this point
-CFLAGS="-Os -arch ppc -arch i386 -I${SRCDIR}/zlib-1.2.3
-I${SRCDIR}/libpng-1.2.33 -I${SRCDIR}/freetype-2.3.7/include"
-LDFLAGS="-arch ppc -arch i386 -L${SRCDIR}/zlib-1.2.3 -L${SRCDIR}/libpng-1.2.33
-L${SRCDIR}/freetype-2.3.7"
+CFLAGS="-Os -arch ppc -arch i386 -I${SRCDIR}/zlib-${ZLIBVERSION}
-I${SRCDIR}/libpng-${PNGVERSION}
-I${SRCDIR}/freetype-${FREETYPEVERSION}/include"
-CFLAGS_DEPS="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
-LDFLAGS_DEPS="-arch i386 -arch ppc -syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
+LDFLAGS="-arch ppc -arch i386 -L${SRCDIR}/zlib-${ZLIBVERSION}
-L${SRCDIR}/libpng-${PNGVERSION} -L${SRCDIR}/freetype-${FREETYPEVERSION}"
+CFLAGS_ZLIB="-arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
+LDFLAGS_ZLIB="-arch i386 -arch ppc -syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
+
+CFLAGS_DEPS="-arch i386 -arch ppc -I${SRCDIR}/zlib-${ZLIBVERSION} -isysroot
/Developer/SDKs/MacOSX10.4u.sdk"
+LDFLAGS_DEPS="-arch i386 -arch ppc -L${SRCDIR}/zlib-${ZLIBVERSION}
-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
+
clean:
rm -rf zlib-${ZLIBVERSION}.tar.gz libpng-${PNGVERSION}.tar.bz2 \
freetype-${FREETYPEVERSION}.tar.bz2 bdist_mpkg-0.4.3.tar.gz \
@@ -33,37 +37,62 @@
zlib:
+ unset PKG_CONFIG_PATH &&\
rm -rf zlib-${ZLIBVERSION} &&\
tar xvfz zlib-${ZLIBVERSION}.tar.gz &&\
cd zlib-${ZLIBVERSION} &&\
+ export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} &&\
+ export CFLAGS=${CFLAGS_DEPS} &&\
+ export LDFLAGS=${LDFLAGS_DEPS} &&\
./configure &&\
- MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}
CFLAGS=${CFLAGS_DEPS} LDFLAGS=${LDFLAGS_DEPS} make -j3
+ MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}
CFLAGS=${CFLAGS_ZLIB} LDFLAGS=${LDFLAGS_ZLIB} make -j3&& \
+ unset MACOSX_DEPLOYMENT_TARGET
png: zlib
+ unset PKG_CONFIG_PATH &&\
rm -rf libpng-${PNGVERSION} &&\
tar xvfj libpng-${PNGVERSION}.tar.bz2
cd libpng-${PNGVERSION} &&\
+ export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} &&\
+ export CFLAGS=${CFLAGS_DEPS} &&\
+ export LDFLAGS=${LDFLAGS_DEPS} &&\
./configure --disable-dependency-tracking &&\
- MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}
CFLAGS=${CFLAGS_DEPS} LDFLAGS=${LDFLAGS_DEPS} make -j3 &&\
- cp .libs/libpng.a .
+ make -j3 &&\
+ cp .libs/libpng.a . &&\
+ unset MACOSX_DEPLOYMENT_TARGET
+
freetype: zlib
+ unset PKG_CONFIG_PATH &&\
rm -rf ${FREETYPEVERSION} &&\
tar xvfj freetype-${FREETYPEVERSION}.tar.bz2 &&\
cd freetype-${FREETYPEVERSION} &&\
+ export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} &&\
+ export CFLAGS=${CFLAGS_DEPS} &&\
+ export LDFLAGS=${LDFLAGS_DEPS} &&\
./configure &&\
- MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET}
CFLAGS=${CFLAGS_DEPS} LDFLAGS=${LDFLAGS_DEPS} make -j3 &&\
- cp objs/.libs/libfreetype.a .
+ make -j3 &&\
+ cp objs/.libs/libfreetype.a . &&\
+ unset MACOSX_DEPLOYMENT_TARGET
dependencies:
make zlib png freetype
installers:
+ unset PKG_CONFIG_PATH &&\
tar xvfz matplotlib-${MPLVERSION}.tar.gz && \
cd ${MPLSRC} && \
rm -rf build && \
cp ../data/setup.cfg . &&\
- CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} bdist_mpkg &&\
- CFLAGS=${CFLAGS} LDFLAGS=${LDFLAGS} python setupegg.py bdist_egg
+ export CFLAGS=${CFLAGS} &&\
+ export LDFLAGS=${LDFLAGS} &&\
+ bdist_mpkg &&\
+ python setupegg.py bdist_egg &&\
+ cd dist && \
+ zip -ro matplotlib-${MPLVERSION}-py2.5-macosx10.5.zip
matplotlib-${MPLVERSION}-py2.5-macosx10.5.mpkg
+all:
+ make clean fetch_deps dependencies installers
+
+
Modified: trunk/matplotlib/release/osx/data/setup.cfg
===
--- trunk/matplotlib/release/osx/data/setup.cfg 2008-12-16 20:03:07 UTC (rev
6638)
+++ trunk/matplotlib/release/osx/data/setup.cfg 2008-12-16 22:26:1
SF.net SVN: matplotlib:[6640] branches/v0_98_5_maint
Revision: 6640
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6640&view=rev
Author: leejjoon
Date: 2008-12-17 00:50:56 + (Wed, 17 Dec 2008)
Log Message:
---
Another attempt to fix dpi-dependent behavior of Legend
Modified Paths:
--
branches/v0_98_5_maint/CHANGELOG
branches/v0_98_5_maint/lib/matplotlib/legend.py
branches/v0_98_5_maint/lib/matplotlib/offsetbox.py
Modified: branches/v0_98_5_maint/CHANGELOG
===
--- branches/v0_98_5_maint/CHANGELOG2008-12-16 22:26:11 UTC (rev 6639)
+++ branches/v0_98_5_maint/CHANGELOG2008-12-17 00:50:56 UTC (rev 6640)
@@ -1,3 +1,5 @@
+2008-12-16 Another attempt to fix dpi-dependent behavior of Legend. -JJL
+
==
2008-12-16 Release 0.98.5.1 at r6636
Modified: branches/v0_98_5_maint/lib/matplotlib/legend.py
===
--- branches/v0_98_5_maint/lib/matplotlib/legend.py 2008-12-16 22:26:11 UTC
(rev 6639)
+++ branches/v0_98_5_maint/lib/matplotlib/legend.py 2008-12-17 00:50:56 UTC
(rev 6640)
@@ -34,7 +34,7 @@
from matplotlib.collections import LineCollection, RegularPolyCollection
from matplotlib.transforms import Bbox
-from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea
+from matplotlib.offsetbox import HPacker, VPacker, PackerBase, TextArea,
DrawingArea
class Legend(Artist):
@@ -207,11 +207,6 @@
reps = int(self.numpoints / len(self._scatteryoffsets)) + 1
self._scatteryoffsets = np.tile(self._scatteryoffsets,
reps)[:self.scatterpoints]
-# handles & labels (which can be iterators) need to be
-# explicitly converted to list.
-self._handles_labels = list(handles), list(labels)
-
-
# _legend_box is an OffsetBox instance that contains all
# legend items and will be initialized from _init_legend_box()
# method.
@@ -277,12 +272,13 @@
self._set_artist_props(self.legendPatch)
self._drawFrame = True
-
+
# init with null renderer
-#self._init_legend_box(handles, labels, None)
-#self._legend_box.set_figure(self.figure)
+self._init_legend_box(handles, labels)
+self._last_fontsize_points = self.fontsize
+
def _set_artist_props(self, a):
"""
set the boilerplate props for artists added to axes
@@ -294,9 +290,9 @@
a.set_transform(self.get_transform())
-def _findoffset_best(self, width, height, xdescent, ydescent):
+def _findoffset_best(self, width, height, xdescent, ydescent, renderer):
"Heper function to locate the legend at its best position"
-ox, oy = self._find_best_position(width, height)
+ox, oy = self._find_best_position(width, height, renderer)
return ox+xdescent, oy+ydescent
def _findoffset_loc(self, width, height, xdescent, ydescent, renderer):
@@ -317,10 +313,7 @@
"Draw everything that belongs to the legend"
if not self.get_visible(): return
-# populate the legend_box with legend items.
-handles, labels = self._handles_labels
-self._init_legend_box(handles, labels, renderer)
-self._legend_box.set_figure(self.figure)
+self._update_legend_box(renderer)
renderer.open_group('legend')
@@ -328,12 +321,15 @@
# _legend_box will draw itself at the location of the return
# value of the find_offset.
if self._loc == 0:
-self._legend_box.set_offset(self._findoffset_best)
+_findoffset = self._findoffset_best
else:
-def _findoffset_loc(width, height, xdescent, ydescent):
-return self._findoffset_loc(width, height, xdescent, ydescent,
renderer)
-self._legend_box.set_offset(_findoffset_loc)
+_findoffset = self._findoffset_loc
+def findoffset(width, height, xdescent, ydescent):
+return _findoffset(width, height, xdescent, ydescent, renderer)
+
+self._legend_box.set_offset(findoffset)
+
fontsize = renderer.points_to_pixels(self.fontsize)
# if mode == fill, set the width of the legend_box to the
@@ -361,15 +357,18 @@
renderer.close_group('legend')
-def _approx_text_height(self):
+def _approx_text_height(self, renderer=None):
"""
Return the approximate height of the text. This is used to place
the legend handle.
"""
-return self.fontsize/72.0*self.figure.dpi
+if renderer is None:
+return self.fontsize
+else:
+return renderer.points_to_pixels(self.fontsize)
-def _init_legend_box(self, handles, labels, renderer=None):
+def _init_legend_box(self, handles, labels):
"""
Initiallize the legend_box. The legend_
SF.net SVN: matplotlib:[6641] trunk/matplotlib
Revision: 6641
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6641&view=rev
Author: leejjoon
Date: 2008-12-17 00:55:52 + (Wed, 17 Dec 2008)
Log Message:
---
Merged revisions 6640 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint
r6640 | leejjoon | 2008-12-16 19:50:56 -0500 (Tue, 16 Dec 2008) | 1 line
Another attempt to fix dpi-dependent behavior of Legend
Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/legend.py
trunk/matplotlib/lib/matplotlib/offsetbox.py
Property Changed:
trunk/matplotlib/
Property changes on: trunk/matplotlib
___
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6637
+ /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6640
Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG 2008-12-17 00:50:56 UTC (rev 6640)
+++ trunk/matplotlib/CHANGELOG 2008-12-17 00:55:52 UTC (rev 6641)
@@ -1,3 +1,4 @@
+2008-12-16 Another attempt to fix dpi-dependent behavior of Legend. -JJL
2008-12-16 Fixed dpi-dependent behavior of Legend and fancybox in Text.
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===
--- trunk/matplotlib/lib/matplotlib/legend.py 2008-12-17 00:50:56 UTC (rev
6640)
+++ trunk/matplotlib/lib/matplotlib/legend.py 2008-12-17 00:55:52 UTC (rev
6641)
@@ -34,7 +34,7 @@
from matplotlib.collections import LineCollection, RegularPolyCollection
from matplotlib.transforms import Bbox
-from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea
+from matplotlib.offsetbox import HPacker, VPacker, PackerBase, TextArea,
DrawingArea
class Legend(Artist):
@@ -207,11 +207,6 @@
reps = int(self.numpoints / len(self._scatteryoffsets)) + 1
self._scatteryoffsets = np.tile(self._scatteryoffsets,
reps)[:self.scatterpoints]
-# handles & labels (which can be iterators) need to be
-# explicitly converted to list.
-self._handles_labels = list(handles), list(labels)
-
-
# _legend_box is an OffsetBox instance that contains all
# legend items and will be initialized from _init_legend_box()
# method.
@@ -277,12 +272,13 @@
self._set_artist_props(self.legendPatch)
self._drawFrame = True
-
+
# init with null renderer
-#self._init_legend_box(handles, labels, None)
-#self._legend_box.set_figure(self.figure)
+self._init_legend_box(handles, labels)
+self._last_fontsize_points = self.fontsize
+
def _set_artist_props(self, a):
"""
set the boilerplate props for artists added to axes
@@ -294,9 +290,9 @@
a.set_transform(self.get_transform())
-def _findoffset_best(self, width, height, xdescent, ydescent):
+def _findoffset_best(self, width, height, xdescent, ydescent, renderer):
"Heper function to locate the legend at its best position"
-ox, oy = self._find_best_position(width, height)
+ox, oy = self._find_best_position(width, height, renderer)
return ox+xdescent, oy+ydescent
def _findoffset_loc(self, width, height, xdescent, ydescent, renderer):
@@ -317,10 +313,7 @@
"Draw everything that belongs to the legend"
if not self.get_visible(): return
-# populate the legend_box with legend items.
-handles, labels = self._handles_labels
-self._init_legend_box(handles, labels, renderer)
-self._legend_box.set_figure(self.figure)
+self._update_legend_box(renderer)
renderer.open_group('legend')
@@ -328,12 +321,15 @@
# _legend_box will draw itself at the location of the return
# value of the find_offset.
if self._loc == 0:
-self._legend_box.set_offset(self._findoffset_best)
+_findoffset = self._findoffset_best
else:
-def _findoffset_loc(width, height, xdescent, ydescent):
-return self._findoffset_loc(width, height, xdescent, ydescent,
renderer)
-self._legend_box.set_offset(_findoffset_loc)
+_findoffset = self._findoffset_loc
+def findoffset(width, height, xdescent, ydescent):
+return _findoffset(width, height, xdescent, ydescent, renderer)
+
+self._legend_box.set_offset(findoffset)
+
fontsize = renderer.points_to_pixels(self.fontsize)
# if mode == fill, set the width of the legend_box to the
@@ -361,15 +357,18 @@
renderer.close_group('legend')
-def _approx_text_height(self):
+def _approx_text_height(self, renderer=None):
"""
Return the approximate height
SF.net SVN: matplotlib:[6642] trunk/matplotlib
Revision: 6642
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6642&view=rev
Author: leejjoon
Date: 2008-12-17 07:32:18 + (Wed, 17 Dec 2008)
Log Message:
---
added group id in Artist. added two svg filter example
Modified Paths:
--
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/artist.py
trunk/matplotlib/lib/matplotlib/backend_bases.py
trunk/matplotlib/lib/matplotlib/backends/backend_svg.py
trunk/matplotlib/lib/matplotlib/lines.py
trunk/matplotlib/lib/matplotlib/patches.py
trunk/matplotlib/lib/matplotlib/text.py
Added Paths:
---
trunk/matplotlib/examples/misc/svg_filter_line.py
trunk/matplotlib/examples/misc/svg_filter_pie.py
Modified: trunk/matplotlib/CHANGELOG
===
--- trunk/matplotlib/CHANGELOG 2008-12-17 00:55:52 UTC (rev 6641)
+++ trunk/matplotlib/CHANGELOG 2008-12-17 07:32:18 UTC (rev 6642)
@@ -1,3 +1,6 @@
+2008-12-17 Add group id support in artist. Two examples which
+ demostrate svg filter are added. -JJL
+
2008-12-16 Another attempt to fix dpi-dependent behavior of Legend. -JJL
2008-12-16 Fixed dpi-dependent behavior of Legend and fancybox in Text.
Added: trunk/matplotlib/examples/misc/svg_filter_line.py
===
--- trunk/matplotlib/examples/misc/svg_filter_line.py
(rev 0)
+++ trunk/matplotlib/examples/misc/svg_filter_line.py 2008-12-17 07:32:18 UTC
(rev 6642)
@@ -0,0 +1,85 @@
+"""
+Demonstrate SVG filtering effects which might be used with mpl.
+
+Note that the filtering effects are only effective if your svg rederer
+support it.
+"""
+
+import matplotlib
+
+matplotlib.use("Svg")
+
+import matplotlib.pyplot as plt
+import matplotlib.transforms as mtransforms
+
+fig1 = plt.figure()
+ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8])
+
+# draw lines
+l1, = ax.plot([0.1, 0.5, 0.9], [0.1, 0.9, 0.5], "bo-",
+ mec="b", lw=5, ms=10, label="Line 1")
+l2, = ax.plot([0.1, 0.5, 0.9], [0.5, 0.2, 0.7], "rs-",
+ mec="r", lw=5, ms=10, color="r", label="Line 2")
+
+
+for l in [l1, l2]:
+
+# draw shadows with same lines with slight offset and gray colors.
+
+xx = l.get_xdata()
+yy = l.get_ydata()
+shadow, = ax.plot(xx, yy)
+shadow.update_from(l)
+
+# adjust color
+shadow.set_color("0.2")
+# adjust zorder of the shadow lines so that it is drawn below the
+# original lines
+shadow.set_zorder(l.get_zorder()-0.5)
+
+# offset transform
+ot = mtransforms.offset_copy(l.get_transform(), fig1,
+ x=4.0, y=-6.0, units='points')
+
+shadow.set_transform(ot)
+
+# set the id for a later use
+shadow.set_gid(l.get_label()+"_shadow")
+
+
+ax.set_xlim(0., 1.)
+ax.set_ylim(0., 1.)
+
+# save the figure as a string in the svg format.
+from StringIO import StringIO
+f = StringIO()
+plt.savefig(f, format="svg")
+
+
+import xml.etree.cElementTree as ET
+
+# filter definition for a gaussian blur
+filter_def = """
+
+
+
+
+
+"""
+
+
+# read in the saved svg
+tree, xmlid = ET.XMLID(f.getvalue())
+
+# insert the filter definition in the svg dom tree.
+tree.insert(0, ET.XML(filter_def))
+
+for l in [l1, l2]:
+# pick up the svg element with given id
+shadow = xmlid[l.get_label()+"_shadow"]
+# apply shdow filter
+shadow.set("filter",'url(#dropshadow)')
+
+fn = "svg_filter_line.svg"
+print "Saving '%s'" % fn
+ET.ElementTree(tree).write(fn)
Added: trunk/matplotlib/examples/misc/svg_filter_pie.py
===
--- trunk/matplotlib/examples/misc/svg_filter_pie.py
(rev 0)
+++ trunk/matplotlib/examples/misc/svg_filter_pie.py2008-12-17 07:32:18 UTC
(rev 6642)
@@ -0,0 +1,95 @@
+"""
+Demonstrate SVG filtering effects which might be used with mpl.
+The pie chart drawing code is borrowed from pie_demo.py
+
+Note that the filtering effects are only effective if your svg rederer
+support it.
+"""
+
+
+import matplotlib
+matplotlib.use("Svg")
+
+import matplotlib.pyplot as plt
+from matplotlib.patches import Shadow
+
+# make a square figure and axes
+fig1 = plt.figure(1, figsize=(6,6))
+ax = fig1.add_axes([0.1, 0.1, 0.8, 0.8])
+
+labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
+fracs = [15,30,45, 10]
+
+explode=(0, 0.05, 0, 0)
+
+# We want to draw the shadow for each pie but we will not use "shadow"
+# option as it does'n save the references to the shadow patches.
+pies = ax.pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%')
+
+for w in pies[0]:
+# set the id with the label.
+w.set_gid(w.get_label())
+
+# we don't want to draw the edge of the pie
+w.set_ec("none")
+
+for w in pies[0]:
+# create shadow patch
+s = Shadow(w, -0.01, -0.01)
+s.set_gid(w.get_gid()+"_shadow")
+s.set_zorder(w.get_zorder() - 0.1)
+ax.add_patch(s
