[yt-svn] commit/yt-doc: 3 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat May 25 10:36:10 PDT 2013


3 new commits in yt-doc:

https://bitbucket.org/yt_analysis/yt-doc/commits/fe2b86b21d2e/
Changeset:   fe2b86b21d2e
User:        ChrisMalone
Date:        2013-05-25 07:20:48
Summary:     add a recipe for creating just a contour plot
Affected #:  2 files

diff -r 15b17b19dff57f0de8de5c0feb378a8c72556ab2 -r fe2b86b21d2ea0211c534d1e370f59e7b6a58e5b source/cookbook/simple_contour_in_slice.py
--- /dev/null
+++ b/source/cookbook/simple_contour_in_slice.py
@@ -0,0 +1,29 @@
+from yt.mods import *
+
+# Load the data file.
+pf = load("Sedov_3d/sedov_hdf5_chk_0002")
+
+# Make a traditional slice plot.
+sp = SlicePlot(pf,"x","dens")
+
+# Overlay the slice plot with thick red contours of density.
+sp.annotate_contour("dens", ncont=3, clim=(1e-2,1e-1), label=True,
+                    plot_args={"colors": "red",
+                               "linewidths": 2})
+
+# What about some nice temperature contours in blue?
+sp.annotate_contour("temp", ncont=3, clim=(1e-8,1e-6), label=True,
+                    plot_args={"colors": "blue",
+                               "linewidths": 2})
+
+# This is the plot object.
+po = sp.plots["dens"]
+
+# Turn off the colormap image, leaving just the contours.
+po.axes.images[0].set_visible(False)
+
+# Turn off the colorbar and its label.
+po.cb.ax.set_visible(False)
+
+# Save it!
+sp.save()

diff -r 15b17b19dff57f0de8de5c0feb378a8c72556ab2 -r fe2b86b21d2ea0211c534d1e370f59e7b6a58e5b source/cookbook/simple_plots.rst
--- a/source/cookbook/simple_plots.rst
+++ b/source/cookbook/simple_plots.rst
@@ -13,6 +13,16 @@
 
 .. yt_cookbook:: simple_slice.py
 
+Simple Contours in a Slice
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Sometimes it is useful to plot just a few contours of a quantity in a
+dataset.  This shows how one does this by first making a slice, adding
+contours, and then hiding the colormap plot of the slice to leave the
+plot containing only the contours that one has added.
+
+.. yt_cookbook:: simple_contour_in_slice.py
+
 Simple Probability Distribution Functions
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 


https://bitbucket.org/yt_analysis/yt-doc/commits/a6dd161fb432/
Changeset:   a6dd161fb432
User:        ChrisMalone
Date:        2013-05-25 08:22:28
Summary:     apply Nathan's suggestion
Affected #:  1 file

diff -r fe2b86b21d2ea0211c534d1e370f59e7b6a58e5b -r a6dd161fb4324f246c771168555640aea1bafab5 source/cookbook/simple_contour_in_slice.py
--- a/source/cookbook/simple_contour_in_slice.py
+++ b/source/cookbook/simple_contour_in_slice.py
@@ -22,8 +22,11 @@
 # Turn off the colormap image, leaving just the contours.
 po.axes.images[0].set_visible(False)
 
-# Turn off the colorbar and its label.
-po.cb.ax.set_visible(False)
+# Remove the colorbar and its label.
+po.figure.delaxes(po.figure.axes[1])
+
+# Pad the plot so it fills the space taken by the removed colorbar.
+po.figure.subplots_adjust(right=0.90)
 
 # Save it!
 sp.save()


https://bitbucket.org/yt_analysis/yt-doc/commits/182946195730/
Changeset:   182946195730
User:        ChrisMalone
Date:        2013-05-25 19:34:02
Summary:     use matplotlib's tight fitting
Affected #:  1 file

diff -r a6dd161fb4324f246c771168555640aea1bafab5 -r 182946195730d16645dcf8058b93dbbbb18acc1f source/cookbook/simple_contour_in_slice.py
--- a/source/cookbook/simple_contour_in_slice.py
+++ b/source/cookbook/simple_contour_in_slice.py
@@ -25,8 +25,5 @@
 # Remove the colorbar and its label.
 po.figure.delaxes(po.figure.axes[1])
 
-# Pad the plot so it fills the space taken by the removed colorbar.
-po.figure.subplots_adjust(right=0.90)
-
-# Save it!
-sp.save()
+# Save it and ask for a close fit to get rid of the space used by the colorbar.
+sp.save(mpl_kwargs={'bbox_inches':'tight'})

Repository URL: https://bitbucket.org/yt_analysis/yt-doc/

--

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