Revision: 7829
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7829&view=rev
Author: jouni
Date: 2009-09-27 12:41:23 +0000 (Sun, 27 Sep 2009)
Log Message:
-----------
Add a savefig.extension rcparam in preparation for pdf tests
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/doc/api/api_changes.rst
trunk/matplotlib/lib/matplotlib/figure.py
trunk/matplotlib/lib/matplotlib/rcsetup.py
trunk/matplotlib/matplotlibrc.template
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-09-26 00:00:48 UTC (rev 7828)
+++ trunk/matplotlib/CHANGELOG 2009-09-27 12:41:23 UTC (rev 7829)
@@ -1,3 +1,6 @@
+2009-09-27 Add a savefig.extension rcparam to control the default
+ filename extension used by savefig. - JKS
+
===============================================
2009-09-21 Tagged for release 0.99.1
Modified: trunk/matplotlib/doc/api/api_changes.rst
===================================================================
--- trunk/matplotlib/doc/api/api_changes.rst 2009-09-26 00:00:48 UTC (rev
7828)
+++ trunk/matplotlib/doc/api/api_changes.rst 2009-09-27 12:41:23 UTC (rev
7829)
@@ -7,6 +7,9 @@
outward-facing API. If updating matplotlib breaks your scripts, this
list may help describe what changes may be necessary in your code.
+Changes beyond 0.99.x
+=====================
+
* You can now print several figures to one pdf file. See the docstrings
of the class :class:`matplotlib.backends.backend_pdf.PdfPages` for
more information.
@@ -18,42 +21,43 @@
.. _configobj: http://www.voidspace.org.uk/python/configobj.html
.. _`enthought.traits`: http://code.enthought.com/projects/traits
-Changes beyond 0.99.x
-=====================
+* The new rc parameter ``savefig.extension`` sets the filename extension
+ that is used by :meth:`matplotlib.figure.Figure.savefig` if its *fname*
+ argument lacks an extension.
-In an effort to simplify the backend API, all clipping rectangles
-and paths are now passed in using GraphicsContext objects, even
-on collections and images. Therefore::
+* In an effort to simplify the backend API, all clipping rectangles
+ and paths are now passed in using GraphicsContext objects, even
+ on collections and images. Therefore::
- draw_path_collection(self, master_transform, cliprect, clippath,
- clippath_trans, paths, all_transforms, offsets,
- offsetTrans, facecolors, edgecolors, linewidths,
- linestyles, antialiaseds, urls)
+ draw_path_collection(self, master_transform, cliprect, clippath,
+ clippath_trans, paths, all_transforms, offsets,
+ offsetTrans, facecolors, edgecolors, linewidths,
+ linestyles, antialiaseds, urls)
- # is now
+ # is now
- draw_path_collection(self, gc, master_transform, paths, all_transforms,
- offsets, offsetTrans, facecolors, edgecolors,
- linewidths, linestyles, antialiaseds, urls)
+ draw_path_collection(self, gc, master_transform, paths, all_transforms,
+ offsets, offsetTrans, facecolors, edgecolors,
+ linewidths, linestyles, antialiaseds, urls)
- draw_quad_mesh(self, master_transform, cliprect, clippath,
- clippath_trans, meshWidth, meshHeight, coordinates,
- offsets, offsetTrans, facecolors, antialiased,
- showedges)
+ draw_quad_mesh(self, master_transform, cliprect, clippath,
+ clippath_trans, meshWidth, meshHeight, coordinates,
+ offsets, offsetTrans, facecolors, antialiased,
+ showedges)
- # is now
+ # is now
- draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
- coordinates, offsets, offsetTrans, facecolors,
- antialiased, showedges)
+ draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
+ coordinates, offsets, offsetTrans, facecolors,
+ antialiased, showedges)
- draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None)
+ draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None)
- # is now
+ # is now
- draw_image(self, gc, x, y, im)
+ draw_image(self, gc, x, y, im)
Changes in 0.99
======================
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py 2009-09-26 00:00:48 UTC (rev
7828)
+++ trunk/matplotlib/lib/matplotlib/figure.py 2009-09-27 12:41:23 UTC (rev
7829)
@@ -986,7 +986,11 @@
:class:`~matplotlib.backends.backend_pdf.PdfPages`.
If *format* is *None* and *fname* is a string, the output
- format is deduced from the extension of the filename.
+ format is deduced from the extension of the filename. If
+ the filename has no extension, the value of the rc parameter
+ ``savefig.extension`` is used. If that value is 'auto',
+ the backend determines the extension.
+
If *fname* is not a string, remember to specify *format* to
ensure that the correct backend is used.
@@ -1033,6 +1037,11 @@
if key not in kwargs:
kwargs[key] = rcParams['savefig.%s'%key]
+ extension = rcParams['savefig.extension']
+ if args and '.' not in args[0] and extension != 'auto':
+ fname = args[0] + '.' + extension
+ args = (fname,) + args[1:]
+
transparent = kwargs.pop('transparent', False)
if transparent:
original_figure_alpha = self.patch.get_alpha()
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py 2009-09-26 00:00:48 UTC (rev
7828)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2009-09-27 12:41:23 UTC (rev
7829)
@@ -511,6 +511,7 @@
'savefig.facecolor' : ['w', validate_color], # facecolor; white
'savefig.edgecolor' : ['w', validate_color], # edgecolor; white
'savefig.orientation' : ['portrait', validate_orientation], # edgecolor;
white
+ 'savefig.extension' : ['auto', str], # what to add to
extensionless filenames
'cairo.format' : ['png', validate_cairo_format],
'tk.window_focus' : [False, validate_bool], # Maintain shell focus for
TkAgg
Modified: trunk/matplotlib/matplotlibrc.template
===================================================================
--- trunk/matplotlib/matplotlibrc.template 2009-09-26 00:00:48 UTC (rev
7828)
+++ trunk/matplotlib/matplotlibrc.template 2009-09-27 12:41:23 UTC (rev
7829)
@@ -306,6 +306,7 @@
#savefig.dpi : 100 # figure dots per inch
#savefig.facecolor : white # figure facecolor when saving
#savefig.edgecolor : white # figure edgecolor when saving
+#savefig.extension : auto # what extension to use for savefig('foo'), or
'auto'
#cairo.format : png # png, ps, pdf, svg
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins