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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jan 27 09:10:38 PST 2016


4 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/940b34625090/
Changeset:   940b34625090
Branch:      yt
User:        jwise77
Date:        2016-01-26 19:47:37+00:00
Summary:     Fixing additional margin issue with eps_writer.
Affected #:  1 file

diff -r 62e350b9531193afbbb0a6d97d3b1233ef25b4d2 -r 940b34625090f51df66a64ee1a4267f7e9174b28 yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py
+++ b/yt/visualization/eps_writer.py
@@ -513,6 +513,8 @@
         force_square = False
         if self.canvas is None:
             self.canvas = pyx.canvas.canvas()
+        plot.hide_colorbar()
+        plot.hide_axes()
         if isinstance(plot, (PlotWindow, PhasePlot)):
             if field is None:
                 self.field = plot.plots.keys()[0]
@@ -522,7 +524,6 @@
                 self.field = plot.data_source._determine_fields(field)[0]
             if self.field not in plot.plots.keys():
                 raise RuntimeError("Field '%s' does not exist!" % str(self.field))
-            plot.plots[self.field].hide_colorbar()
             plot.refresh()
             _p1 = plot.plots[self.field].figure
             force_square = True
@@ -538,7 +539,6 @@
         else:
             raise RuntimeError("Unknown plot type")
 
-        _p1.axes[0].set_axis_off()  # remove axes
         _p1.axes[0].set_position([0,0,1,1])  # rescale figure
         _p1.set_facecolor('w')  # set background color
         figure_canvas = FigureCanvasAgg(_p1)
@@ -547,7 +547,7 @@
 
         # Account for 1 pixel line width of the axis box and
         # non-square images after removing the colorbar.
-        yshift = -1.0 / _p1.dpi * 2.54
+        yshift = -1.0 / _p1.dpi * 2.54  # 2.54 cm = 1 in
         scale *= 1.0 - 1.0 / (_p1.dpi * self.figsize[0])
         if force_square:
             yscale = scale * float(size[1]) / float(size[0])


https://bitbucket.org/yt_analysis/yt/commits/ad933adddc84/
Changeset:   ad933adddc84
Branch:      yt
User:        jwise77
Date:        2016-01-26 19:59:13+00:00
Summary:     Refinement to the eps_writer margin bugfix to work with profile and
phase plots.
Affected #:  1 file

diff -r 940b34625090f51df66a64ee1a4267f7e9174b28 -r ad933adddc84f49f4f83e708809dee51da74a12c yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py
+++ b/yt/visualization/eps_writer.py
@@ -513,8 +513,6 @@
         force_square = False
         if self.canvas is None:
             self.canvas = pyx.canvas.canvas()
-        plot.hide_colorbar()
-        plot.hide_axes()
         if isinstance(plot, (PlotWindow, PhasePlot)):
             if field is None:
                 self.field = plot.plots.keys()[0]
@@ -524,6 +522,12 @@
                 self.field = plot.data_source._determine_fields(field)[0]
             if self.field not in plot.plots.keys():
                 raise RuntimeError("Field '%s' does not exist!" % str(self.field))
+            if isinstance(plot, PlotWindow):
+                plot.hide_colorbar()
+                plot.hide_axes()
+            else:
+                plot.plots[self.field]._toggle_axes(False)
+                plot.plots[self.field]._toggle_colorbar(False)
             plot.refresh()
             _p1 = plot.plots[self.field].figure
             force_square = True
@@ -1336,7 +1340,7 @@
     d = DualEPS(figsize=figsize)
     d.insert_image_yt(plot, field=field)
     d.axis_box_yt(plot, bare_axes=bare_axes, **kwargs)
-    if colorbar:
+    if colorbar and not isinstance(plot, ProfilePlot):
         d.colorbar_yt(plot, orientation=cb_orient)
     if savefig is not None:
         d.save_fig(savefig, format=file_format)


https://bitbucket.org/yt_analysis/yt/commits/97c6743e9181/
Changeset:   97c6743e9181
Branch:      yt
User:        jwise77
Date:        2016-01-26 22:53:45+00:00
Summary:     Removing the 1 pixel shift as it's no longer needed with the previous changeset.
Affected #:  1 file

diff -r ad933adddc84f49f4f83e708809dee51da74a12c -r 97c6743e9181ba0e6974384cb7159091059c917d yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py
+++ b/yt/visualization/eps_writer.py
@@ -549,9 +549,7 @@
         figure_canvas.draw()
         size = (_p1.get_size_inches() * _p1.dpi).astype('int')
 
-        # Account for 1 pixel line width of the axis box and
-        # non-square images after removing the colorbar.
-        yshift = -1.0 / _p1.dpi * 2.54  # 2.54 cm = 1 in
+        # Account for non-square images after removing the colorbar.
         scale *= 1.0 - 1.0 / (_p1.dpi * self.figsize[0])
         if force_square:
             yscale = scale * float(size[1]) / float(size[0])
@@ -559,7 +557,7 @@
             yscale = scale
         image = pyx.bitmap.image(size[0], size[1], "RGB",
                                  figure_canvas.tostring_rgb())
-        self.canvas.insert(pyx.bitmap.bitmap(pos[0], pos[1]+yshift, image,
+        self.canvas.insert(pyx.bitmap.bitmap(pos[0], pos[1], image,
                                              width=scale*self.figsize[0],
                                              height=yscale*self.figsize[1]))
 


https://bitbucket.org/yt_analysis/yt/commits/0522add7213b/
Changeset:   0522add7213b
Branch:      yt
User:        ngoldbaum
Date:        2016-01-27 17:10:31+00:00
Summary:     Merged in jwise77/yt (pull request #1963)

[BUGFIX] Removing large margins in eps_writer figures
Affected #:  1 file

diff -r ad95e4751bb23b3a958b77d67ff779c5546c60f1 -r 0522add7213b7a461a68756692177872680b6027 yt/visualization/eps_writer.py
--- a/yt/visualization/eps_writer.py
+++ b/yt/visualization/eps_writer.py
@@ -522,7 +522,12 @@
                 self.field = plot.data_source._determine_fields(field)[0]
             if self.field not in plot.plots.keys():
                 raise RuntimeError("Field '%s' does not exist!" % str(self.field))
-            plot.plots[self.field].hide_colorbar()
+            if isinstance(plot, PlotWindow):
+                plot.hide_colorbar()
+                plot.hide_axes()
+            else:
+                plot.plots[self.field]._toggle_axes(False)
+                plot.plots[self.field]._toggle_colorbar(False)
             plot.refresh()
             _p1 = plot.plots[self.field].figure
             force_square = True
@@ -538,16 +543,13 @@
         else:
             raise RuntimeError("Unknown plot type")
 
-        _p1.axes[0].set_axis_off()  # remove axes
         _p1.axes[0].set_position([0,0,1,1])  # rescale figure
         _p1.set_facecolor('w')  # set background color
         figure_canvas = FigureCanvasAgg(_p1)
         figure_canvas.draw()
         size = (_p1.get_size_inches() * _p1.dpi).astype('int')
 
-        # Account for 1 pixel line width of the axis box and
-        # non-square images after removing the colorbar.
-        yshift = -1.0 / _p1.dpi * 2.54
+        # Account for non-square images after removing the colorbar.
         scale *= 1.0 - 1.0 / (_p1.dpi * self.figsize[0])
         if force_square:
             yscale = scale * float(size[1]) / float(size[0])
@@ -555,7 +557,7 @@
             yscale = scale
         image = pyx.bitmap.image(size[0], size[1], "RGB",
                                  figure_canvas.tostring_rgb())
-        self.canvas.insert(pyx.bitmap.bitmap(pos[0], pos[1]+yshift, image,
+        self.canvas.insert(pyx.bitmap.bitmap(pos[0], pos[1], image,
                                              width=scale*self.figsize[0],
                                              height=yscale*self.figsize[1]))
 
@@ -1336,7 +1338,7 @@
     d = DualEPS(figsize=figsize)
     d.insert_image_yt(plot, field=field)
     d.axis_box_yt(plot, bare_axes=bare_axes, **kwargs)
-    if colorbar:
+    if colorbar and not isinstance(plot, ProfilePlot):
         d.colorbar_yt(plot, orientation=cb_orient)
     if savefig is not None:
         d.save_fig(savefig, format=file_format)

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