[yt-svn] commit/yt: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Sun Jul 8 19:59:45 PDT 2012
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/changeset/d09ca58f7c34/
changeset: d09ca58f7c34
branch: yt
user: MatthewTurk
date: 2012-07-09 04:35:08
summary: Allowing unit specification in plot window set_width
affected #: 1 file
diff -r dab58ec7b5e2a3eacdc6fa78b8022ec89fb0cbab -r d09ca58f7c344d09c58aca6dd8d3dae3edd5a435 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -445,22 +445,27 @@
self.ylim = bounds[2:]
@invalidate_data
- def set_width(self, new_width):
+ def set_width(self, width, unit = '1'):
"""set the width of the plot window
parameters
----------
- new_width : float
- the width of the image in code units.
+ width : float
+ the width of the image.
+ unit : str
+ the unit the width has been specified in.
+ defaults to code units.
"""
Wx, Wy = self.width
+ width = width / self.pf[unit]
+
centerx = self.xlim[0] + Wx*0.5
centery = self.ylim[0] + Wy*0.5
- self.xlim = (centerx - new_width/2.,
- centerx + new_width/2.)
- self.ylim = (centery - new_width/2.,
- centery + new_width/2.)
+ self.xlim = (centerx - width/2.,
+ centerx + width/2.)
+ self.ylim = (centery - width/2.,
+ centery + width/2.)
@invalidate_data
def set_center(self, new_center):
https://bitbucket.org/yt_analysis/yt/changeset/ea35863990ca/
changeset: ea35863990ca
branch: yt
user: ngoldbaum
date: 2012-07-09 04:59:45
summary: Merged in MatthewTurk/yt (pull request #189)
affected #: 1 file
diff -r 2f4d65acfffd8552b58c6e7b11e58f96e376617a -r ea35863990ca1fab562a531a76524455eb22d49a yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -445,22 +445,27 @@
self.ylim = bounds[2:]
@invalidate_data
- def set_width(self, new_width):
+ def set_width(self, width, unit = '1'):
"""set the width of the plot window
parameters
----------
- new_width : float
- the width of the image in code units.
+ width : float
+ the width of the image.
+ unit : str
+ the unit the width has been specified in.
+ defaults to code units.
"""
Wx, Wy = self.width
+ width = width / self.pf[unit]
+
centerx = self.xlim[0] + Wx*0.5
centery = self.ylim[0] + Wy*0.5
- self.xlim = (centerx - new_width/2.,
- centerx + new_width/2.)
- self.ylim = (centery - new_width/2.,
- centery + new_width/2.)
+ self.xlim = (centerx - width/2.,
+ centerx + width/2.)
+ self.ylim = (centery - width/2.,
+ centery + width/2.)
@invalidate_data
def set_center(self, new_center):
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