[yt-svn] commit/yt: 2 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed May 21 11:24:08 PDT 2014


2 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/da85766a9892/
Changeset:   da85766a9892
Branch:      yt-3.0
User:        mzingale
Date:        2014-05-21 17:53:12
Summary:     use scientific notation (Latex style) for large abs() values in the
colorbar plot for volume rendering
Affected #:  1 file

diff -r c7a7d59373100ec97b0bb8e263f1c24c0ca2c8ff -r da85766a98920c3ce4c9bc3f43b4c93d347d04a4 yt/visualization/volume_rendering/transfer_functions.py
--- a/yt/visualization/volume_rendering/transfer_functions.py
+++ b/yt/visualization/volume_rendering/transfer_functions.py
@@ -540,6 +540,7 @@
         """
         from matplotlib import pyplot
         from matplotlib.ticker import FuncFormatter
+        import math
         #pyplot.clf()
         if ax is None:
             ax = pyplot.axes()
@@ -558,6 +559,7 @@
         # Set TF limits based on what is visible
         visible = np.argwhere(self.alpha.y > 1.0e-3*self.alpha.y.max())
 
+
         # Display colobar values
         xticks = np.arange(np.ceil(self.alpha.x[0]), np.floor(self.alpha.x[-1]) + 1, 1) - self.alpha.x[0]
         xticks *= self.alpha.x.size / (self.alpha.x[-1] - self.alpha.x[0])
@@ -569,7 +571,12 @@
         xticks = np.append(visible[-1], xticks)
         ax.yaxis.set_ticks(xticks)
         def x_format(x, pos):
-            return "%.1f" % (x * (self.alpha.x[-1] - self.alpha.x[0]) / (self.alpha.x.size) + self.alpha.x[0])
+            val = x * (self.alpha.x[-1] - self.alpha.x[0]) / (self.alpha.x.size) + self.alpha.x[0]
+            if abs(val) < 1.e-3 or abs(val) > 1.e4:
+                e = math.floor(math.log10(abs(val)))
+                return r"${:.2f}\times 10^{:d}$".format(val/10.0**e, int(e))
+            else:
+                return "%.1g" % (val)
         ax.yaxis.set_major_formatter(FuncFormatter(x_format))
 
         yticks = np.linspace(0,1,2,endpoint=True) * max_alpha


https://bitbucket.org/yt_analysis/yt/commits/83b72f64df46/
Changeset:   83b72f64df46
Branch:      yt-3.0
User:        mzingale
Date:        2014-05-21 20:00:40
Summary:     math -> np
Affected #:  1 file

diff -r da85766a98920c3ce4c9bc3f43b4c93d347d04a4 -r 83b72f64df4676f00cfc3b23f57d6317c86e10f5 yt/visualization/volume_rendering/transfer_functions.py
--- a/yt/visualization/volume_rendering/transfer_functions.py
+++ b/yt/visualization/volume_rendering/transfer_functions.py
@@ -540,7 +540,6 @@
         """
         from matplotlib import pyplot
         from matplotlib.ticker import FuncFormatter
-        import math
         #pyplot.clf()
         if ax is None:
             ax = pyplot.axes()
@@ -573,7 +572,7 @@
         def x_format(x, pos):
             val = x * (self.alpha.x[-1] - self.alpha.x[0]) / (self.alpha.x.size) + self.alpha.x[0]
             if abs(val) < 1.e-3 or abs(val) > 1.e4:
-                e = math.floor(math.log10(abs(val)))
+                e = np.floor(np.log10(abs(val)))
                 return r"${:.2f}\times 10^{:d}$".format(val/10.0**e, int(e))
             else:
                 return "%.1g" % (val)

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