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

Bitbucket commits-noreply at bitbucket.org
Tue Mar 13 03:12:44 PDT 2012


2 new commits in yt:


https://bitbucket.org/yt_analysis/yt/changeset/3bdbbcca1be7/
changeset:   3bdbbcca1be7
branch:      yt
user:        jwise77
date:        2012-03-12 16:28:57
summary:     Two changes.  First, you can scale the image size in the EPS.  The
second batch of changes slightly alter the colorbar placement.
affected #:  1 file

diff -r afd860cd46d8dfca26bf7aa7a33049b654cd79c5 -r 3bdbbcca1be7820d8d80cfe95232767c895b9cd8 yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py
+++ b/yt/visualization/eps_writer.py
@@ -251,7 +251,8 @@
 
 #=============================================================================
 
-    def axis_box_yt(self, plot, units=None, bare_axes=False, **kwargs):
+    def axis_box_yt(self, plot, units=None, bare_axes=False,
+                    tickcolor=None, **kwargs):
         r"""Wrapper around DualEPS.axis_box to automatically fill in the
         axis ranges and labels from a yt plot.
 
@@ -296,7 +297,8 @@
                 units = units.replace('mpc', 'Mpc')
                 _xlabel = '%s (%s)' % (x_names[plot.data.axis], units)
                 _ylabel = '%s (%s)' % (y_names[plot.data.axis], units)
-            _tickcolor = pyx.color.cmyk.white
+            if tickcolor == None:
+                _tickcolor = pyx.color.cmyk.white
         else:
             _xrange = plot._axes.get_xlim()
             _yrange = plot._axes.get_ylim()
@@ -308,7 +310,10 @@
             else:
                 _xlabel = plot._x_label
                 _ylabel = plot._y_label
-            _tickcolor = None
+            if tickcolor == None:
+                _tickcolor = None
+        if tickcolor != None:
+            _tickcolor = tickcolor
         self.axis_box(xrange=_xrange, yrange=_yrange, xlabel=_xlabel,
                       ylabel=_ylabel, tickcolor=_tickcolor, xlog=_xlog,
                       ylog=_ylog, bare_axes=bare_axes, **kwargs)
@@ -350,7 +355,7 @@
 
 #=============================================================================
 
-    def insert_image_yt(self, plot, pos=(0,0)):
+    def insert_image_yt(self, plot, pos=(0,0), scale=1.0):
         r"""Inserts a bitmap taken from a yt plot.
 
         Parameters
@@ -398,8 +403,8 @@
                                  figure_canvas.tostring_rgb())
         #figure_canvas.print_png('test.png')
         self.canvas.insert(pyx.bitmap.bitmap(pos[0], pos[1], image,
-                                             width=self.figsize[0],
-                                             height=self.figsize[1]))
+                                             width=scale*self.figsize[0],
+                                             height=scale*self.figsize[1]))
 
 #=============================================================================
 
@@ -871,44 +876,43 @@
                 if cb_flags != None:
                     if cb_flags[index] == False:
                         continue
-                if _yt or colorbars[index] != None:
-                    if ncol == 1:
-                        orientation = "right"
-                        xpos = bbox[1]
-                        ypos = ypos0
-                    elif i == 0:
-                        orientation = "left"
-                        xpos = bbox[0]
-                        ypos = ypos0
-                    elif i+1 == ncol:
-                        orientation = "right"
-                        xpos = bbox[1]
-                        ypos = ypos0
-                    elif j == 0:
-                        orientation = "bottom"
-                        ypos = bbox[2]
-                        xpos = xpos0
-                    elif j+1 == nrow:
-                        orientation = "top"
-                        ypos = bbox[3]
-                        xpos = xpos0
+                if ncol == 1:
+                    orientation = "right"
+                    xpos = bbox[1]
+                    ypos = ypos0
+                elif j == 0:
+                    orientation = "bottom"
+                    ypos = bbox[2]
+                    xpos = xpos0
+                elif i == 0:
+                    orientation = "left"
+                    xpos = bbox[0]
+                    ypos = ypos0
+                elif i+1 == ncol:
+                    orientation = "right"
+                    xpos = bbox[1]
+                    ypos = ypos0
+                elif j+1 == nrow:
+                    orientation = "top"
+                    ypos = bbox[3]
+                    xpos = xpos0
+                else:
+                    orientation = None  # Marker for interior plot
+
+                if orientation != None:
+                    if _yt:
+                        d.colorbar_yt(yt_plots[index],
+                                      pos=[xpos,ypos],
+                                      shrink=shrink_cb,
+                                      orientation=orientation)
                     else:
-                        orientation = None  # Marker for interior plot
-
-                    if orientation != None:
-                        if _yt:
-                            d.colorbar_yt(yt_plots[index],
-                                          pos=[xpos,ypos],
-                                          shrink=shrink_cb,
-                                          orientation=orientation)
-                        else:
-                            d.colorbar(colorbars[index]["cmap"],
-                                       zrange=colorbars[index]["range"],
-                                       label=colorbars[index]["name"],
-                                       log=colorbars[index]["log"],
-                                       orientation=orientation,
-                                       pos=[xpos,ypos],
-                                       shrink=shrink_cb)
+                        d.colorbar(colorbars[index]["cmap"],
+                                   zrange=colorbars[index]["range"],
+                                   label=colorbars[index]["name"],
+                                   log=colorbars[index]["log"],
+                                   orientation=orientation,
+                                   pos=[xpos,ypos],
+                                   shrink=shrink_cb)
 
     if savefig != None:
         d.save_fig(savefig, format=format)
@@ -958,7 +962,7 @@
 #=============================================================================
 
 def single_plot(plot, figsize=(12,12), cb_orient="right", bare_axes=False,
-                savefig=None, file_format='eps'):
+                savefig=None, colorbar=True, file_format='eps', **kwargs):
     r"""Wrapper for DualEPS routines to create a figure directy from a yt
     plot.  Calls insert_image_yt, axis_box_yt, and colorbar_yt.
 
@@ -975,6 +979,8 @@
         Set to true to have no annotations or tick marks on all of the axes.
     savefig : string
         Name of the saved file without the extension.
+    colorbar : boolean
+        Set to true to include a colorbar
     file_format : string
         Format type.  Can be "eps" or "pdf"
 
@@ -986,8 +992,9 @@
     """
     d = DualEPS(figsize=figsize)
     d.insert_image_yt(plot)
-    d.axis_box_yt(plot, bare_axes=bare_axes)
-    d.colorbar_yt(plot, orientation=cb_orient)
+    d.axis_box_yt(plot, bare_axes=bare_axes, **kwargs)
+    if colorbar:
+        d.colorbar_yt(plot, orientation=cb_orient)
     if savefig != None:
         d.save_fig(savefig, format=file_format)
     return d



https://bitbucket.org/yt_analysis/yt/changeset/68fd7f993778/
changeset:   68fd7f993778
branch:      yt
user:        jwise77
date:        2012-03-12 16:29:29
summary:     Contours are oriented in the same way as the image plots.
affected #:  1 file

diff -r 3bdbbcca1be7820d8d80cfe95232767c895b9cd8 -r 68fd7f993778111e79291a0cd522df76fc8700f2 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -426,7 +426,7 @@
         y = raw_data['py']
         z = raw_data[field]
         if logit: z = na.log10(z)
-        fvals = triang(x,y).nn_interpolator(z)(xi,yi).transpose()
+        fvals = triang(x,y).nn_interpolator(z)(xi,yi).transpose()[::-1,:]
 
         fig = Figure((vi/100.0, vj/100.0), dpi = 100)
         fig.figimage(img)

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