[yt-svn] commit/yt: MatthewTurk: Merged in hegan/yt/yt-3.0 (pull request #868)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Sat May 3 19:08:23 PDT 2014
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/148e82200398/
Changeset: 148e82200398
Branch: yt-3.0
User: MatthewTurk
Date: 2014-05-04 04:08:15
Summary: Merged in hegan/yt/yt-3.0 (pull request #868)
Added text labeling to annotate_halos callback
Affected #: 1 file
diff -r c05e890f48672898e8afd3f6a4c9d81a8a28b892 -r 148e82200398be3eaec221d639b0e7d7ed6cb6e2 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -866,12 +866,17 @@
region = None
_descriptor = None
- def __init__(self, halo_catalog, col='white', alpha =1, width = None):
+ def __init__(self, halo_catalog, col='white', alpha =1,
+ width = None, annotate_field = False, font_kwargs = None):
+
PlotCallback.__init__(self)
self.halo_catalog = halo_catalog
self.color = col
self.alpha = alpha
self.width = width
+ self.annotate_field = annotate_field
+ self.format_spec = text_format_spec
+ self.font_kwargs = font_kwargs
def __call__(self, plot):
data = plot.data
@@ -881,8 +886,11 @@
yy0, yy1 = plot._axes.get_ylim()
halo_data= self.halo_catalog.halos_pf.all_data()
- field_x = "particle_position_%s" % axis_names[x_dict[data.axis]]
- field_y = "particle_position_%s" % axis_names[y_dict[data.axis]]
+ axis_names = plot.data.pf.coordinates.axis_name
+ xax = plot.data.pf.coordinates.x_axis[data.axis]
+ yax = plot.data.pf.coordinates.y_axis[data.axis]
+ field_x = "particle_position_%s" % axis_names[xax]
+ field_y = "particle_position_%s" % axis_names[yax]
field_z = "particle_position_%s" % axis_names[data.axis]
plot._axes.hold(True)
@@ -922,6 +930,12 @@
plot._axes.set_ylim(yy0,yy1)
plot._axes.hold(False)
+ if self.annotate_field:
+ annotate_dat = halo_data[self.annotate_field]
+ texts = ['{0}'.format(dat) for dat in annotate_dat]
+ for pos_x, pos_y, t in zip(px, py, texts):
+ plot._axes.text(pos_x, pos_y, t, **self.font_kwargs)
+
class ParticleCallback(PlotCallback):
"""
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