[yt-svn] commit/yt: MatthewTurk: Merged in Jmt354/yt (pull request #2072)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Mar 30 14:51:27 PDT 2016


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/f027ae00224c/
Changeset:   f027ae00224c
Branch:      yt
User:        MatthewTurk
Date:        2016-03-30 21:51:17+00:00
Summary:     Merged in Jmt354/yt (pull request #2072)

Edited PhasePlot class to have an annotate_title method. Closes #931
Affected #:  2 files

diff -r ac130eab01032636d00b9de431b8e5f1b4b788d6 -r f027ae00224c357e0cf4b49c3ff1afdd9d69bbaa doc/source/analyzing/mesh_filter.ipynb
--- a/doc/source/analyzing/mesh_filter.ipynb
+++ b/doc/source/analyzing/mesh_filter.ipynb
@@ -143,13 +143,13 @@
    "source": [
     "ph1 = yt.PhasePlot(ad, 'density', 'temperature', 'cell_mass', weight_field=None)\n",
     "ph1.set_xlim(3e-31, 3e-27)\n",
-    "ph1.set_title('cell_mass', 'No Cuts')\n",
+    "ph1.annotate_title('No Cuts')\n",
     "ph1.set_figure_size(5)\n",
     "ph1.show()\n",
     "\n",
     "ph1 = yt.PhasePlot(dense_ad, 'density', 'temperature', 'cell_mass', weight_field=None)\n",
     "ph1.set_xlim(3e-31, 3e-27)\n",
-    "ph1.set_title('cell_mass', 'Dense Gas')\n",
+    "ph1.annotate_title('Dense Gas')\n",
     "ph1.set_figure_size(5)\n",
     "ph1.show()"
    ]

diff -r ac130eab01032636d00b9de431b8e5f1b4b788d6 -r f027ae00224c357e0cf4b49c3ff1afdd9d69bbaa yt/visualization/profile_plotter.py
--- a/yt/visualization/profile_plotter.py
+++ b/yt/visualization/profile_plotter.py
@@ -697,7 +697,7 @@
     >>> # Change plot properties.
     >>> plot.set_cmap("cell_mass", "jet")
     >>> plot.set_zlim("cell_mass", 1e8, 1e13)
-    >>> plot.set_title("cell_mass", "This is a phase plot")
+    >>> plot.annotate_title("This is a phase plot")
 
     """
     x_log = None
@@ -1061,6 +1061,27 @@
         return self
 
     @invalidate_plot
+    def annotate_title(self, title):
+        """Set a title for the plot.
+
+        Parameters
+        ----------
+        title : str
+            The title to add.
+
+        Examples
+        --------
+
+        >>> plot.annotate_title("This is a phase plot")
+
+        """
+        for f in self.profile.field_data:
+            if isinstance(f, tuple):
+                f = f[1]
+            self.plot_title[self.data_source._determine_fields(f)[0]] = title
+        return self
+
+    @invalidate_plot
     def reset_plot(self):
         self.plots = {}
         return self

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160330/88d2661e/attachment.htm>


More information about the yt-svn mailing list