[yt-svn] commit/yt: jzuhone: Merged in ngoldbaum/yt (pull request #2513)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Feb 2 10:43:30 PST 2017


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/13c1ee22f924/
Changeset:   13c1ee22f924
Branch:      yt
User:        jzuhone
Date:        2017-02-02 18:43:24+00:00
Summary:     Merged in ngoldbaum/yt (pull request #2513)

make set_background_color work correctly with matplotlib colormaps. Closes #1317

Approved-by: Hsi-Yu Schive
Approved-by: John ZuHone
Affected #:  1 file

diff -r 061e062e2b4cd7299dc6e942bf771a6b6a4c236b -r 13c1ee22f924f988c6dfc68c9b64d6e9acdebfd2 yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -313,8 +313,11 @@
         actual_field = self.data_source._determine_fields(field)[0]
         if color is None:
             cmap = self._colormaps[actual_field]
-            if isinstance(cmap, string_types): 
-                cmap = yt_colormaps[cmap]
+            if isinstance(cmap, string_types):
+                try:
+                    cmap = yt_colormaps[cmap]
+                except KeyError:
+                    cmap = getattr(matplotlib.cm, cmap)
             color = cmap(0)
         if LooseVersion(matplotlib.__version__) < LooseVersion("2.0.0"):
             self.plots[actual_field].axes.set_axis_bgcolor(color)

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