[Yt-svn] yt-commit r1219 - trunk/yt/raven

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Wed Mar 18 10:19:54 PDT 2009


Author: mturk
Date: Wed Mar 18 10:19:53 2009
New Revision: 1219
URL: http://yt.spacepope.org/changeset/1219

Log:
Added a TextLabelCallback



Modified:
   trunk/yt/raven/Callbacks.py

Modified: trunk/yt/raven/Callbacks.py
==============================================================================
--- trunk/yt/raven/Callbacks.py	(original)
+++ trunk/yt/raven/Callbacks.py	Wed Mar 18 10:19:53 2009
@@ -750,3 +750,19 @@
         plot._axes.set_ylabel(ylabel,visible=True)
         plot._figure.subplots_adjust(left=0.1,right=0.8)
 
+class TextLabelCallback(PlotCallback):
+    def __init__(self, pos, text, text_args = None):
+        """
+        Accepts a position in (0..1, 0..1) of the image,
+        some text and optionally some text arguments.
+        """
+        self.pos = pos
+        self.text = text
+        if text_args is None: text_args = {}
+        self.text_args = text_args
+
+    def __call__(self, plot):
+        x = plot.image._A.shape[0] * self.pos[0]
+        y = plot.image._A.shape[1] * self.pos[1]
+        plot._axes.text(x, y, self.text, **self.text_args)
+



More information about the yt-svn mailing list