Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Migration to sphinx-gallery #8456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 29 commits into from
Apr 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b918016
DOC starting the migration to sphinx
NelleV Mar 8, 2017
b110b1f
DOC Set up sphinx-gallery in parallel of our own gallery
NelleV Mar 9, 2017
ba6d268
DOC added sphinx-gallery as a requirement
NelleV Mar 11, 2017
c908f98
DOC Added readme files to include examples in SG
NelleV Mar 11, 2017
c61c856
DOC SG doesn't support parallel builds yet
NelleV Mar 11, 2017
eaaf182
DOC lines, bars and markers is now full SG
NelleV Mar 11, 2017
4f92501
DOC examples/statistics is fully SG
NelleV Mar 11, 2017
40eab47
DOC pie and polar charts is now full SG
NelleV Mar 11, 2017
9738124
DOC subplots, axes and figures are now full SG
NelleV Mar 11, 2017
8f8d316
DOC added ticks and spines to sphinx-gallery
NelleV Mar 12, 2017
55a5840
DOC image, contours and fields are fully SG compatible
NelleV Mar 16, 2017
9bf91a8
DOC showcase are fully SG compatible
NelleV Mar 16, 2017
f50ab00
DOC text, labels and annotations are fully SG compatible
NelleV Mar 16, 2017
7c79b12
DOC tick and spines is now full SG compatible
NelleV Mar 16, 2017
1ed25aa
DOC shapes and collections is now fully SG compatible
NelleV Mar 17, 2017
8bc4597
DOC mplot3d is fully SG-compatible
NelleV Mar 19, 2017
d5583f8
DOC The gallery is now built with sphinx-gallery
NelleV Mar 19, 2017
8f5f185
DOC all plots in the gallery now produce images
NelleV Mar 19, 2017
9d805a1
DOC API is now fully SG-compatible
NelleV Mar 19, 2017
4a13444
DOC linking to auto_examples when possible
NelleV Mar 19, 2017
8b764e7
DOC FIX nitpicks in the conf file
NelleV Mar 25, 2017
c9b2ad9
Merge branch 'sphinx_gallery' of https://github.com/NelleV/matplotlib…
choldgraf Apr 10, 2017
752cd64
switching to examples_gallery
choldgraf Apr 10, 2017
b571c51
calling it 'gallery'
choldgraf Apr 10, 2017
283f687
Remove plot_ suffix.
anntzer Apr 11, 2017
6763f83
sed source names and manual fixes
anntzer Apr 11, 2017
e01eb8d
Update .gitignore for s-g
anntzer Apr 11, 2017
356815a
Merge pull request #1 from anntzer/cleanup-plot_-prefix
choldgraf Apr 11, 2017
3f1ba02
fixing a couple links
choldgraf Apr 11, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
build
# sphinx build directory
doc/_build
doc/gallery
# setup.py dist directory
dist
# Egg metadata
Expand All @@ -57,12 +58,13 @@ lib/matplotlib/mpl-data/matplotlibrc

# Documentation generated files #
#################################
doc/api/_as_gen
doc/examples
doc/_templates/gallery.html
# autogenerated by sphinx-gallery
doc/modules
doc/pyplots/tex_demo.png
doc/users/installing.rst
doc/_static/matplotlibrc
doc/pyplots/tex_demo.png
doc/api/_as_gen
lib/dateutil
examples/*/*.pdf
examples/*/*.png
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ install:
pip install -ve .

script: source ci/travis/test_script.sh

before_cache:
- rm -rf $HOME/.cache/matplotlib/tex.cache
- rm -rf $HOME/.cache/matplotlib/test_cache
Expand Down
2 changes: 1 addition & 1 deletion ci/travis/test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if [[ $BUILD_DOCS == false ]]; then
fi
else
cd doc
python make.py html -n 2
python make.py html
# We don't build the LaTeX docs here, so linkchecker will complain
touch build/html/Matplotlib.pdf
# Linkchecker only works with python 2.7 for the time being
Expand Down
1 change: 1 addition & 0 deletions doc-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ ipython
mock
colorspacious
pillow
sphinx-gallery
3 changes: 2 additions & 1 deletion doc/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ All of these dependencies *except graphviz* can be installed through pip::

or all of them via conda and pip::

conda install sphinx numpydoc ipython mock graphviz pillow
conda install sphinx numpydoc ipython mock graphviz pillow \
sphinx-gallery
pip install colorspacious

To build the HTML documentation, type ``python make.py html`` in this
Expand Down
5 changes: 3 additions & 2 deletions doc/_templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ <h1>Introduction</h1>
<p>Matplotlib tries to make easy things easy and hard things possible.
You can generate plots, histograms, power spectra, bar charts,
errorcharts, scatterplots, etc., with just a few lines of code.
For a sampling, see the <a href="{{ pathto('users/screenshots') }}">screenshots</a>, <a href="{{ pathto('gallery') }}">thumbnail</a> gallery, and
For a sampling, see the <a href="{{ pathto('users/screenshots')
}}">screenshots</a>, <a href="{{ pathto('gallery/index') }}">thumbnail</a> gallery, and
<a href="{{ pathto('examples/index') }}">examples</a> directory</p>

<p>For simple plotting the <tt>pyplot</tt> module provides a
Expand All @@ -99,7 +100,7 @@ <h1>Documentation</h1>
</script>

<p>Trying to learn how to do a particular kind of plot? Check out
the <a href="{{ pathto('gallery') }}">gallery</a>, <a href="{{ pathto('examples/index') }}">examples</a>,
the <a href="{{ pathto('gallery/index') }}">gallery</a>, <a href="{{ pathto('examples/index') }}">examples</a>,
or the <a href="{{ pathto('api/pyplot_summary') }}">list of plotting
commands</a>.</p>

Expand Down
2 changes: 1 addition & 1 deletion doc/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h3>{{ _('Navigation') }}</h3>

<li><a href="{{ pathto('index') }}">home</a>|&nbsp;</li>
<li><a href="{{ pathto('examples/index') }}">examples</a>|&nbsp;</li>
<li><a href="{{ pathto('gallery') }}">gallery</a>|&nbsp;</li>
<li><a href="{{ pathto('gallery/index') }}">gallery</a>|&nbsp;</li>
<li><a href="{{ pathto('api/pyplot_summary') }}">pyplot</a>|&nbsp;</li>
<li><a href="{{ pathto('contents') }}">docs</a> &raquo;</li>

Expand Down
21 changes: 18 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
extensions = ['matplotlib.sphinxext.mathmpl', 'sphinxext.math_symbol_table',
'sphinx.ext.autodoc', 'matplotlib.sphinxext.only_directives',
'sphinx.ext.doctest', 'sphinx.ext.autosummary',
'matplotlib.sphinxext.plot_directive',
'sphinx.ext.inheritance_diagram',
'sphinxext.gen_gallery', 'sphinxext.gen_rst',
'sphinx_gallery.gen_gallery',
'sphinxext.gen_rst',
'matplotlib.sphinxext.plot_directive',
'sphinxext.github',
'numpydoc']

Expand All @@ -53,6 +54,12 @@
raise ImportError("No module named numpydoc - you need to install "
"numpydoc to build the documentation.")

try:
import sphinx_gallery
except ImportError:
raise ImportError("No module named sphinx_gallery - you need to install "
"sphinx_gallery to build the documentation.")

try:
import colorspacious
except ImportError:
Expand Down Expand Up @@ -96,6 +103,15 @@

autodoc_docstring_signature = True


# Sphinx gallery configuration
sphinx_gallery_conf = {
'examples_dirs': '../examples',
'filename_pattern': '\.py$',
'gallery_dirs': 'gallery'}

plot_gallery = True

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down Expand Up @@ -234,7 +250,6 @@
# Additional templates that should be rendered to pages, maps page names to
# template names.
html_additional_pages = {'index': 'index.html',
'gallery':'gallery.html',
'citing': 'citing.html'}

# If false, no module index is generated.
Expand Down
2 changes: 1 addition & 1 deletion doc/devel/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ We have hundreds of examples in subdirectories of
:file:`matplotlib/examples`, and these are automatically generated
when the website is built to show up both in the `examples
<../examples/index.html>`_ and `gallery
<../gallery.html>`_ sections of the website.
<../gallery/index.html>`_ sections of the website.

Any sample data that the example uses should be kept small and
distributed with Matplotlib in the
Expand Down
6 changes: 3 additions & 3 deletions doc/faq/howto_faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ some ratio which controls the ratio::

.. htmlonly::

See :ref:`subplots_axes_and_figures-plot_equal_aspect_ratio` for a complete
See :ref:`subplots_axes_and_figures-equal_aspect_ratio` for a complete
example.


Expand Down Expand Up @@ -398,7 +398,7 @@ locators as desired because the two axes are independent.

.. htmlonly::

See :ref:`api-plot_two_scales` for a complete example
See :ref:`api-two_scales` for a complete example

.. _howto-batch:

Expand Down Expand Up @@ -644,7 +644,7 @@ For more on configuring your backend, see

Alternatively, you can avoid pylab/pyplot altogether, which will give
you a little more control, by calling the API directly as shown in
:ref:`api-plot_agg_oo`.
:ref:`api-agg_oo`.

You can either generate hardcopy on the filesystem by calling savefig::

Expand Down
8 changes: 4 additions & 4 deletions doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ def linkcheck():
FRONTPAGE_PY_PATH = "../examples/frontpage/" # python scripts location
FRONTPAGE_PNG_PATH = "_static/" # png files location
# png files and corresponding generation scripts:
FRONTPAGE_PNGS = {"surface3d_frontpage.png": "plot_3D.py",
"contour_frontpage.png": "plot_contour.py",
"histogram_frontpage.png": "plot_histogram.py",
"membrane_frontpage.png": "plot_membrane.py"}
FRONTPAGE_PNGS = {"surface3d_frontpage.png": "3D.py",
"contour_frontpage.png": "contour.py",
"histogram_frontpage.png": "histogram.py",
"membrane_frontpage.png": "membrane.py"}


def generate_frontpage_pngs(only_if_needed=True):
Expand Down
2 changes: 1 addition & 1 deletion doc/mpl_toolkits/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ plotting (scatter, surf, line, mesh) tools. Not the fastest or feature
complete 3D library out there, but ships with Matplotlib and thus may be a
lighter weight solution for some use cases.

.. plot:: mpl_examples/mplot3d/contourf3d_demo2.py
.. plot:: gallery/mplot3d/contourf3d_2.py

.. _toolkit_axes_grid1:

Expand Down
38 changes: 19 additions & 19 deletions doc/mpl_toolkits/mplot3d/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,41 +36,41 @@ Line plots
====================
.. automethod:: Axes3D.plot

.. plot:: mpl_examples/mplot3d/lines3d_demo.py
.. plot:: gallery/mplot3d/lines3d.py

.. _scatter3d:

Scatter plots
=============
.. automethod:: Axes3D.scatter

.. plot:: mpl_examples/mplot3d/scatter3d_demo.py
.. plot:: gallery/mplot3d/scatter3d.py

.. _wireframe:

Wireframe plots
===============
.. automethod:: Axes3D.plot_wireframe

.. plot:: mpl_examples/mplot3d/wire3d_demo.py
.. plot:: gallery/mplot3d/wire3d.py

.. _surface:

Surface plots
=============
.. automethod:: Axes3D.plot_surface

.. plot:: mpl_examples/mplot3d/surface3d_demo.py
.. plot:: mpl_examples/mplot3d/surface3d_demo2.py
.. plot:: mpl_examples/mplot3d/surface3d_demo3.py
.. plot:: gallery/mplot3d/surface3d.py
.. plot:: gallery/mplot3d/surface3d_2.py
.. plot:: gallery/mplot3d/surface3d_3.py

.. _trisurface:

Tri-Surface plots
=================
.. automethod:: Axes3D.plot_trisurf

.. plot:: mpl_examples/mplot3d/trisurf3d_demo.py
.. plot:: gallery/mplot3d/trisurf3d.py


.. _contour3d:
Expand All @@ -79,18 +79,18 @@ Contour plots
=============
.. automethod:: Axes3D.contour

.. plot:: mpl_examples/mplot3d/contour3d_demo.py
.. plot:: mpl_examples/mplot3d/contour3d_demo2.py
.. plot:: mpl_examples/mplot3d/contour3d_demo3.py
.. plot:: gallery/mplot3d/contour3d.py
.. plot:: gallery/mplot3d/contour3d_2.py
.. plot:: gallery/mplot3d/contour3d_3.py

.. _contourf3d:

Filled contour plots
====================
.. automethod:: Axes3D.contourf

.. plot:: mpl_examples/mplot3d/contourf3d_demo.py
.. plot:: mpl_examples/mplot3d/contourf3d_demo2.py
.. plot:: gallery/mplot3d/contourf3d.py
.. plot:: gallery/mplot3d/contourf3d_2.py

.. versionadded:: 1.1.0
The feature demoed in the second contourf3d example was enabled as a
Expand All @@ -102,37 +102,37 @@ Polygon plots
====================
.. automethod:: Axes3D.add_collection3d

.. plot:: mpl_examples/mplot3d/polys3d_demo.py
.. plot:: gallery/mplot3d/polys3d.py

.. _bar3d:

Bar plots
====================
.. automethod:: Axes3D.bar

.. plot:: mpl_examples/mplot3d/bars3d_demo.py
.. plot:: gallery/mplot3d/bars3d.py

.. _quiver3d:

Quiver
====================
.. automethod:: Axes3D.quiver

.. plot:: mpl_examples/mplot3d/quiver3d_demo.py
.. plot:: gallery/mplot3d/quiver3d.py

.. _2dcollections3d:

2D plots in 3D
====================
.. plot:: mpl_examples/mplot3d/2dcollections3d_demo.py
.. plot:: gallery/mplot3d/2dcollections3d.py

.. _text3d:

Text
====================
.. automethod:: Axes3D.text

.. plot:: mpl_examples/mplot3d/text3d_demo.py
.. plot:: gallery/mplot3d/text3d.py

.. _3dsubplots:

Expand All @@ -146,5 +146,5 @@ in the same figure.
Subplotting 3D plots was added in v1.0.0. Earlier version can not
do this.

.. plot:: mpl_examples/mplot3d/subplot3d_demo.py
.. plot:: mpl_examples/mplot3d/mixed_subplots_demo.py
.. plot:: gallery/mplot3d/subplot3d.py
.. plot:: gallery/mplot3d/mixed_subplots.py
Loading