[yt-svn] commit/yt: ngoldbaum: Updating the colorbar label so that fields with no units are displayed

Bitbucket commits-noreply at bitbucket.org
Sat Jul 28 01:53:04 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/b57b604c87cd/
changeset:   b57b604c87cd
branch:      yt
user:        ngoldbaum
date:        2012-07-28 10:42:04
summary:     Updating the colorbar label so that fields with no units are displayed
with no unit label.
affected #:  1 file

diff -r d1b963d7e0a7749979fcfdc3c96474c37ae11bed -r b57b604c87cd77995291a7be755b3c57dd841963 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -614,8 +614,12 @@
             self.plots[f].axes.set_xlabel(labels[0])
             self.plots[f].axes.set_ylabel(labels[1])
 
-            self.plots[f].cb.set_label(
-                r'$\rm{'+f.encode('string-escape')+r'}\/\/('+md['units']+r')$')
+            if md['units'] == None or md['units'] == '':
+                label = r'$\rm{'+f.encode('string-escape')+r'}$'
+            else:
+                label = r'$\rm{'+f.encode('string-escape')+r'}\/\/('+md['units']+r')$'
+
+            self.plots[f].cb.set_label(label)
 
             self.run_callbacks(f)

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