SourceForge logo
SourceForge logo
Menu

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

You can subscribe to this list here.

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


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



Showing 2 results of 2

From: <jo...@us...> - 2009年09月27日 19:06:47
Revision: 7830
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7830&view=rev
Author: jouni
Date: 2009年09月27日 19:06:37 +0000 (2009年9月27日)
Log Message:
-----------
Beginnings of a capability to test the pdf backend.
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/testing/compare.py
 trunk/matplotlib/lib/matplotlib/testing/decorators.py
Added Paths:
-----------
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/axhspan_epoch.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/axvspan_epoch.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/const_xy.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/fill_units.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_001.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_002.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_003.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_004.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_005.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/hexbin_extent.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/nonfinite_limits.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/offset_points.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_axes.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_coords.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_units.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/shaped_data.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/single_date.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/single_point.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/DateFormatter_fractionalSeconds.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/RRuleLocator_bounds.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_axhline.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_axhspan.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_axvline.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_axvspan.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_empty.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_image/image_interps.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipping.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipping_diamond.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/overflow.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/simplify_curve.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.pdf
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年09月27日 12:41:23 UTC (rev 7829)
+++ trunk/matplotlib/CHANGELOG	2009年09月27日 19:06:37 UTC (rev 7830)
@@ -1,3 +1,5 @@
+2009年09月27日 Beginnings of a capability to test the pdf backend. - JKS
+
 2009年09月27日 Add a savefig.extension rcparam to control the default 
 filename extension used by savefig. - JKS
 
Modified: trunk/matplotlib/lib/matplotlib/testing/compare.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/testing/compare.py	2009年09月27日 12:41:23 UTC (rev 7829)
+++ trunk/matplotlib/lib/matplotlib/testing/compare.py	2009年09月27日 19:06:37 UTC (rev 7830)
@@ -8,6 +8,7 @@
 import os
 import numpy as np
 import shutil
+import subprocess
 
 #=======================================================================
 
@@ -73,6 +74,33 @@
 return None
 
 #-----------------------------------------------------------------------
+# A dictionary that maps filename extensions to functions that map
+# parameters old and new to a list that can be passed to Popen to
+# convert files with that extension to png format.
+converter = { 'pdf': lambda old, new: \
+ ['gs', '-q', '-sDEVICE=png16m', '-dNOPAUSE', '-dBATCH',
+ '-sOutputFile=' + new, old],
+ }
+def convert(filename):
+ '''Convert the named file into a png file.
+ Returns the name of the created file.
+ '''
+ base, extension = filename.rsplit('.', 1)
+ if extension not in converter:
+ raise KeyError, "Don't know how to convert %s files to png" % extension
+ newname = base + '_' + extension + '.png'
+ cmd = converter[extension](filename, newname)
+ pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = pipe.communicate()
+ if not os.path.exists(newname):
+ msg = "Conversion command failed:\n%s\n" % ' '.join(cmd)
+ if stdout:
+ msg += "Standard output:\n%s\n" % stdout
+ if stderr:
+ msg += "Standard error:\n%s\n" % stderr
+ raise IOError, msg
+ return newname
+
 def compare_images( expected, actual, tol, in_decorator=False ):
 '''Compare two image files - not the greatest, but fast and good enough.
 
@@ -99,8 +127,16 @@
 "be installed. To run tests without using PIL, then use " \
 "the '--without-tag=PIL' command-line option.\n" \
 "Importing PIL failed with the following error:\n%s" % e
- return msg
+ if in_decorator:
+ raise NotImplementedError, e
+ else:
+ return msg
 
+ # Convert the image to png
+ extension = expected.split('.')[-1]
+ if extension != 'png':
+ expected, actual = convert(expected), convert(actual)
+
 # open the image files and remove the alpha channel (if it exists)
 expectedImage = Image.open( expected ).convert("RGB")
 actualImage = Image.open( actual ).convert("RGB")
Modified: trunk/matplotlib/lib/matplotlib/testing/decorators.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/testing/decorators.py	2009年09月27日 12:41:23 UTC (rev 7829)
+++ trunk/matplotlib/lib/matplotlib/testing/decorators.py	2009年09月27日 19:06:37 UTC (rev 7830)
@@ -2,6 +2,7 @@
 KnownFailureDidNotFailTest, ImageComparisonFailure
 import os, sys
 import nose
+import matplotlib
 import matplotlib.tests
 from matplotlib.testing.compare import compare_images
 
@@ -48,42 +49,54 @@
 raise ValueError('baseline_images must be specified')
 def compare_images_decorator(func):
 def decorated_compare_images(*args,**kwargs):
- result = func(*args,**kwargs)
- extension = '.png' # TODO: test more backends
- for fname in baseline_images:
- # FIXME: place "actual", or current images, images in
- # a more reasonable location than the current
- # directory. Also, perhaps put them in sub-directory
- # according to the name of the test module like the
- # baseline images.
- actual = fname + extension
 
- # compute filename for baseline image
- module_name = func.__module__
- if module_name=='__main__':
- # FIXME: this won't work for nested packages in matplotlib.tests
- import warnings
- warnings.warn('test module run as script. guessing baseline image locations')
- script_name = sys.argv[0]
- basedir = os.path.abspath(os.path.dirname(script_name))
- subdir = os.path.splitext(os.path.split(script_name)[1])[0]
- else:
- mods = module_name.split('.')
- assert mods.pop(0)=='matplotlib'
- assert mods.pop(0)=='tests'
- subdir = os.path.join(*mods)
- basedir = os.path.dirname(matplotlib.tests.__file__)
- baseline_dir = os.path.join(basedir,'baseline_images',subdir)
- expected = os.path.join(baseline_dir,fname) + extension
+ # compute baseline image directory
+ module_name = func.__module__
+ if module_name=='__main__':
+ # FIXME: this won't work for nested packages in matplotlib.tests
+ import warnings
+ warnings.warn('test module run as script. guessing baseline image locations')
+ script_name = sys.argv[0]
+ basedir = os.path.abspath(os.path.dirname(script_name))
+ subdir = os.path.splitext(os.path.split(script_name)[1])[0]
+ else:
+ mods = module_name.split('.')
+ assert mods.pop(0)=='matplotlib'
+ assert mods.pop(0)=='tests'
+ subdir = os.path.join(*mods)
+ basedir = os.path.dirname(matplotlib.tests.__file__)
+ baseline_dir = os.path.join(basedir,'baseline_images',subdir)
+ result_dir = os.path.join(basedir,'current_images',subdir)
+ if not os.path.exists(result_dir):
+ try:
+ # make the current_images directory first
+ os.mkdir(os.path.join(basedir,'current_images'))
+ except OSError:
+ pass # probably exists already
+ os.mkdir(result_dir)
 
- # compare the images
- tol=1e-3 # default tolerance
- err = compare_images( expected, actual, tol,
- in_decorator=True )
- if err:
- raise ImageComparisonFailure(
- 'images not close: %(actual)s vs. %(expected)s '
- '(RMS %(rms).3f)'%err)
- return result
+ for extension in ['png', 'pdf']:
+ # set the default format of savefig
+ matplotlib.rc('savefig', extension=extension)
+ # change to the result directory for the duration of the test
+ old_dir = os.getcwd()
+ os.chdir(result_dir)
+ try:
+ last_result = func(*args,**kwargs) # actually call the test function
+ finally:
+ os.chdir(old_dir)
+ for fname in baseline_images:
+ actual = os.path.join(result_dir, fname) + '.' + extension
+ expected = os.path.join(baseline_dir,fname) + '.' + extension
+
+ # compare the images
+ tol=1e-3 # default tolerance
+ err = compare_images( expected, actual, tol,
+ in_decorator=True )
+ if err:
+ raise ImageComparisonFailure(
+ 'images not close: %(actual)s vs. %(expected)s '
+ '(RMS %(rms).3f)'%err)
+ return last_result
 return nose.tools.make_decorator(func)(decorated_compare_images)
 return compare_images_decorator
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/axhspan_epoch.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/axhspan_epoch.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/axvspan_epoch.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/axvspan_epoch.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/const_xy.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/const_xy.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/fill_units.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/fill_units.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_001.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_001.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_002.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_002.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_003.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_003.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_004.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_004.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_005.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/formatter_ticker_005.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/hexbin_extent.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/hexbin_extent.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/nonfinite_limits.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/nonfinite_limits.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/offset_points.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/offset_points.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_axes.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_axes.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_coords.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_coords.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_units.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_units.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_180.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/polar_wrap_360.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/shaped_data.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/shaped_data.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/single_date.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/single_date.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/single_point.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_axes/single_point.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/DateFormatter_fractionalSeconds.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/DateFormatter_fractionalSeconds.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/RRuleLocator_bounds.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/RRuleLocator_bounds.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_axhline.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_axhline.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_axhspan.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_axhspan.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_axvline.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_axvline.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_axvspan.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_axvspan.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_empty.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_dates/date_empty.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_image/image_interps.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_image/image_interps.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipping.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipping.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipping_diamond.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipping_diamond.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/overflow.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/overflow.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/simplify_curve.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/simplify_curve.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_spines/spines_axes_positions.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/pdf
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jo...@us...> - 2009年09月27日 12:41:31
Revision: 7829
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7829&view=rev
Author: jouni
Date: 2009年09月27日 12:41:23 +0000 (2009年9月27日)
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.

Showing 2 results of 2

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





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

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

More information about our ad policies

Ad destination/click URL:

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