[yt-svn] commit/yt: atmyers: Merged in ngoldbaum/yt (pull request #1752)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Oct 5 11:10:51 PDT 2015
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/4cbd4de67d20/
Changeset: 4cbd4de67d20
Branch: yt
User: atmyers
Date: 2015-10-05 18:10:35+00:00
Summary: Merged in ngoldbaum/yt (pull request #1752)
[png writer] handle API change in matplotlib 1.5
Affected #: 1 file
diff -r 3f2c5cceb57bcc022dd7a8363c793c09bf89f24d -r 4cbd4de67d20e65e062507ed6fa0dee102ac9ea8 yt/utilities/png_writer.py
--- a/yt/utilities/png_writer.py
+++ b/yt/utilities/png_writer.py
@@ -10,20 +10,31 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
+import matplotlib
import matplotlib._png as _png
from yt.extern.six.moves import cStringIO
+from distutils.version import LooseVersion
+
+MPL_VERSION = LooseVersion(matplotlib.__version__)
+MPL_API_2_VERSION = LooseVersion("1.5.0")
+
+if MPL_VERSION < MPL_API_2_VERSION:
+ def call_png_write_png(buffer, width, height, filename, dpi):
+ _png.write_png(buffer, width, height, filename, dpi)
+else:
+ def call_png_write_png(buffer, width, height, filename, dpi):
+ _png.write_png(buffer, filename, dpi)
def write_png(buffer, filename, dpi=100):
width = buffer.shape[1]
height = buffer.shape[0]
- _png.write_png(buffer, width, height, filename, dpi)
+ call_png_write_png(buffer, width, height, filename, dpi)
def write_png_to_string(buffer, dpi=100, gray=0):
width = buffer.shape[1]
height = buffer.shape[0]
fileobj = cStringIO()
- _png.write_png(buffer, width, height, fileobj, dpi)
+ call_png_write_png(buffer, width, height, fileobj, dpi)
png_str = fileobj.getvalue()
fileobj.close()
return png_str
-
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list