[yt-svn] commit/yt: MatthewTurk: Adding automatic colorbars for to_mpl to PhasePlotter.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Aug 22 09:22:58 PDT 2013


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/43940c6b177b/
Changeset:   43940c6b177b
Branch:      yt
User:        MatthewTurk
Date:        2013-08-22 18:14:43
Summary:     Adding automatic colorbars for to_mpl to PhasePlotter.
Affected #:  1 file

diff -r f453938f33603440430a81fbb5a9ad6a62bd2320 -r 43940c6b177b36e0a69377f34cefad8ef6c6335c yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -148,15 +148,19 @@
         else:
             norm = mpl.matplotlib.colors.Normalize()
         if use_mesh:
-            pcm = axes.pcolormesh(x_bins, y_bins, self.image, norm=norm,
+            mappable = axes.pcolormesh(
+                                  x_bins, y_bins, self.image, norm=norm,
                                   shading='flat', cmap = self.cbar.cmap,
                                   rasterized=True)
             if self.x_spec.scale == 'log': axes.set_xscale("log")
             if self.y_spec.scale == 'log': axes.set_yscale("log")
         else:
-            axes.imshow(self.image, origin='lower', interpolation='nearest',
+            mappable = axes.imshow(
+                        self.image, origin='lower', interpolation='nearest',
                         cmap = self.cbar.cmap, extent = [xmi,xma,ymi,yma],
                         norm = norm)
+        cbar = figure.colorbar(mappable)
+        cbar.set_label(self.cbar.title)
         if self.x_spec.title is not None:
             axes.set_xlabel(self.x_spec.title)
         if self.y_spec.title is not None:

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