[yt-svn] commit/yt: 3 new changesets
Bitbucket
commits-noreply at bitbucket.org
Tue Oct 23 07:56:31 PDT 2012
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/changeset/d32adbff288e/
changeset: d32adbff288e
branch: yt
user: jsoishi
date: 2012-10-19 20:53:01
summary: added ability to label contours.
affected #: 1 file
diff -r 56c2d60a99c72bb9cf58f1c1f264787999ba7c01 -r d32adbff288ec752a92369065d999225525cec45 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -211,7 +211,7 @@
class ContourCallback(PlotCallback):
_type_name = "contour"
def __init__(self, field, ncont=5, factor=4, clim=None,
- plot_args = None):
+ plot_args = None, label = False, label_args = None):
"""
annotate_contour(self, field, ncont=5, factor=4, take_log=False, clim=None,
plot_args = None):
@@ -230,6 +230,8 @@
self.clim = clim
if plot_args is None: plot_args = {'colors':'k'}
self.plot_args = plot_args
+ self.label = label
+ self.label_args = label_args
def __call__(self, plot):
x0, x1 = plot.xlim
@@ -290,10 +292,14 @@
if self.clim is not None:
self.ncont = np.linspace(self.clim[0], self.clim[1], ncont)
- plot._axes.contour(xi,yi,zi,self.ncont, **self.plot_args)
+ cset = plot._axes.contour(xi,yi,zi,self.ncont, **self.plot_args)
plot._axes.set_xlim(xx0,xx1)
plot._axes.set_ylim(yy0,yy1)
plot._axes.hold(False)
+
+ if self.label:
+ plot._axes.clabel(cset, **self.label_args)
+
class GridBoundaryCallback(PlotCallback):
_type_name = "grids"
https://bitbucket.org/yt_analysis/yt/changeset/ef629c1944a0/
changeset: ef629c1944a0
branch: yt
user: jsoishi
date: 2012-10-23 16:54:14
summary: fixed for label_args=None case, as per Matt's suggestion.
affected #: 1 file
diff -r d32adbff288ec752a92369065d999225525cec45 -r ef629c1944a0f30ea95897b3e1d588b0bb645670 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -231,6 +231,8 @@
if plot_args is None: plot_args = {'colors':'k'}
self.plot_args = plot_args
self.label = label
+ if label_args is None:
+ label_args = {}
self.label_args = label_args
def __call__(self, plot):
https://bitbucket.org/yt_analysis/yt/changeset/82c77ccccc39/
changeset: 82c77ccccc39
branch: yt
user: MatthewTurk
date: 2012-10-23 16:56:29
summary: Merged in jsoishi/yt-fixes (pull request #310)
affected #: 1 file
diff -r 2bc7ed50b2bb9533873967c29c095f0852c0e1b5 -r 82c77ccccc39ddac6323e12d9c3c21788762339a yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -211,7 +211,7 @@
class ContourCallback(PlotCallback):
_type_name = "contour"
def __init__(self, field, ncont=5, factor=4, clim=None,
- plot_args = None):
+ plot_args = None, label = False, label_args = None):
"""
annotate_contour(self, field, ncont=5, factor=4, take_log=False, clim=None,
plot_args = None):
@@ -230,6 +230,10 @@
self.clim = clim
if plot_args is None: plot_args = {'colors':'k'}
self.plot_args = plot_args
+ self.label = label
+ if label_args is None:
+ label_args = {}
+ self.label_args = label_args
def __call__(self, plot):
x0, x1 = plot.xlim
@@ -290,10 +294,14 @@
if self.clim is not None:
self.ncont = np.linspace(self.clim[0], self.clim[1], ncont)
- plot._axes.contour(xi,yi,zi,self.ncont, **self.plot_args)
+ cset = plot._axes.contour(xi,yi,zi,self.ncont, **self.plot_args)
plot._axes.set_xlim(xx0,xx1)
plot._axes.set_ylim(yy0,yy1)
plot._axes.hold(False)
+
+ if self.label:
+ plot._axes.clabel(cset, **self.label_args)
+
class GridBoundaryCallback(PlotCallback):
_type_name = "grids"
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