[yt-svn] commit/yt: MatthewTurk: All of the subclasses of ImagePlotContainer know how to use set_zlim, so moving
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Dec 2 06:40:08 PST 2013
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/d85c1291287f/
Changeset: d85c1291287f
Branch: yt
User: MatthewTurk
Date: 2013-12-02 15:17:43
Summary: All of the subclasses of ImagePlotContainer know how to use set_zlim, so moving
it here. This re-enables set_zlim for PhasePlots.
Affected #: 2 files
diff -r 681bb0b57391412cbcf0547d22b26e476f7c12e5 -r d85c1291287fa5e92510950868fb582e562b18a3 yt/visualization/plot_container.py
--- a/yt/visualization/plot_container.py
+++ b/yt/visualization/plot_container.py
@@ -183,9 +183,52 @@
self._colormaps[field] = cmap_name
return self
+ @invalidate_plot
def set_zlim(self, field, zmin, zmax, dynamic_range=None):
- # Left blank to be overriden in subclasses
- pass
+ """set the scale of the colormap
+
+ Parameters
+ ----------
+ field : string
+ the field to set a colormap scale
+ if field == 'all', applies to all plots.
+ zmin : float
+ the new minimum of the colormap scale. If 'min', will
+ set to the minimum value in the current view.
+ zmax : float
+ the new maximum of the colormap scale. If 'max', will
+ set to the maximum value in the current view.
+
+ Other Parameters
+ ----------------
+ dynamic_range : float (default: None)
+ The dynamic range of the image.
+ If zmin == None, will set zmin = zmax / dynamic_range
+ If zmax == None, will set zmax = zmin * dynamic_range
+ When dynamic_range is specified, defaults to setting
+ zmin = zmax / dynamic_range.
+
+ """
+ if field is 'all':
+ fields = self.plots.keys()
+ else:
+ fields = [field]
+ for field in fields:
+ myzmin = zmin
+ myzmax = zmax
+ if zmin == 'min':
+ myzmin = self.plots[field].image._A.min()
+ if zmax == 'max':
+ myzmax = self.plots[field].image._A.max()
+ if dynamic_range is not None:
+ if zmax is None:
+ myzmax = myzmin * dynamic_range
+ else:
+ myzmin = myzmax / dynamic_range
+
+ self.plots[field].zmin = myzmin
+ self.plots[field].zmax = myzmax
+ return self
def setup_callbacks(self):
# Left blank to be overriden in subclasses
diff -r 681bb0b57391412cbcf0547d22b26e476f7c12e5 -r d85c1291287fa5e92510950868fb582e562b18a3 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -730,53 +730,6 @@
self._plot_valid = True
- @invalidate_plot
- def set_zlim(self, field, zmin, zmax, dynamic_range=None):
- """set the scale of the colormap
-
- Parameters
- ----------
- field : string
- the field to set a colormap scale
- if field == 'all', applies to all plots.
- zmin : float
- the new minimum of the colormap scale. If 'min', will
- set to the minimum value in the current view.
- zmax : float
- the new maximum of the colormap scale. If 'max', will
- set to the maximum value in the current view.
-
- Other Parameters
- ----------------
- dynamic_range : float (default: None)
- The dynamic range of the image.
- If zmin == None, will set zmin = zmax / dynamic_range
- If zmax == None, will set zmax = zmin * dynamic_range
- When dynamic_range is specified, defaults to setting
- zmin = zmax / dynamic_range.
-
- """
- if field is 'all':
- fields = self.plots.keys()
- else:
- fields = [field]
- for field in fields:
- myzmin = zmin
- myzmax = zmax
- if zmin == 'min':
- myzmin = self.plots[field].image._A.min()
- if zmax == 'max':
- myzmax = self.plots[field].image._A.max()
- if dynamic_range is not None:
- if zmax is None:
- myzmax = myzmin * dynamic_range
- else:
- myzmin = myzmax / dynamic_range
-
- self.plots[field].zmin = myzmin
- self.plots[field].zmax = myzmax
- return self
-
def setup_callbacks(self):
for key in callback_registry:
ignored = ['PlotCallback','CoordAxesCallback','LabelCallback',
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