diff --git a/.gitignore b/.gitignore
index 0c5a23276532..c438a51629c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,6 +32,7 @@
build
# sphinx build directory
doc/_build
+doc/gallery
# setup.py dist directory
dist
# Egg metadata
@@ -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
diff --git a/.travis.yml b/.travis.yml
index eac4d4f82e32..2bd4d5ba9ebb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -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
diff --git a/ci/travis/test_script.sh b/ci/travis/test_script.sh
index 21ee11fee066..a978fde101f4 100644
--- a/ci/travis/test_script.sh
+++ b/ci/travis/test_script.sh
@@ -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
diff --git a/doc-requirements.txt b/doc-requirements.txt
index 5d3f8759a0a7..9af746509bae 100644
--- a/doc-requirements.txt
+++ b/doc-requirements.txt
@@ -12,3 +12,4 @@ ipython
mock
colorspacious
pillow
+sphinx-gallery
diff --git a/doc/README.txt b/doc/README.txt
index d88e0b226712..925a91e67f29 100644
--- a/doc/README.txt
+++ b/doc/README.txt
@@ -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
diff --git a/doc/_templates/index.html b/doc/_templates/index.html
index 81cbed47a348..034d58b037c6 100644
--- a/doc/_templates/index.html
+++ b/doc/_templates/index.html
@@ -75,7 +75,8 @@
Introduction
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 screenshots, thumbnail gallery, and
+ For a sampling, see the screenshots, thumbnail gallery, and
examples directory
For simple plotting the pyplot module provides a
@@ -99,7 +100,7 @@
"""
-
-
-def make_thumbnail(args):
- image.thumbnail(args[0], args[1], 0.3)
-
-
-def out_of_date(original, derived):
- return (not os.path.exists(derived) or
- os.stat(derived).st_mtime < os.stat(original).st_mtime)
-
-
-def gen_gallery(app, doctree):
- if app.builder.name not in ('html', 'htmlhelp'):
- return
-
- outdir = app.builder.outdir
- rootdir = 'plot_directive/mpl_examples'
-
- example_sections = list(app.builder.config.mpl_example_sections)
- for i, (subdir, title) in enumerate(example_sections):
- if subdir in exclude_example_sections:
- example_sections.pop(i)
-
- # images we want to skip for the gallery because they are an unusual
- # size that doesn't layout well in a table, or because they may be
- # redundant with other images or uninteresting
- skips = {'mathtext_examples',
- 'matshow_02',
- 'matshow_03',
- 'matplotlib_icon'}
-
- thumbnails = {}
- rows = []
- toc_rows = []
-
- for subdir, title in example_sections:
- rows.append(header_template.format(title=title, section=subdir))
- toc_rows.append(toc_template.format(title=title, section=subdir))
-
- origdir = os.path.join('build', rootdir, subdir)
- thumbdir = os.path.join(outdir, rootdir, subdir, 'thumbnails')
- if not os.path.exists(thumbdir):
- os.makedirs(thumbdir)
-
- data = []
-
- for filename in sorted(glob.glob(os.path.join(origdir, '*.png'))):
- if filename.endswith("hires.png"):
- continue
-
- path, filename = os.path.split(filename)
- basename, ext = os.path.splitext(filename)
- if basename in skips:
- continue
-
- # Create thumbnails based on images in tmpdir, and place
- # them within the build tree
- orig_path = str(os.path.join(origdir, filename))
- thumb_path = str(os.path.join(thumbdir, filename))
- if out_of_date(orig_path, thumb_path) or True:
- thumbnails[orig_path] = thumb_path
-
- m = multiimage.match(basename)
- if m is not None:
- basename = m.group(1)
-
- data.append((subdir, basename,
- os.path.join(rootdir, subdir, 'thumbnails', filename)))
-
- for (subdir, basename, thumbfile) in data:
- if thumbfile is not None:
- link = 'examples/%s/%s.html'%(subdir, basename)
- rows.append(link_template.format(link=link,
- thumb=thumbfile,
- basename=basename,
- title=basename))
-
- if len(data) == 0:
- warnings.warn("No thumbnails were found in %s" % subdir)
-
- # Close out the
opened up at the top of this loop
- rows.append(u"
")
-
- content = gallery_template.format(toc=u'\n'.join(toc_rows),
- gallery=u'\n'.join(rows))
-
- # Only write out the file if the contents have actually changed.
- # Otherwise, this triggers a full rebuild of the docs
-
- gallery_path = os.path.join(app.builder.srcdir,
- '_templates', 'gallery.html')
- if os.path.exists(gallery_path):
- with codecs.open(gallery_path, 'r', encoding='utf-8') as fh:
- regenerate = fh.read() != content
- else:
- regenerate = True
-
- if regenerate:
- with codecs.open(gallery_path, 'w', encoding='utf-8') as fh:
- fh.write(content)
-
- for key in app.builder.status_iterator(
- iter(thumbnails), "generating thumbnails... ",
- length=len(thumbnails)):
- if out_of_date(key, thumbnails[key]):
- image.thumbnail(key, thumbnails[key], 0.3)
-
-
-def setup(app):
- app.connect('env-updated', gen_gallery)
-
- try: # multiple plugins may use mpl_example_sections
- app.add_config_value('mpl_example_sections', [], True)
- except sphinx.errors.ExtensionError:
- pass # mpl_example_sections already defined
-
- metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
- return metadata
diff --git a/doc/users/github_stats.rst b/doc/users/github_stats.rst
index e0b9a0ea48f8..a71525d2317c 100644
--- a/doc/users/github_stats.rst
+++ b/doc/users/github_stats.rst
@@ -1397,7 +1397,7 @@ Issues (889):
* :ghissue:`6509`: pylab image_masked is broken
* :ghissue:`6657`: appveyor is failing on pre-install
* :ghissue:`6610`: Icons for Tk are not antialiased.
-* :ghissue:`6687`: Small issues with the example ``polar_scatter_demo.py``
+* :ghissue:`6687`: Small issues with the example ``plot_polar_scatter.py``
* :ghissue:`6541`: Time to deprecate the GTK backend
* :ghissue:`6680`: Minor typo in the docstring of ``IdentityTransform``?
* :ghissue:`6670`: plt.text object updating incorrectly with blit=False
diff --git a/doc/users/legend_guide.rst b/doc/users/legend_guide.rst
index c7fb0621df9f..1ee6448059ce 100644
--- a/doc/users/legend_guide.rst
+++ b/doc/users/legend_guide.rst
@@ -289,8 +289,8 @@ Known examples of using legend
Here is a non-exhaustive list of the examples available involving legend
being used in various ways:
+* :ref:`api-legend`
* :ref:`lines_bars_and_markers-scatter_with_legend`
-* :ref:`api-plot_legend`
* :ref:`pylab_examples-contourf_hatching`
* :ref:`pylab_examples-figlegend_demo`
* :ref:`pylab_examples-scatter_symbol`
diff --git a/doc/users/prev_whats_new/whats_new_1.1.rst b/doc/users/prev_whats_new/whats_new_1.1.rst
index 54cd72d80063..bd704b305310 100644
--- a/doc/users/prev_whats_new/whats_new_1.1.rst
+++ b/doc/users/prev_whats_new/whats_new_1.1.rst
@@ -17,10 +17,10 @@ Sankey Diagrams
Kevin Davies has extended Yannick Copin's original Sankey example into a module
(:mod:`~matplotlib.sankey`) and provided new examples
-(:ref:`api-plot_sankey_basics`, :ref:`api-plot_sankey_links`,
-:ref:`api-plot_sankey_rankine`).
+(:ref:`api-sankey_basics`, :ref:`api-sankey_links`,
+:ref:`api-sankey_rankine`).
-.. plot:: mpl_examples/api/plot_sankey_rankine.py
+.. plot:: gallery/api/sankey_rankine.py
Animation
@@ -135,12 +135,12 @@ as 2D plotting, Ben Root has made several improvements to the
* Ticker offset display added:
-.. plot:: mpl_examples/mplot3d/offset_demo.py
+.. plot:: gallery/mplot3d/offset.py
* :meth:`~mpl_toolkits.mplot3d.axes3d.Axes3D.contourf`
gains *zdir* and *offset* kwargs. You can now do this:
-.. plot:: mpl_examples/mplot3d/contourf3d_demo2.py
+.. plot:: gallery/mplot3d/contourf3d_2.py
Numerix support removed
-----------------------
diff --git a/doc/users/prev_whats_new/whats_new_1.2.rst b/doc/users/prev_whats_new/whats_new_1.2.rst
index 7f64c1e724c1..f6dc7d2eef35 100644
--- a/doc/users/prev_whats_new/whats_new_1.2.rst
+++ b/doc/users/prev_whats_new/whats_new_1.2.rst
@@ -7,6 +7,7 @@ New in matplotlib 1.2
.. contents:: Table of Contents
:depth: 2
+
.. note::
matplotlib 1.2 supports Python 2.6, 2.7, and 3.1
@@ -61,7 +62,7 @@ Damon McDougall added a new plotting method for the
:mod:`~mpl_toolkits.mplot3d` toolkit called
:meth:`~mpl_toolkits.mplot3d.axes3d.Axes3D.plot_trisurf`.
-.. plot:: mpl_examples/mplot3d/trisurf3d_demo.py
+.. plot:: gallery/mplot3d/trisurf3d.py
Control the lengths of colorbar extensions
------------------------------------------
@@ -152,7 +153,7 @@ In addition to simply plotting the streamlines of the vector field,
line widths of the streamlines to a separate parameter, such as the speed or
local intensity of the vector field.
-.. plot:: mpl_examples/images_contours_and_fields/streamplot_demo_features.py
+.. plot:: gallery/images_contours_and_fields/streamplot_features.py
New hist functionality
diff --git a/doc/users/prev_whats_new/whats_new_1.3.rst b/doc/users/prev_whats_new/whats_new_1.3.rst
index e6372b004d28..3878f51d677c 100644
--- a/doc/users/prev_whats_new/whats_new_1.3.rst
+++ b/doc/users/prev_whats_new/whats_new_1.3.rst
@@ -91,7 +91,7 @@ before creating your plot. For really fine control, it is also possible
to modify each artist's sketch parameters individually with
:meth:`matplotlib.artist.Artist.set_sketch_params`.
-.. plot:: mpl_examples/showcase/xkcd.py
+.. plot:: gallery/showcase/xkcd.py
Updated Axes3D.contour methods
------------------------------
@@ -100,7 +100,7 @@ Damon McDougall updated the
:meth:`~mpl_toolkits.mplot3d.axes3d.Axes3D.tricontourf` methods to allow 3D
contour plots on abitrary unstructured user-specified triangulations.
-.. plot:: mpl_examples/mplot3d/tricontour3d_demo.py
+.. plot:: gallery/mplot3d/tricontour3d.py
New eventplot plot type
```````````````````````
diff --git a/doc/users/prev_whats_new/whats_new_1.4.rst b/doc/users/prev_whats_new/whats_new_1.4.rst
index 51b377f0ee05..2c1d66b36d85 100644
--- a/doc/users/prev_whats_new/whats_new_1.4.rst
+++ b/doc/users/prev_whats_new/whats_new_1.4.rst
@@ -82,8 +82,8 @@ with :func:`~matplotlib.Axes.bxp`.
Lastly, each artist (e.g., the box, outliers, cap, notches) can now be
toggled on or off and their styles can be passed in through individual
kwargs. See the examples:
-:ref:`statistics-boxplot_demo` and
-:ref:`statistics-bxp_demo`
+:ref:`statistics-boxplot` and
+:ref:`statistics-bxp`
Added a bool kwarg, :code:`manage_xticks`, which if False disables the management
of the ticks and limits on the x-axis by :func:`~matplotlib.axes.Axes.bxp`.
@@ -160,7 +160,7 @@ matplotlib internals were cleaned up to support using such transforms in
:class:`~matplotlib.Axes`. This transform is important for some plot types,
specifically the Skew-T used in meteorology.
-.. plot:: mpl_examples/api/plot_skewt.py
+.. plot:: gallery/api/skewt.py
Support for specifying properties of wedge and text in pie charts.
``````````````````````````````````````````````````````````````````
@@ -243,7 +243,7 @@ term project. This feature is documented in :func:`~mpl_toolkits.mplot3d.Axes3D.
The team members are: Ryan Steve D'Souza, Victor B, xbtsw, Yang Wang, David,
Caradec Bisesar and Vlad Vassilovski.
-.. plot:: mpl_examples/mplot3d/quiver3d_demo.py
+.. plot:: gallery/mplot3d/quiver3d.py
polar-plot r-tick locations
```````````````````````````
diff --git a/doc/users/prev_whats_new/whats_new_1.5.rst b/doc/users/prev_whats_new/whats_new_1.5.rst
index a8edf5c3b2db..11ccc4cc7365 100644
--- a/doc/users/prev_whats_new/whats_new_1.5.rst
+++ b/doc/users/prev_whats_new/whats_new_1.5.rst
@@ -109,7 +109,7 @@ You can even multiply cyclers, which is like using `itertools.product()`
on two or more property cycles. Remember to use parentheses if writing
a multi-line `prop_cycle` parameter.
-.. plot:: mpl_examples/color/color_cycle_demo.py
+.. plot:: gallery/color/color_cycle.py
New Colormaps
@@ -367,7 +367,7 @@ kwargs names is not ideal, but `Axes.fill_between` already has a
This is particularly useful for plotting pre-binned histograms.
-.. plot:: mpl_examples/api/plot_filled_step.py
+.. plot:: gallery/api/filled_step.py
Square Plot
diff --git a/doc/users/screenshots.rst b/doc/users/screenshots.rst
index d5ab16bb7870..884dc18b7992 100644
--- a/doc/users/screenshots.rst
+++ b/doc/users/screenshots.rst
@@ -22,7 +22,7 @@ Subplot demo
Multiple axes (i.e. subplots) are created with the
:func:`~matplotlib.pyplot.subplot` command:
-.. plot:: mpl_examples/subplots_axes_and_figures/subplot_demo.py
+.. plot:: gallery/subplots_axes_and_figures/subplot.py
.. _screenshots_histogram_demo:
@@ -32,7 +32,7 @@ Histograms
The :func:`~matplotlib.pyplot.hist` command automatically generates
histograms and returns the bin counts or probabilities:
-.. plot:: mpl_examples/statistics/histogram_demo_features.py
+.. plot:: gallery/statistics/histogram_features.py
.. _screenshots_path_demo:
@@ -43,7 +43,7 @@ Path demo
You can add arbitrary paths in matplotlib using the
:mod:`matplotlib.path` module:
-.. plot:: mpl_examples/shapes_and_collections/plot_path_patch.py
+.. plot:: gallery/shapes_and_collections/path_patch.py
.. _screenshots_mplot3d_surface:
@@ -54,7 +54,7 @@ The mplot3d toolkit (see :ref:`toolkit_mplot3d-tutorial` and
:ref:`mplot3d-examples-index`) has support for simple 3d graphs
including surface, wireframe, scatter, and bar charts.
-.. plot:: mpl_examples/mplot3d/surface3d_demo.py
+.. plot:: gallery/mplot3d/surface3d.py
Thanks to John Porter, Jonathon Taylor, Reinier Heeres, and Ben Root for
the `mplot3d` toolkit. This toolkit is included with all standard matplotlib
@@ -71,7 +71,7 @@ a vector field. In addition to simply plotting the streamlines, it allows you
to map the colors and/or line widths of streamlines to a separate parameter,
such as the speed or local intensity of the vector field.
-.. plot:: mpl_examples/images_contours_and_fields/streamplot_demo_features.py
+.. plot:: gallery/images_contours_and_fields/streamplot_features.py
This feature complements the :meth:`~matplotlib.pyplot.quiver` function for
plotting vector fields. Thanks to Tom Flannaghan and Tony Yu for adding the
@@ -103,7 +103,7 @@ command, which includes customizations such as error bars:
It's also simple to create stacked bars
(`bar_stacked.py <../examples/pylab_examples/bar_stacked.html>`_),
or horizontal bar charts
-(`barh_demo.py <../examples/lines_bars_and_markers/barh_demo.html>`_).
+(`barh.py <../examples/lines_bars_and_markers/barh.html>`_).
.. _screenshots_pie_demo:
@@ -117,7 +117,7 @@ exploding one or more wedges from the center of the pie, and a shadow effect.
Take a close look at the attached code, which generates this figure in just
a few lines of code.
-.. plot:: mpl_examples/pie_and_polar_charts/pie_demo_features.py
+.. plot:: gallery/pie_and_polar_charts/pie_features.py
.. _screenshots_table_demo:
@@ -166,7 +166,7 @@ Fill demo
The :func:`~matplotlib.pyplot.fill` command lets you
plot filled curves and polygons:
-.. plot:: mpl_examples/lines_bars_and_markers/fill_demo.py
+.. plot:: gallery/lines_bars_and_markers/fill.py
Thanks to Andrew Straw for adding this function.
@@ -178,7 +178,7 @@ Date demo
You can plot date data with major and minor ticks and custom tick formatters
for both.
-.. plot:: mpl_examples/api/plot_date.py
+.. plot:: gallery/api/date.py
See :mod:`matplotlib.ticker` and :mod:`matplotlib.dates` for details and usage.
@@ -217,7 +217,7 @@ The :func:`~matplotlib.pyplot.legend` command automatically
generates figure legends, with MATLAB-compatible legend placement
commands.
-.. plot:: mpl_examples/api/plot_legend.py
+.. plot:: gallery/api/legend.py
Thanks to Charles Twardy for input on the legend command.
@@ -278,4 +278,4 @@ XKCD-style sketch plots
matplotlib supports plotting in the style of `xkcd
`.
-.. plot:: mpl_examples/showcase/xkcd.py
+.. plot:: gallery/showcase/xkcd.py
diff --git a/doc/users/transforms_tutorial.rst b/doc/users/transforms_tutorial.rst
index 767ce5f428b9..fc3e574f190a 100644
--- a/doc/users/transforms_tutorial.rst
+++ b/doc/users/transforms_tutorial.rst
@@ -452,4 +452,4 @@ best way to learn more is to open the source for those packages and
see how to make your own, since matplotlib supports extensible axes
and projections. Michael Droettboom has provided a nice tutorial
example of creating a hammer projection axes; see
-:ref:`api-plot_custom_projection_example`.
+:ref:`api-custom_projection_example`.
diff --git a/examples/README b/examples/README
new file mode 100644
index 000000000000..1e89277d289b
--- /dev/null
+++ b/examples/README
@@ -0,0 +1,44 @@
+Matplotlib examples
+===================
+
+There are a variety of ways to use Matplotlib, and most of them are
+illustrated in the examples in this directory.
+
+Probably the most common way people use Matplotlib is with the
+procedural interface, which follows the MATLAB/IDL/Mathematica approach
+of using simple procedures like "plot" or "title" to modify the current
+figure. These examples are included in the "pylab_examples" directory.
+If you want to write more robust scripts, e.g., for production use or in
+a web application server, you will probably want to use the Matplotlib
+API for full control. These examples are found in the "api" directory.
+Below is a brief description of the different directories found here:
+
+ * animation - Dynamic plots, see the documentation at
+ http://matplotlib.org/api/animation_api.html
+
+ * api - working with the Matplotlib API directly.
+
+ * axes_grid1 - Examples related to the axes_grid1 toolkit.
+
+ * axisartist - Examples related to the axisartist toolkit.
+
+ * event_handling - How to interact with your figure, mouse presses,
+ key presses, object picking, etc.
+
+ * misc - Miscellaneous examples. Some demos for loading and working
+ with record arrays.
+
+ * mplot3d - 3D examples.
+
+ * pylab_examples - The interface to Matplotlib similar to MATLAB.
+
+ * tests - Tests used by Matplotlib developers to check functionality.
+ (These tests are still sometimes useful, but mostly developers should
+ use the pytest tests which perform automatic image comparison.)
+
+ * units - Working with unit data and custom types in Matplotlib.
+
+ * user_interfaces - Using Matplotlib in a GUI application, e.g.,
+ Tkinter, wxPython, PyGObject, PyQt widgets.
+
+ * widgets - Examples using interactive widgets.
diff --git a/examples/README.txt b/examples/README.txt
index 1e89277d289b..10d55859a56d 100644
--- a/examples/README.txt
+++ b/examples/README.txt
@@ -1,44 +1,8 @@
-Matplotlib examples
-===================
+.. _gallery:
-There are a variety of ways to use Matplotlib, and most of them are
-illustrated in the examples in this directory.
+Gallery
+=======
-Probably the most common way people use Matplotlib is with the
-procedural interface, which follows the MATLAB/IDL/Mathematica approach
-of using simple procedures like "plot" or "title" to modify the current
-figure. These examples are included in the "pylab_examples" directory.
-If you want to write more robust scripts, e.g., for production use or in
-a web application server, you will probably want to use the Matplotlib
-API for full control. These examples are found in the "api" directory.
-Below is a brief description of the different directories found here:
+Click on any image to see full size image and source code.
- * animation - Dynamic plots, see the documentation at
- http://matplotlib.org/api/animation_api.html
-
- * api - working with the Matplotlib API directly.
-
- * axes_grid1 - Examples related to the axes_grid1 toolkit.
-
- * axisartist - Examples related to the axisartist toolkit.
-
- * event_handling - How to interact with your figure, mouse presses,
- key presses, object picking, etc.
-
- * misc - Miscellaneous examples. Some demos for loading and working
- with record arrays.
-
- * mplot3d - 3D examples.
-
- * pylab_examples - The interface to Matplotlib similar to MATLAB.
-
- * tests - Tests used by Matplotlib developers to check functionality.
- (These tests are still sometimes useful, but mostly developers should
- use the pytest tests which perform automatic image comparison.)
-
- * units - Working with unit data and custom types in Matplotlib.
-
- * user_interfaces - Using Matplotlib in a GUI application, e.g.,
- Tkinter, wxPython, PyGObject, PyQt widgets.
-
- * widgets - Examples using interactive widgets.
+.. contents::
diff --git a/examples/api/plot_affine_image.py b/examples/api/affine_image.py
similarity index 100%
rename from examples/api/plot_affine_image.py
rename to examples/api/affine_image.py
diff --git a/examples/api/plot_agg_oo.py b/examples/api/agg_oo.py
similarity index 100%
rename from examples/api/plot_agg_oo.py
rename to examples/api/agg_oo.py
diff --git a/examples/api/plot_barchart.py b/examples/api/barchart.py
similarity index 100%
rename from examples/api/plot_barchart.py
rename to examples/api/barchart.py
diff --git a/examples/api/plot_bbox_intersect.py b/examples/api/bbox_intersect.py
similarity index 100%
rename from examples/api/plot_bbox_intersect.py
rename to examples/api/bbox_intersect.py
diff --git a/examples/api/plot_collections.py b/examples/api/collections.py
similarity index 100%
rename from examples/api/plot_collections.py
rename to examples/api/collections.py
diff --git a/examples/api/plot_colorbar_basics.py b/examples/api/colorbar_basics.py
similarity index 100%
rename from examples/api/plot_colorbar_basics.py
rename to examples/api/colorbar_basics.py
diff --git a/examples/api/plot_colorbar_only.py b/examples/api/colorbar_only.py
similarity index 100%
rename from examples/api/plot_colorbar_only.py
rename to examples/api/colorbar_only.py
diff --git a/examples/api/plot_compound_path.py b/examples/api/compound_path.py
similarity index 100%
rename from examples/api/plot_compound_path.py
rename to examples/api/compound_path.py
diff --git a/examples/api/plot_custom_projection_example.py b/examples/api/custom_projection_example.py
similarity index 100%
rename from examples/api/plot_custom_projection_example.py
rename to examples/api/custom_projection_example.py
diff --git a/examples/api/plot_custom_scale_example.py b/examples/api/custom_scale_example.py
similarity index 100%
rename from examples/api/plot_custom_scale_example.py
rename to examples/api/custom_scale_example.py
diff --git a/examples/api/plot_date.py b/examples/api/date.py
similarity index 100%
rename from examples/api/plot_date.py
rename to examples/api/date.py
diff --git a/examples/api/plot_date_index_formatter.py b/examples/api/date_index_formatter.py
similarity index 100%
rename from examples/api/plot_date_index_formatter.py
rename to examples/api/date_index_formatter.py
diff --git a/examples/api/plot_donut.py b/examples/api/donut.py
similarity index 100%
rename from examples/api/plot_donut.py
rename to examples/api/donut.py
diff --git a/examples/api/plot_engineering_formatter.py b/examples/api/engineering_formatter.py
similarity index 100%
rename from examples/api/plot_engineering_formatter.py
rename to examples/api/engineering_formatter.py
diff --git a/examples/api/plot_filled_step.py b/examples/api/filled_step.py
similarity index 100%
rename from examples/api/plot_filled_step.py
rename to examples/api/filled_step.py
diff --git a/examples/api/plot_font_family_rc.py b/examples/api/font_family_rc.py
similarity index 100%
rename from examples/api/plot_font_family_rc.py
rename to examples/api/font_family_rc.py
diff --git a/examples/api/plot_font_file.py b/examples/api/font_file.py
similarity index 100%
rename from examples/api/plot_font_file.py
rename to examples/api/font_file.py
diff --git a/examples/api/plot_histogram_path.py b/examples/api/histogram_path.py
similarity index 100%
rename from examples/api/plot_histogram_path.py
rename to examples/api/histogram_path.py
diff --git a/examples/api/plot_image_zcoord.py b/examples/api/image_zcoord.py
similarity index 100%
rename from examples/api/plot_image_zcoord.py
rename to examples/api/image_zcoord.py
diff --git a/examples/api/plot_joinstyle.py b/examples/api/joinstyle.py
similarity index 100%
rename from examples/api/plot_joinstyle.py
rename to examples/api/joinstyle.py
diff --git a/examples/api/plot_legend.py b/examples/api/legend.py
similarity index 100%
rename from examples/api/plot_legend.py
rename to examples/api/legend.py
diff --git a/examples/api/plot_line_with_text.py b/examples/api/line_with_text.py
similarity index 100%
rename from examples/api/plot_line_with_text.py
rename to examples/api/line_with_text.py
diff --git a/examples/api/plot_logos2.py b/examples/api/logos2.py
similarity index 100%
rename from examples/api/plot_logos2.py
rename to examples/api/logos2.py
diff --git a/examples/api/plot_mathtext_asarray.py b/examples/api/mathtext_asarray.py
similarity index 100%
rename from examples/api/plot_mathtext_asarray.py
rename to examples/api/mathtext_asarray.py
diff --git a/examples/api/plot_patch_collection.py b/examples/api/patch_collection.py
similarity index 96%
rename from examples/api/plot_patch_collection.py
rename to examples/api/patch_collection.py
index a39ab4ad56a0..d3e6ec5d0556 100644
--- a/examples/api/plot_patch_collection.py
+++ b/examples/api/patch_collection.py
@@ -2,6 +2,8 @@
============================
Circles, Wedges and Polygons
============================
+
+This example demonstrates how to use patch collections.
"""
import numpy as np
diff --git a/examples/api/plot_power_norm.py b/examples/api/power_norm.py
similarity index 100%
rename from examples/api/plot_power_norm.py
rename to examples/api/power_norm.py
diff --git a/examples/api/plot_quad_bezier.py b/examples/api/quad_bezier.py
similarity index 100%
rename from examples/api/plot_quad_bezier.py
rename to examples/api/quad_bezier.py
diff --git a/examples/api/plot_radar_chart.py b/examples/api/radar_chart.py
similarity index 100%
rename from examples/api/plot_radar_chart.py
rename to examples/api/radar_chart.py
diff --git a/examples/api/plot_sankey_basics.py b/examples/api/sankey_basics.py
similarity index 100%
rename from examples/api/plot_sankey_basics.py
rename to examples/api/sankey_basics.py
diff --git a/examples/api/plot_sankey_links.py b/examples/api/sankey_links.py
similarity index 100%
rename from examples/api/plot_sankey_links.py
rename to examples/api/sankey_links.py
diff --git a/examples/api/plot_sankey_rankine.py b/examples/api/sankey_rankine.py
similarity index 100%
rename from examples/api/plot_sankey_rankine.py
rename to examples/api/sankey_rankine.py
diff --git a/examples/api/plot_scatter_piecharts.py b/examples/api/scatter_piecharts.py
similarity index 100%
rename from examples/api/plot_scatter_piecharts.py
rename to examples/api/scatter_piecharts.py
diff --git a/examples/api/plot_skewt.py b/examples/api/skewt.py
similarity index 100%
rename from examples/api/plot_skewt.py
rename to examples/api/skewt.py
diff --git a/examples/api/plot_span_regions.py b/examples/api/span_regions.py
similarity index 100%
rename from examples/api/plot_span_regions.py
rename to examples/api/span_regions.py
diff --git a/examples/api/plot_two_scales.py b/examples/api/two_scales.py
similarity index 100%
rename from examples/api/plot_two_scales.py
rename to examples/api/two_scales.py
diff --git a/examples/api/plot_unicode_minus.py b/examples/api/unicode_minus.py
similarity index 100%
rename from examples/api/plot_unicode_minus.py
rename to examples/api/unicode_minus.py
diff --git a/examples/api/plot_watermark_image.py b/examples/api/watermark_image.py
similarity index 100%
rename from examples/api/plot_watermark_image.py
rename to examples/api/watermark_image.py
diff --git a/examples/api/plot_watermark_text.py b/examples/api/watermark_text.py
similarity index 100%
rename from examples/api/plot_watermark_text.py
rename to examples/api/watermark_text.py
diff --git a/examples/color/README.txt b/examples/color/README.txt
new file mode 100644
index 000000000000..7bd143064172
--- /dev/null
+++ b/examples/color/README.txt
@@ -0,0 +1,4 @@
+.. _color_examples:
+
+Color
+=====
diff --git a/examples/color/color_cycle_demo.py b/examples/color/color_cycle.py
similarity index 100%
rename from examples/color/color_cycle_demo.py
rename to examples/color/color_cycle.py
diff --git a/examples/event_handling/README.txt b/examples/event_handling/README
similarity index 100%
rename from examples/event_handling/README.txt
rename to examples/event_handling/README
diff --git a/examples/frontpage/plot_3D.py b/examples/frontpage/3D.py
similarity index 100%
rename from examples/frontpage/plot_3D.py
rename to examples/frontpage/3D.py
diff --git a/examples/frontpage/plot_contour.py b/examples/frontpage/contour.py
similarity index 100%
rename from examples/frontpage/plot_contour.py
rename to examples/frontpage/contour.py
diff --git a/examples/frontpage/plot_histogram.py b/examples/frontpage/histogram.py
similarity index 100%
rename from examples/frontpage/plot_histogram.py
rename to examples/frontpage/histogram.py
diff --git a/examples/frontpage/plot_membrane.py b/examples/frontpage/membrane.py
similarity index 100%
rename from examples/frontpage/plot_membrane.py
rename to examples/frontpage/membrane.py
diff --git a/examples/images_contours_and_fields/README.txt b/examples/images_contours_and_fields/README.txt
new file mode 100644
index 000000000000..882de6f57c37
--- /dev/null
+++ b/examples/images_contours_and_fields/README.txt
@@ -0,0 +1,4 @@
+.. _images_contours_and_fields_examples:
+
+Images, contours and fields
+===========================
diff --git a/examples/images_contours_and_fields/image_demo_clip_path.py b/examples/images_contours_and_fields/image_clip_path.py
similarity index 100%
rename from examples/images_contours_and_fields/image_demo_clip_path.py
rename to examples/images_contours_and_fields/image_clip_path.py
diff --git a/examples/images_contours_and_fields/streamplot_demo_features.py b/examples/images_contours_and_fields/streamplot_features.py
similarity index 100%
rename from examples/images_contours_and_fields/streamplot_demo_features.py
rename to examples/images_contours_and_fields/streamplot_features.py
diff --git a/examples/images_contours_and_fields/streamplot_demo_masking.py b/examples/images_contours_and_fields/streamplot_masking.py
similarity index 100%
rename from examples/images_contours_and_fields/streamplot_demo_masking.py
rename to examples/images_contours_and_fields/streamplot_masking.py
diff --git a/examples/images_contours_and_fields/streamplot_demo_start_points.py b/examples/images_contours_and_fields/streamplot_start_points.py
similarity index 100%
rename from examples/images_contours_and_fields/streamplot_demo_start_points.py
rename to examples/images_contours_and_fields/streamplot_start_points.py
diff --git a/examples/lines_bars_and_markers/README.txt b/examples/lines_bars_and_markers/README.txt
new file mode 100644
index 000000000000..a842344008fa
--- /dev/null
+++ b/examples/lines_bars_and_markers/README.txt
@@ -0,0 +1,4 @@
+.. _lines_bars_and_markers_example:
+
+Lines, bars and markers
+=======================
diff --git a/examples/lines_bars_and_markers/barh_demo.py b/examples/lines_bars_and_markers/barh.py
similarity index 100%
rename from examples/lines_bars_and_markers/barh_demo.py
rename to examples/lines_bars_and_markers/barh.py
diff --git a/examples/lines_bars_and_markers/cohere_demo.py b/examples/lines_bars_and_markers/cohere.py
similarity index 100%
rename from examples/lines_bars_and_markers/cohere_demo.py
rename to examples/lines_bars_and_markers/cohere.py
diff --git a/examples/lines_bars_and_markers/fill_demo.py b/examples/lines_bars_and_markers/fill.py
similarity index 100%
rename from examples/lines_bars_and_markers/fill_demo.py
rename to examples/lines_bars_and_markers/fill.py
diff --git a/examples/lines_bars_and_markers/scatter_with_legend.py b/examples/lines_bars_and_markers/scatter_with_legend.py
index 8f86bc51f8ed..bca9215ef8aa 100644
--- a/examples/lines_bars_and_markers/scatter_with_legend.py
+++ b/examples/lines_bars_and_markers/scatter_with_legend.py
@@ -1,5 +1,7 @@
'''
-Demo of a scatter plot (scatter) with a legend.
+===========================
+Scatter plots with a legend
+===========================
Also demonstrates how transparency of the markers
can be adjusted by giving ``alpha`` a value between
diff --git a/examples/mplot3d/2dcollections3d_demo.py b/examples/mplot3d/2dcollections3d.py
similarity index 100%
rename from examples/mplot3d/2dcollections3d_demo.py
rename to examples/mplot3d/2dcollections3d.py
diff --git a/examples/mplot3d/plot_3d_bars.py b/examples/mplot3d/3d_bars.py
similarity index 100%
rename from examples/mplot3d/plot_3d_bars.py
rename to examples/mplot3d/3d_bars.py
diff --git a/examples/mplot3d/README.txt b/examples/mplot3d/README.txt
new file mode 100644
index 000000000000..7a7402f9c8d2
--- /dev/null
+++ b/examples/mplot3d/README.txt
@@ -0,0 +1,4 @@
+.. _mplot3d_example:
+
+mplot3d toolkit
+===============
diff --git a/examples/mplot3d/bars3d_demo.py b/examples/mplot3d/bars3d.py
similarity index 100%
rename from examples/mplot3d/bars3d_demo.py
rename to examples/mplot3d/bars3d.py
diff --git a/examples/mplot3d/contour3d_demo.py b/examples/mplot3d/contour3d.py
similarity index 100%
rename from examples/mplot3d/contour3d_demo.py
rename to examples/mplot3d/contour3d.py
diff --git a/examples/mplot3d/contour3d_demo2.py b/examples/mplot3d/contour3d_2.py
similarity index 100%
rename from examples/mplot3d/contour3d_demo2.py
rename to examples/mplot3d/contour3d_2.py
diff --git a/examples/mplot3d/contour3d_demo3.py b/examples/mplot3d/contour3d_3.py
similarity index 100%
rename from examples/mplot3d/contour3d_demo3.py
rename to examples/mplot3d/contour3d_3.py
diff --git a/examples/mplot3d/contourf3d_demo.py b/examples/mplot3d/contourf3d.py
similarity index 100%
rename from examples/mplot3d/contourf3d_demo.py
rename to examples/mplot3d/contourf3d.py
diff --git a/examples/mplot3d/contourf3d_demo2.py b/examples/mplot3d/contourf3d_2.py
similarity index 100%
rename from examples/mplot3d/contourf3d_demo2.py
rename to examples/mplot3d/contourf3d_2.py
diff --git a/examples/mplot3d/hist3d_demo.py b/examples/mplot3d/hist3d.py
similarity index 100%
rename from examples/mplot3d/hist3d_demo.py
rename to examples/mplot3d/hist3d.py
diff --git a/examples/mplot3d/lines3d_demo.py b/examples/mplot3d/lines3d.py
similarity index 100%
rename from examples/mplot3d/lines3d_demo.py
rename to examples/mplot3d/lines3d.py
diff --git a/examples/mplot3d/mixed_subplots_demo.py b/examples/mplot3d/mixed_subplots.py
similarity index 100%
rename from examples/mplot3d/mixed_subplots_demo.py
rename to examples/mplot3d/mixed_subplots.py
diff --git a/examples/mplot3d/offset_demo.py b/examples/mplot3d/offset.py
similarity index 100%
rename from examples/mplot3d/offset_demo.py
rename to examples/mplot3d/offset.py
diff --git a/examples/mplot3d/pathpatch3d_demo.py b/examples/mplot3d/pathpatch3d.py
similarity index 100%
rename from examples/mplot3d/pathpatch3d_demo.py
rename to examples/mplot3d/pathpatch3d.py
diff --git a/examples/mplot3d/polys3d_demo.py b/examples/mplot3d/polys3d.py
similarity index 100%
rename from examples/mplot3d/polys3d_demo.py
rename to examples/mplot3d/polys3d.py
diff --git a/examples/mplot3d/quiver3d_demo.py b/examples/mplot3d/quiver3d.py
similarity index 100%
rename from examples/mplot3d/quiver3d_demo.py
rename to examples/mplot3d/quiver3d.py
diff --git a/examples/mplot3d/rotate_axes3d_demo.py b/examples/mplot3d/rotate_axes3d.py
similarity index 100%
rename from examples/mplot3d/rotate_axes3d_demo.py
rename to examples/mplot3d/rotate_axes3d.py
diff --git a/examples/mplot3d/scatter3d_demo.py b/examples/mplot3d/scatter3d.py
similarity index 100%
rename from examples/mplot3d/scatter3d_demo.py
rename to examples/mplot3d/scatter3d.py
diff --git a/examples/mplot3d/subplot3d_demo.py b/examples/mplot3d/subplot3d.py
similarity index 100%
rename from examples/mplot3d/subplot3d_demo.py
rename to examples/mplot3d/subplot3d.py
diff --git a/examples/mplot3d/surface3d_demo.py b/examples/mplot3d/surface3d.py
similarity index 100%
rename from examples/mplot3d/surface3d_demo.py
rename to examples/mplot3d/surface3d.py
diff --git a/examples/mplot3d/surface3d_demo2.py b/examples/mplot3d/surface3d_2.py
similarity index 100%
rename from examples/mplot3d/surface3d_demo2.py
rename to examples/mplot3d/surface3d_2.py
diff --git a/examples/mplot3d/surface3d_demo3.py b/examples/mplot3d/surface3d_3.py
similarity index 100%
rename from examples/mplot3d/surface3d_demo3.py
rename to examples/mplot3d/surface3d_3.py
diff --git a/examples/mplot3d/surface3d_radial_demo.py b/examples/mplot3d/surface3d_radial.py
similarity index 100%
rename from examples/mplot3d/surface3d_radial_demo.py
rename to examples/mplot3d/surface3d_radial.py
diff --git a/examples/mplot3d/text3d_demo.py b/examples/mplot3d/text3d.py
similarity index 76%
rename from examples/mplot3d/text3d_demo.py
rename to examples/mplot3d/text3d.py
index 6b1963e2a43b..d26cf2b74eaf 100644
--- a/examples/mplot3d/text3d_demo.py
+++ b/examples/mplot3d/text3d.py
@@ -6,10 +6,14 @@
Demonstrates the placement of text annotations on a 3D plot.
Functionality shown:
-- Using the text function with three types of 'zdir' values: None,
- an axis name (ex. 'x'), or a direction tuple (ex. (1, 1, 0)).
-- Using the text function with the color keyword.
-- Using the text2D function to place text on a fixed position on the ax object.
+
+ - Using the text function with three types of 'zdir' values: None, an axis
+ name (ex. 'x'), or a direction tuple (ex. (1, 1, 0)).
+ - Using the text function with the color keyword.
+
+ - Using the text2D function to place text on a fixed position on the ax
+ object.
+
'''
from mpl_toolkits.mplot3d import Axes3D
diff --git a/examples/mplot3d/tricontour3d_demo.py b/examples/mplot3d/tricontour3d.py
similarity index 100%
rename from examples/mplot3d/tricontour3d_demo.py
rename to examples/mplot3d/tricontour3d.py
diff --git a/examples/mplot3d/tricontourf3d_demo.py b/examples/mplot3d/tricontourf3d.py
similarity index 100%
rename from examples/mplot3d/tricontourf3d_demo.py
rename to examples/mplot3d/tricontourf3d.py
diff --git a/examples/mplot3d/trisurf3d_demo.py b/examples/mplot3d/trisurf3d.py
similarity index 100%
rename from examples/mplot3d/trisurf3d_demo.py
rename to examples/mplot3d/trisurf3d.py
diff --git a/examples/mplot3d/trisurf3d_demo2.py b/examples/mplot3d/trisurf3d_2.py
similarity index 100%
rename from examples/mplot3d/trisurf3d_demo2.py
rename to examples/mplot3d/trisurf3d_2.py
diff --git a/examples/mplot3d/wire3d_demo.py b/examples/mplot3d/wire3d.py
similarity index 100%
rename from examples/mplot3d/wire3d_demo.py
rename to examples/mplot3d/wire3d.py
diff --git a/examples/mplot3d/wire3d_animation_demo.py b/examples/mplot3d/wire3d_animation.py
similarity index 100%
rename from examples/mplot3d/wire3d_animation_demo.py
rename to examples/mplot3d/wire3d_animation.py
diff --git a/examples/pie_and_polar_charts/README.txt b/examples/pie_and_polar_charts/README.txt
new file mode 100644
index 000000000000..31f87c586495
--- /dev/null
+++ b/examples/pie_and_polar_charts/README.txt
@@ -0,0 +1,4 @@
+.. _pie_and_polar_charts:
+
+Pie and polar charts
+====================
diff --git a/examples/pie_and_polar_charts/pie_demo_features.py b/examples/pie_and_polar_charts/pie_features.py
similarity index 100%
rename from examples/pie_and_polar_charts/pie_demo_features.py
rename to examples/pie_and_polar_charts/pie_features.py
diff --git a/examples/pie_and_polar_charts/polar_bar_demo.py b/examples/pie_and_polar_charts/polar_bar.py
similarity index 100%
rename from examples/pie_and_polar_charts/polar_bar_demo.py
rename to examples/pie_and_polar_charts/polar_bar.py
diff --git a/examples/pie_and_polar_charts/polar_scatter_demo.py b/examples/pie_and_polar_charts/polar_scatter.py
similarity index 100%
rename from examples/pie_and_polar_charts/polar_scatter_demo.py
rename to examples/pie_and_polar_charts/polar_scatter.py
diff --git a/examples/shapes_and_collections/README.txt b/examples/shapes_and_collections/README.txt
new file mode 100644
index 000000000000..bce3cbe038e3
--- /dev/null
+++ b/examples/shapes_and_collections/README.txt
@@ -0,0 +1,5 @@
+.. _shapes_and_collections_examples:
+
+
+Shapes and collections
+======================
diff --git a/examples/shapes_and_collections/plot_artist_reference.py b/examples/shapes_and_collections/artist_reference.py
similarity index 100%
rename from examples/shapes_and_collections/plot_artist_reference.py
rename to examples/shapes_and_collections/artist_reference.py
diff --git a/examples/shapes_and_collections/plot_path_patch.py b/examples/shapes_and_collections/path_patch.py
similarity index 100%
rename from examples/shapes_and_collections/plot_path_patch.py
rename to examples/shapes_and_collections/path_patch.py
diff --git a/examples/shapes_and_collections/plot_scatter.py b/examples/shapes_and_collections/scatter.py
similarity index 100%
rename from examples/shapes_and_collections/plot_scatter.py
rename to examples/shapes_and_collections/scatter.py
diff --git a/examples/showcase/README.txt b/examples/showcase/README.txt
new file mode 100644
index 000000000000..28028ad666a2
--- /dev/null
+++ b/examples/showcase/README.txt
@@ -0,0 +1,4 @@
+.. _showcase_examples:
+
+Showcase
+========
diff --git a/examples/showcase/integral_demo.py b/examples/showcase/integral.py
similarity index 100%
rename from examples/showcase/integral_demo.py
rename to examples/showcase/integral.py
diff --git a/examples/statistics/README.txt b/examples/statistics/README.txt
new file mode 100644
index 000000000000..5949a1920c02
--- /dev/null
+++ b/examples/statistics/README.txt
@@ -0,0 +1,4 @@
+.. _statistics_examples:
+
+Statistics
+==========
diff --git a/examples/statistics/boxplot_demo.py b/examples/statistics/boxplot.py
similarity index 100%
rename from examples/statistics/boxplot_demo.py
rename to examples/statistics/boxplot.py
diff --git a/examples/statistics/boxplot_color_demo.py b/examples/statistics/boxplot_color.py
similarity index 100%
rename from examples/statistics/boxplot_color_demo.py
rename to examples/statistics/boxplot_color.py
diff --git a/examples/statistics/boxplot_vs_violin_demo.py b/examples/statistics/boxplot_vs_violin.py
similarity index 100%
rename from examples/statistics/boxplot_vs_violin_demo.py
rename to examples/statistics/boxplot_vs_violin.py
diff --git a/examples/statistics/bxp_demo.py b/examples/statistics/bxp.py
similarity index 100%
rename from examples/statistics/bxp_demo.py
rename to examples/statistics/bxp.py
diff --git a/examples/statistics/customized_violin_demo.py b/examples/statistics/customized_violin.py
similarity index 100%
rename from examples/statistics/customized_violin_demo.py
rename to examples/statistics/customized_violin.py
diff --git a/examples/statistics/errorbar_demo.py b/examples/statistics/errorbar.py
similarity index 100%
rename from examples/statistics/errorbar_demo.py
rename to examples/statistics/errorbar.py
diff --git a/examples/statistics/errorbar_demo_features.py b/examples/statistics/errorbar_features.py
similarity index 100%
rename from examples/statistics/errorbar_demo_features.py
rename to examples/statistics/errorbar_features.py
diff --git a/examples/statistics/plot_hist.py b/examples/statistics/hist.py
similarity index 100%
rename from examples/statistics/plot_hist.py
rename to examples/statistics/hist.py
diff --git a/examples/statistics/histogram_demo_cumulative.py b/examples/statistics/histogram_cumulative.py
similarity index 100%
rename from examples/statistics/histogram_demo_cumulative.py
rename to examples/statistics/histogram_cumulative.py
diff --git a/examples/statistics/histogram_demo_features.py b/examples/statistics/histogram_features.py
similarity index 100%
rename from examples/statistics/histogram_demo_features.py
rename to examples/statistics/histogram_features.py
diff --git a/examples/statistics/histogram_demo_histtypes.py b/examples/statistics/histogram_histtypes.py
similarity index 100%
rename from examples/statistics/histogram_demo_histtypes.py
rename to examples/statistics/histogram_histtypes.py
diff --git a/examples/statistics/histogram_demo_multihist.py b/examples/statistics/histogram_multihist.py
similarity index 100%
rename from examples/statistics/histogram_demo_multihist.py
rename to examples/statistics/histogram_multihist.py
diff --git a/examples/statistics/violinplot_demo.py b/examples/statistics/violinplot.py
similarity index 100%
rename from examples/statistics/violinplot_demo.py
rename to examples/statistics/violinplot.py
diff --git a/examples/style_sheets/README.txt b/examples/style_sheets/README.txt
new file mode 100644
index 000000000000..671ff3bf3067
--- /dev/null
+++ b/examples/style_sheets/README.txt
@@ -0,0 +1,4 @@
+.. _style_sheet_examples:
+
+Style sheets
+============
diff --git a/examples/style_sheets/plot_bmh.py b/examples/style_sheets/bmh.py
similarity index 100%
rename from examples/style_sheets/plot_bmh.py
rename to examples/style_sheets/bmh.py
diff --git a/examples/style_sheets/plot_dark_background.py b/examples/style_sheets/dark_background.py
similarity index 100%
rename from examples/style_sheets/plot_dark_background.py
rename to examples/style_sheets/dark_background.py
diff --git a/examples/style_sheets/plot_fivethirtyeight.py b/examples/style_sheets/fivethirtyeight.py
similarity index 100%
rename from examples/style_sheets/plot_fivethirtyeight.py
rename to examples/style_sheets/fivethirtyeight.py
diff --git a/examples/style_sheets/plot_ggplot.py b/examples/style_sheets/ggplot.py
similarity index 100%
rename from examples/style_sheets/plot_ggplot.py
rename to examples/style_sheets/ggplot.py
diff --git a/examples/style_sheets/plot_grayscale.py b/examples/style_sheets/grayscale.py
similarity index 100%
rename from examples/style_sheets/plot_grayscale.py
rename to examples/style_sheets/grayscale.py
diff --git a/examples/subplots_axes_and_figures/README.txt b/examples/subplots_axes_and_figures/README.txt
new file mode 100644
index 000000000000..4ed26f5ef72f
--- /dev/null
+++ b/examples/subplots_axes_and_figures/README.txt
@@ -0,0 +1,4 @@
+.. _subplots_axes_and_figures_examples:
+
+Subplots, axes and figures
+==========================
diff --git a/examples/subplots_axes_and_figures/plot_equal_aspect_ratio.py b/examples/subplots_axes_and_figures/equal_aspect_ratio.py
similarity index 100%
rename from examples/subplots_axes_and_figures/plot_equal_aspect_ratio.py
rename to examples/subplots_axes_and_figures/equal_aspect_ratio.py
diff --git a/examples/subplots_axes_and_figures/subplot_demo.py b/examples/subplots_axes_and_figures/subplot.py
similarity index 100%
rename from examples/subplots_axes_and_figures/subplot_demo.py
rename to examples/subplots_axes_and_figures/subplot.py
diff --git a/examples/tests/backend_driver.py b/examples/tests/backend_driver.py
index e084e032f9d8..4603bba12a31 100644
--- a/examples/tests/backend_driver.py
+++ b/examples/tests/backend_driver.py
@@ -51,9 +51,9 @@
files = dict()
files['lines'] = [
- 'barh_demo.py',
- 'cohere_demo.py',
- 'fill_demo.py',
+ 'barh.py',
+ 'cohere.py',
+ 'fill.py',
'fill_demo_features.py',
'line_demo_dash_control.py',
'line_styles_reference.py',
@@ -76,18 +76,18 @@
]
files['statistics'] = [
- 'errorbar_demo.py',
- 'errorbar_demo_features.py',
- 'histogram_demo_cumulative.py',
- 'histogram_demo_features.py',
- 'histogram_demo_histtypes.py',
- 'histogram_demo_multihist.py',
+ 'errorbar.py',
+ 'errorbar_features.py',
+ 'histogram_cumulative.py',
+ 'histogram_features.py',
+ 'histogram_histtypes.py',
+ 'histogram_multihist.py',
]
files['pie'] = [
'pie_demo.py',
- 'polar_bar_demo.py',
- 'polar_scatter_demo.py',
+ 'polar_bar.py',
+ 'polar_scatter.py',
]
files['text_labels_and_annotations'] = [
@@ -205,7 +205,7 @@
'multiline.py',
'multiple_figs_demo.py',
'nan_test.py',
- 'plot_scalarformatter.py',
+ 'scalarformatter.py',
'pcolor_demo.py',
'pcolor_log.py',
'pcolor_small.py',
diff --git a/examples/text_labels_and_annotations/README.txt b/examples/text_labels_and_annotations/README.txt
new file mode 100644
index 000000000000..565fd8915c86
--- /dev/null
+++ b/examples/text_labels_and_annotations/README.txt
@@ -0,0 +1,4 @@
+.. _text_labels_and_annotations:
+
+Text, labels and annotations
+============================
diff --git a/examples/text_labels_and_annotations/autowrap_demo.py b/examples/text_labels_and_annotations/autowrap.py
similarity index 100%
rename from examples/text_labels_and_annotations/autowrap_demo.py
rename to examples/text_labels_and_annotations/autowrap.py
diff --git a/examples/text_labels_and_annotations/rainbow_text.py b/examples/text_labels_and_annotations/rainbow_text.py
index 95142175ce3d..3a930b4a7c40 100644
--- a/examples/text_labels_and_annotations/rainbow_text.py
+++ b/examples/text_labels_and_annotations/rainbow_text.py
@@ -1,5 +1,9 @@
# -*- coding: utf-8 -*-
"""
+============
+Rainbow text
+============
+
The example shows how to string together several text objects.
HISTORY
diff --git a/examples/text_labels_and_annotations/text_demo_fontdict.py b/examples/text_labels_and_annotations/text_fontdict.py
similarity index 100%
rename from examples/text_labels_and_annotations/text_demo_fontdict.py
rename to examples/text_labels_and_annotations/text_fontdict.py
diff --git a/examples/ticks_and_spines/README.txt b/examples/ticks_and_spines/README.txt
new file mode 100644
index 000000000000..e7869c5a08d1
--- /dev/null
+++ b/examples/ticks_and_spines/README.txt
@@ -0,0 +1,4 @@
+.. _ticks_and_spines_examples:
+
+Ticks and spines
+================
diff --git a/examples/ticks_and_spines/plot_scalarformatter.py b/examples/ticks_and_spines/scalarformatter.py
similarity index 100%
rename from examples/ticks_and_spines/plot_scalarformatter.py
rename to examples/ticks_and_spines/scalarformatter.py
diff --git a/examples/ticks_and_spines/spines_demo.py b/examples/ticks_and_spines/spines.py
similarity index 100%
rename from examples/ticks_and_spines/spines_demo.py
rename to examples/ticks_and_spines/spines.py
diff --git a/examples/ticks_and_spines/plot_spines_bounds.py b/examples/ticks_and_spines/spines_bounds.py
similarity index 100%
rename from examples/ticks_and_spines/plot_spines_bounds.py
rename to examples/ticks_and_spines/spines_bounds.py
diff --git a/examples/ticks_and_spines/spines_demo_dropped.py b/examples/ticks_and_spines/spines_dropped.py
similarity index 100%
rename from examples/ticks_and_spines/spines_demo_dropped.py
rename to examples/ticks_and_spines/spines_dropped.py
diff --git a/examples/ticks_and_spines/ticklabels_demo_rotation.py b/examples/ticks_and_spines/ticklabels_rotation.py
similarity index 100%
rename from examples/ticks_and_spines/ticklabels_demo_rotation.py
rename to examples/ticks_and_spines/ticklabels_rotation.py
diff --git a/examples/user_interfaces/README.txt b/examples/user_interfaces/README
similarity index 100%
rename from examples/user_interfaces/README.txt
rename to examples/user_interfaces/README
diff --git a/examples/widgets/README.txt b/examples/widgets/README
similarity index 100%
rename from examples/widgets/README.txt
rename to examples/widgets/README
diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py
index 8c6c400a2d81..f3930470edec 100644
--- a/lib/matplotlib/axes/_axes.py
+++ b/lib/matplotlib/axes/_axes.py
@@ -507,7 +507,7 @@ def legend(self, *args, **kwargs):
Examples
--------
- .. plot:: mpl_examples/api/plot_legend.py
+ .. plot:: gallery/api/legend.py
"""
handlers = kwargs.get('handler_map', {}) or {}
@@ -2567,7 +2567,7 @@ def pie(self, x, explode=None, labels=None, colors=None,
Examples
--------
- .. plot:: mpl_examples/pie_and_polar_charts/pie_demo_features.py
+ .. plot:: mpl_examples/pie_and_polar_charts/pie_features.py
"""
@@ -2799,7 +2799,8 @@ def errorbar(self, x, y, yerr=None, xerr=None,
Examples
--------
- .. plot:: mpl_examples/statistics/errorbar_demo.py
+ .. plot:: gallery/statistics/errorbar.py
+
"""
kwargs = cbook.normalize_kwargs(kwargs, _alias_map)
# anything that comes in as 'None', drop so the default thing
@@ -3270,7 +3271,7 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
Examples
--------
- .. plot:: mpl_examples/statistics/boxplot_demo.py
+ .. plot:: gallery/statistics/boxplot.py
"""
@@ -3540,7 +3541,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
Examples
--------
- .. plot:: mpl_examples/statistics/bxp_demo.py
+ .. plot:: gallery/statistics/bxp.py
"""
# lists of artists to be output
@@ -3916,7 +3917,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
Examples
--------
- .. plot:: mpl_examples/shapes_and_collections/plot_scatter.py
+ .. plot:: gallery/shapes_and_collections/scatter.py
"""
@@ -4699,7 +4700,7 @@ def fill(self, *args, **kwargs):
Examples
--------
- .. plot:: mpl_examples/lines_bars_and_markers/fill_demo.py
+ .. plot:: gallery/lines_bars_and_markers/fill.py
"""
@@ -6102,7 +6103,7 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None,
Examples
--------
- .. plot:: mpl_examples/statistics/histogram_demo_features.py
+ .. plot:: gallery/statistics/histogram_features.py
"""
# Avoid shadowing the builtin.
@@ -6486,7 +6487,7 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
Examples
--------
- .. plot:: mpl_examples/statistics/plot_hist.py
+ .. plot:: gallery/statistics/hist.py
"""
h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=range,
@@ -7067,7 +7068,7 @@ def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
Examples
--------
- .. plot:: mpl_examples/lines_bars_and_markers/cohere_demo.py
+ .. plot:: gallery/lines_bars_and_markers/cohere.py
"""
if not self._hold:
self.cla()
diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py
index 7b895db13b2e..a17fbd29f74f 100644
--- a/lib/matplotlib/path.py
+++ b/lib/matplotlib/path.py
@@ -317,7 +317,7 @@ def make_compound_path_from_polys(cls, XY):
numsides x 2) numpy array of vertices. Return object is a
:class:`Path`
- .. plot:: mpl_examples/api/plot_histogram_path.py
+ .. plot:: gallery/api/histogram_path.py
"""
diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py
index 3a8f70f761b6..e265e37b5366 100644
--- a/lib/matplotlib/pyplot.py
+++ b/lib/matplotlib/pyplot.py
@@ -1037,12 +1037,12 @@ def subplot(*args, **kwargs):
For additional information on :func:`axes` and
:func:`subplot` keyword arguments.
- :file:`examples/pie_and_polar_charts/polar_scatter_demo.py`
+ :file:`gallery/pie_and_polar_charts/polar_scatter.py`
For an example
**Example:**
- .. plot:: mpl_examples/subplots_axes_and_figures/subplot_demo.py
+ .. plot:: gallery/subplots_axes_and_figures/subplot.py
"""
# if subplot called without arguments, create subplot(1,1,1)
diff --git a/lib/matplotlib/sankey.py b/lib/matplotlib/sankey.py
index b5f8fb51696a..d57a66333ba8 100644
--- a/lib/matplotlib/sankey.py
+++ b/lib/matplotlib/sankey.py
@@ -118,7 +118,7 @@ def __init__(self, ax=None, scale=1.0, unit='', format='%G', gap=0.25,
**Examples:**
- .. plot:: mpl_examples/api/plot_sankey_basics.py
+ .. plot:: gallery/api/sankey_basics.py
"""
# Check the arguments.
if gap < 0:
diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py
index 664098934366..2e03c4d762f4 100644
--- a/lib/mpl_toolkits/mplot3d/axes3d.py
+++ b/lib/mpl_toolkits/mplot3d/axes3d.py
@@ -1911,8 +1911,8 @@ def plot_trisurf(self, *args, **kwargs):
**Examples:**
- .. plot:: mpl_examples/mplot3d/trisurf3d_demo.py
- .. plot:: mpl_examples/mplot3d/trisurf3d_demo2.py
+ .. plot:: gallery/mplot3d/trisurf3d.py
+ .. plot:: gallery/mplot3d/trisurf3d_2.py
.. versionadded:: 1.2.0
This plotting function was added for the v1.2.0 release.
@@ -2464,7 +2464,7 @@ def bar3d(self, x, y, z, dx, dy, dz, color=None,
Examples
--------
- .. plot:: mpl_examples/mplot3d/plot_3d_bars.py
+ .. plot:: mpl_examples/mplot3d/3d_bars.py
"""