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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat Dec 14 14:16:32 PST 2013


3 new commits in yt-doc:

https://bitbucket.org/yt_analysis/yt-doc/commits/90631272cf12/
Changeset:   90631272cf12
User:        jwise77
Date:        2013-12-02 22:49:08
Summary:     Adding a section about making EPS / PDF figures with the eps_writer.
Affected #:  1 file

diff -r c3a9cac0a7d98019d304f86181d9b236d227f889 -r 90631272cf12812b6a374337cf5da20c8d4d7e8b source/visualizing/plots.rst
--- a/source/visualizing/plots.rst
+++ b/source/visualizing/plots.rst
@@ -657,3 +657,69 @@
    p.show()
 
 The image will appear inline.
+
+.. _eps-writer:
+
+Publication-ready Figures
+-------------------------
+
+While the routines above give a convienent method to inspect and
+visualize your data, publishers often require figures to be in PDF or
+EPS format.  While the matplotlib supports vector graphics and image
+compression in PDF formats, it does not support compression in EPS
+formats.  The :class:`~yt.visualization.eps_writer.DualEPS` module
+provides an interface with the `PyX <http://pyx.sourceforge.net/>`_,
+which is a Python abstraction of the PostScript drawing model with a
+LaTeX interface.  It is optimal for publications to provide figures
+with vector graphics to avoid rasterization of the lines and text,
+along with compression to produce figures that do not have a large
+filesize.
+
+.. note::
+   PyX must be installed, which can be accomplished either manually
+   with ``pip install pyx`` or with the install script by setting
+   ``INST_PYX=1``.
+
+This module can take any of the plots mentioned above and create an
+EPS or PDF figure.  For example,
+
+.. code-block:: python
+
+   >>> import yt.visualization.eps_writer as eps
+   >>> slc = SlicePlot(pf, 'z', 'Density')
+   >>> slc.set_width(25, 'kpc')
+   >>> eps_fig = eps.single_plot(slc)
+   >>> eps_fig.save_fig('zoom', format='eps')
+   >>> eps_fig.save_fig('zoom-pdf', format='pdf')
+
+The ``eps_fig`` object exposes all of the low-level functionality of
+``PyX`` for further customization (see the `PyX documentation
+<http://pyx.sourceforge.net/manual/index.html>`_).  There are a few
+convenience routines in ``eps_writer``, such as drawing a circle,
+
+.. code-block:: python
+
+   >>> eps_fig.circle(radius=0.2, loc=(0.5,0.5))
+   >>> eps_fig.sav_fig('zoom-circle', format='eps')
+
+with a radius of 0.2 at a center of (0.5, 0.5), both of which are in
+units of the figure's field of view.  The
+:class:`~yt.visualization.eps_writer.multiplot_yt` routine also
+provides a convenient method to produce multi-panel figures
+from a PlotWindow.  For example,
+
+.. code-block:: python
+
+   >>> import yt.visualization.eps_writer as eps
+   >>> slc = SlicePlot(pf, 'z', ['Density', 'Temperature', 'Pressure',
+                       'VelocityMagnitude'])
+   >>> slc.set_width(25, 'kpc')
+   >>> eps_fig = eps.multiplot_yt(2, 2, slc, bare_axes=True)
+   >>> eps_fig.scale_line(0.2, '5 kpc')
+   >>> eps_fig.save_fig('multi', format='eps')
+
+will produce a 2x2 panel figure with a scale bar indicating 5 kpc.
+The routine will try its best to place the colorbars in the optimal
+margin, but it can be overridden by providing the keyword
+``cb_location`` with a dict of either ``right, left, top, bottom``
+with the fields as the keys.


https://bitbucket.org/yt_analysis/yt-doc/commits/ca76bae495ef/
Changeset:   ca76bae495ef
User:        jwise77
Date:        2013-12-09 21:06:44
Summary:     Merged yt_analysis/yt-doc into default
Affected #:  1 file

diff -r 90631272cf12812b6a374337cf5da20c8d4d7e8b -r ca76bae495ef06f540ddb27f626bcf8807a768a5 extensions/notebook_sphinxext.py
--- a/extensions/notebook_sphinxext.py
+++ b/extensions/notebook_sphinxext.py
@@ -29,6 +29,7 @@
 
         # Move files around.
         rel_dir = os.path.relpath(rst_dir, setup.confdir)
+        rel_path = os.path.join(rel_dir, nb_basename)
         dest_dir = os.path.join(setup.app.builder.outdir, rel_dir)
         dest_path = os.path.join(dest_dir, nb_basename)
 
@@ -43,6 +44,8 @@
 
         dest_path_eval = string.replace(dest_path, '.ipynb', '_evaluated.ipynb')
         dest_path_script = string.replace(dest_path, '.ipynb', '.py')
+        rel_path_eval = string.replace(nb_basename, '.ipynb', '_evaluated.ipynb')
+        rel_path_script = string.replace(nb_basename, '.ipynb', '.py')
 
         # Create python script vesion
         unevaluated_text = nb_to_html(nb_abs_path)
@@ -59,9 +62,9 @@
 
         # Create link to notebook and script files
         link_rst = "(" + \
-                   formatted_link(dest_path) + "; " + \
-                   formatted_link(dest_path_eval) + "; " + \
-                   formatted_link(dest_path_script) + \
+                   formatted_link(nb_basename) + "; " + \
+                   formatted_link(rel_path_eval) + "; " + \
+                   formatted_link(rel_path_script) + \
                    ")"
 
         self.state_machine.insert_input([link_rst], rst_file)


https://bitbucket.org/yt_analysis/yt-doc/commits/5cb59df7fe7d/
Changeset:   5cb59df7fe7d
User:        chummels
Date:        2013-12-14 23:16:28
Summary:     Merged in jwise77/yt-doc (pull request #139)

Adding eps_writer docs
Affected #:  1 file

diff -r 157faabb091612c5dbabce2c97ffafcc93759500 -r 5cb59df7fe7db4927d25261113244ef94a7332ae source/visualizing/plots.rst
--- a/source/visualizing/plots.rst
+++ b/source/visualizing/plots.rst
@@ -657,3 +657,69 @@
    p.show()
 
 The image will appear inline.
+
+.. _eps-writer:
+
+Publication-ready Figures
+-------------------------
+
+While the routines above give a convienent method to inspect and
+visualize your data, publishers often require figures to be in PDF or
+EPS format.  While the matplotlib supports vector graphics and image
+compression in PDF formats, it does not support compression in EPS
+formats.  The :class:`~yt.visualization.eps_writer.DualEPS` module
+provides an interface with the `PyX <http://pyx.sourceforge.net/>`_,
+which is a Python abstraction of the PostScript drawing model with a
+LaTeX interface.  It is optimal for publications to provide figures
+with vector graphics to avoid rasterization of the lines and text,
+along with compression to produce figures that do not have a large
+filesize.
+
+.. note::
+   PyX must be installed, which can be accomplished either manually
+   with ``pip install pyx`` or with the install script by setting
+   ``INST_PYX=1``.
+
+This module can take any of the plots mentioned above and create an
+EPS or PDF figure.  For example,
+
+.. code-block:: python
+
+   >>> import yt.visualization.eps_writer as eps
+   >>> slc = SlicePlot(pf, 'z', 'Density')
+   >>> slc.set_width(25, 'kpc')
+   >>> eps_fig = eps.single_plot(slc)
+   >>> eps_fig.save_fig('zoom', format='eps')
+   >>> eps_fig.save_fig('zoom-pdf', format='pdf')
+
+The ``eps_fig`` object exposes all of the low-level functionality of
+``PyX`` for further customization (see the `PyX documentation
+<http://pyx.sourceforge.net/manual/index.html>`_).  There are a few
+convenience routines in ``eps_writer``, such as drawing a circle,
+
+.. code-block:: python
+
+   >>> eps_fig.circle(radius=0.2, loc=(0.5,0.5))
+   >>> eps_fig.sav_fig('zoom-circle', format='eps')
+
+with a radius of 0.2 at a center of (0.5, 0.5), both of which are in
+units of the figure's field of view.  The
+:class:`~yt.visualization.eps_writer.multiplot_yt` routine also
+provides a convenient method to produce multi-panel figures
+from a PlotWindow.  For example,
+
+.. code-block:: python
+
+   >>> import yt.visualization.eps_writer as eps
+   >>> slc = SlicePlot(pf, 'z', ['Density', 'Temperature', 'Pressure',
+                       'VelocityMagnitude'])
+   >>> slc.set_width(25, 'kpc')
+   >>> eps_fig = eps.multiplot_yt(2, 2, slc, bare_axes=True)
+   >>> eps_fig.scale_line(0.2, '5 kpc')
+   >>> eps_fig.save_fig('multi', format='eps')
+
+will produce a 2x2 panel figure with a scale bar indicating 5 kpc.
+The routine will try its best to place the colorbars in the optimal
+margin, but it can be overridden by providing the keyword
+``cb_location`` with a dict of either ``right, left, top, bottom``
+with the fields as the keys.

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