[Yt-svn] commit/yt: jsoishi: fixed so that the linear fields have ticks. it doesn't seem to display the negative ticks, though.

Bitbucket commits-noreply at bitbucket.org
Wed Apr 27 14:53:03 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/f55cfbe89d5c/
changeset:   r4214:f55cfbe89d5c
branch:      yt
user:        jsoishi
date:        2011-04-27 23:52:17
summary:     fixed so that the linear fields have ticks. it doesn't seem to display the negative ticks, though.
affected #:  1 file (233 bytes)

--- a/yt/visualization/plot_window.py	Wed Apr 27 13:30:01 2011 -0700
+++ b/yt/visualization/plot_window.py	Wed Apr 27 14:52:17 2011 -0700
@@ -33,7 +33,7 @@
 from .fixed_resolution import \
     FixedResolutionBuffer
 from .plot_modifications import get_smallest_appropriate_unit
-from .loglocator import LogLocator
+from .loglocator import LogLocator, LinearLocator
 
 from yt.funcs import *
 from yt.utilities.amr_utils import write_png_to_file
@@ -358,18 +358,24 @@
 
     def get_ticks(self, mi, ma, height = 400, take_log = False):
         # This will eventually change to work with non-logged fields
-        if not take_log:
-            return []
-        ll = LogLocator() 
-        tick_locs = ll(mi, ma)
         ticks = []
-        mi = na.log10(mi)
-        ma = na.log10(ma)
-        for v1,v2 in zip(tick_locs, na.log10(tick_locs)):
-            if v2 < mi or v2 > ma: continue
-            p = height - height * (v2 - mi)/(ma - mi)
-            ticks.append((p,v1,v2))
-            #print v1, v2, mi, ma, height, p
+        if take_log:
+            ll = LogLocator() 
+            tick_locs = ll(mi, ma)
+            mi = na.log10(mi)
+            ma = na.log10(ma)
+            for v1,v2 in zip(tick_locs, na.log10(tick_locs)):
+                if v2 < mi or v2 > ma: continue
+                p = height - height * (v2 - mi)/(ma - mi)
+                ticks.append((p,v1,v2))
+                #print v1, v2, mi, ma, height, p
+        else:
+            ll = LinearLocator()
+            tick_locs = ll(mi, ma)
+            for v in tick_locs:
+                p = height - height * (v - mi)/(ma-mi)
+                ticks.append((p,v,v))
+
         return ticks
 
     def _get_cbar_image(self, height = 400, width = 40):

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