[yt-svn] commit/yt: ngoldbaum: Fixing aspect ratios for non-square plot windows

Bitbucket commits-noreply at bitbucket.org
Thu Nov 15 12:51:59 PST 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/c57187ca13b6/
changeset:   c57187ca13b6
branch:      yt
user:        ngoldbaum
date:        2012-11-15 21:51:36
summary:     Fixing aspect ratios for non-square plot windows
affected #:  1 file

diff -r e0fea3dd96350177c6bb49727f252f2303e0fdad -r c57187ca13b69862a02b80af7b5b3eb83698a4c6 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -793,20 +793,20 @@
             else:
                 zlim = (None, None)
 
-            aspect = (self.xlim[1] - self.xlim[0]) / (self.ylim[1] - self.ylim[0])
+            plot_aspect = (self.xlim[1] - self.xlim[0]) / (self.ylim[1] - self.ylim[0])
             
             # This sets the size of the figure, and defaults to making one of the dimensions smaller.
             # This should protect against giant images in the case of a very large aspect ratio.
             norm_size = 10.0
             cbar_frac = 0.0
-            if aspect > 1.0:
-                size = (norm_size*(1.+cbar_frac), norm_size/aspect)
+            if plot_aspect > 1.0:
+                size = (norm_size*(1.+cbar_frac), norm_size/plot_aspect)
             else:
-                size = (aspect*norm_size*(1.+cbar_frac), norm_size)
+                size = (plot_aspect*norm_size*(1.+cbar_frac), norm_size)
 
             # Correct the aspect ratio in case unit_x and unit_y are different
-            aspect *= self.pf[unit_x]/self.pf[unit_y]
-
+            aspect = self.pf[unit_x]/self.pf[unit_y]
+            
             self.plots[f] = WindowPlotMPL(self._frb[f], extent, aspect, self._field_transform[f], 
                                           self._colormaps[f], size, zlim)

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