[Yt-svn] yt-commit r1450 - branches/yt-1.5/yt/raven

skillman at wrangler.dreamhost.com skillman at wrangler.dreamhost.com
Tue Sep 15 15:39:26 PDT 2009


Author: skillman
Date: Tue Sep 15 15:39:26 2009
New Revision: 1450
URL: http://yt.spacepope.org/changeset/1450

Log:
This commit fixes two things, and is the same as trunk revision r1449.

1. uncomments self._redraw_image() in PlotTypes.py.  This fixes many
problems that people encounter when changing the colormap.  However,
it does require another pixelization call, so people with very large
images may want to consider commenting this back out.

2. Adds better support for set_zlim with data that is best viewed in a
linear scale.  Before, when users had data that spanned more than an
order of magnituded in linear space, the usage of set_zlim was
producing plots that went from 0-1 times the max value.  The only
option that doesn't work is the minmaxtick=True for linear space, but
in all tests I've done there isn't a situation where you necessarily
need the min and max ticks.  Usually the linear spacer will work just
fine.




Modified:
   branches/yt-1.5/yt/raven/PlotTypes.py

Modified: branches/yt-1.5/yt/raven/PlotTypes.py
==============================================================================
--- branches/yt-1.5/yt/raven/PlotTypes.py	(original)
+++ branches/yt-1.5/yt/raven/PlotTypes.py	Tue Sep 15 15:39:26 2009
@@ -153,7 +153,7 @@
                number of ticks to be evenly spaced in log space
         """
         # This next call fixes some things, but is slower...
-        #self._redraw_image()
+        self._redraw_image()
         if (zmin in (None,'min')) or (zmax in (None,'max')):    
             imbuff = self._axes.images[-1]._A
             if zmin == 'min':
@@ -169,14 +169,22 @@
             self.colorbar.locator = matplotlib.ticker.FixedLocator(ticks)
             self.colorbar.formatter = matplotlib.ticker.FixedFormatter(["%0.2e" % (x) for x in ticks])
         elif minmaxtick:
-            ticks = na.array(self.colorbar._ticker()[1],dtype='float')
-            ticks = [zmin] + ticks.tolist() + [zmax]
-            self.colorbar.locator = matplotlib.ticker.FixedLocator(ticks)
-            self.colorbar.formatter = matplotlib.ticker.FixedFormatter(["%0.2e" % (x) for x in ticks])
-        elif nticks is not None:
-            lin = na.linspace(na.log10(zmin),na.log10(zmax),nticks)
-            self.colorbar.locator = matplotlib.ticker.FixedLocator(10**lin)
-            self.colorbar.formatter = matplotlib.ticker.FixedFormatter(["%0.2e" % (10**x) for x in lin])
+            if not self.log_field: 
+                ticks = na.array(self.colorbar._ticker()[0],dtype='float')
+                ticks = [zmin] + ticks.tolist() + [zmax]
+                self.colorbar.locator = matplotlib.ticker.FixedLocator(ticks)
+                self.colorbar.formatter = matplotlib.ticker.FixedFormatter(["%0.2e" % (x) for x in ticks])
+            else:
+                mylog.error('Sorry, we do not support minmaxtick for linear fields.  It likely comes close by default')
+       elif nticks is not None:
+            if self.log_field:
+                lin = na.linspace(na.log10(zmin),na.log10(zmax),nticks)
+                self.colorbar.locator = matplotlib.ticker.FixedLocator(10**lin)
+                self.colorbar.formatter = matplotlib.ticker.FixedFormatter(["%0.2e" % (10**x) for x in lin])
+            else: 
+                lin = na.linspace(zmin,zmax,nticks)
+                self.colorbar.locator = matplotlib.ticker.FixedLocator(lin)
+                self.colorbar.formatter = matplotlib.ticker.FixedFormatter(["%0.2e" % x for x in lin])
         else:
             if hasattr(self,'_old_locator'):
                 self.colorbar.locator = self._old_locator



More information about the yt-svn mailing list