diff --git a/.gitignore b/.gitignore index 0c5a23276532..ebde87dedfdc 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ build # sphinx build directory doc/_build +doc/auto_examples # setup.py dist directory dist # Egg metadata @@ -58,7 +59,6 @@ lib/matplotlib/mpl-data/matplotlibrc # Documentation generated files # ################################# doc/examples -doc/_templates/gallery.html doc/users/installing.rst doc/_static/matplotlibrc doc/pyplots/tex_demo.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..4a8b83c29951 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 @@

Documentation

Trying to learn how to do a particular kind of plot? Check out - the gallery, examples, + the gallery, examples, or the list of plotting commands.

diff --git a/doc/_templates/layout.html b/doc/_templates/layout.html index aa1f278d51b5..3d26e5ba4256 100644 --- a/doc/_templates/layout.html +++ b/doc/_templates/layout.html @@ -39,7 +39,7 @@

{{ _('Navigation') }}

  • home
  • examples
  • -
  • gallery
  • +
  • gallery
  • pyplot
  • docs »
  • diff --git a/doc/conf.py b/doc/conf.py index 989f1f946a5d..fd8ab383c2db 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -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'] @@ -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: @@ -96,6 +103,16 @@ autodoc_docstring_signature = True + +# Sphinx gallery configuration +sphinx_gallery_conf = { + # path to your examples scripts + 'examples_dirs' : '../examples', + # path where to save gallery generated examples + 'gallery_dirs' : 'auto_examples'} + +plot_gallery = True + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -234,7 +251,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. diff --git a/doc/devel/contributing.rst b/doc/devel/contributing.rst index 5ec25366c716..b3e2e654e03b 100644 --- a/doc/devel/contributing.rst +++ b/doc/devel/contributing.rst @@ -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. +<../auto_examples/index.html>`_ sections of the website. Any sample data that the example uses should be kept small and distributed with Matplotlib in the diff --git a/doc/mpl_toolkits/index.rst b/doc/mpl_toolkits/index.rst index ae4f59b022a4..54ffc11776f4 100644 --- a/doc/mpl_toolkits/index.rst +++ b/doc/mpl_toolkits/index.rst @@ -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:: auto_examples/mplot3d/plot_contourf3d_2.py .. _toolkit_axes_grid1: diff --git a/doc/mpl_toolkits/mplot3d/tutorial.rst b/doc/mpl_toolkits/mplot3d/tutorial.rst index b0cda8661968..a7f2a14871ba 100644 --- a/doc/mpl_toolkits/mplot3d/tutorial.rst +++ b/doc/mpl_toolkits/mplot3d/tutorial.rst @@ -36,7 +36,7 @@ Line plots ==================== .. automethod:: Axes3D.plot -.. plot:: mpl_examples/mplot3d/lines3d_demo.py +.. plot:: auto_examples/mplot3d/plot_lines3d.py .. _scatter3d: @@ -44,7 +44,7 @@ Scatter plots ============= .. automethod:: Axes3D.scatter -.. plot:: mpl_examples/mplot3d/scatter3d_demo.py +.. plot:: auto_examples/mplot3d/plot_scatter3d.py .. _wireframe: @@ -52,7 +52,7 @@ Wireframe plots =============== .. automethod:: Axes3D.plot_wireframe -.. plot:: mpl_examples/mplot3d/wire3d_demo.py +.. plot:: auto_examples/mplot3d/plot_wire3d.py .. _surface: @@ -60,9 +60,9 @@ 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:: auto_examples/mplot3d/plot_surface3d.py +.. plot:: auto_examples/mplot3d/plot_surface3d_2.py +.. plot:: auto_examples/mplot3d/plot_surface3d_3.py .. _trisurface: @@ -70,7 +70,7 @@ Tri-Surface plots ================= .. automethod:: Axes3D.plot_trisurf -.. plot:: mpl_examples/mplot3d/trisurf3d_demo.py +.. plot:: auto_examples/mplot3d/plot_trisurf3d.py .. _contour3d: @@ -79,9 +79,9 @@ 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:: auto_examples/mplot3d/plot_contour3d.py +.. plot:: auto_examples/mplot3d/plot_contour3d_2.py +.. plot:: auto_examples/mplot3d/plot_contour3d_3.py .. _contourf3d: @@ -89,8 +89,8 @@ Filled contour plots ==================== .. automethod:: Axes3D.contourf -.. plot:: mpl_examples/mplot3d/contourf3d_demo.py -.. plot:: mpl_examples/mplot3d/contourf3d_demo2.py +.. plot:: auto_examples/mplot3d/plot_contourf3d.py +.. plot:: auto_examples/mplot3d/plot_contourf3d_2.py .. versionadded:: 1.1.0 The feature demoed in the second contourf3d example was enabled as a @@ -102,7 +102,7 @@ Polygon plots ==================== .. automethod:: Axes3D.add_collection3d -.. plot:: mpl_examples/mplot3d/polys3d_demo.py +.. plot:: auto_examples/mplot3d/plot_polys3d.py .. _bar3d: @@ -110,7 +110,7 @@ Bar plots ==================== .. automethod:: Axes3D.bar -.. plot:: mpl_examples/mplot3d/bars3d_demo.py +.. plot:: auto_examples/mplot3d/plot_bars3d.py .. _quiver3d: @@ -118,13 +118,13 @@ Quiver ==================== .. automethod:: Axes3D.quiver -.. plot:: mpl_examples/mplot3d/quiver3d_demo.py +.. plot:: auto_examples/mplot3d/plot_quiver3d.py .. _2dcollections3d: 2D plots in 3D ==================== -.. plot:: mpl_examples/mplot3d/2dcollections3d_demo.py +.. plot:: auto_examples/mplot3d/plot_2dcollections3d.py .. _text3d: @@ -132,7 +132,7 @@ Text ==================== .. automethod:: Axes3D.text -.. plot:: mpl_examples/mplot3d/text3d_demo.py +.. plot:: auto_examples/mplot3d/plot_text3d.py .. _3dsubplots: @@ -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:: auto_examples/mplot3d/plot_subplot3d.py +.. plot:: auto_examples/mplot3d/plot_mixed_subplots.py diff --git a/doc/sphinxext/gen_gallery.py b/doc/sphinxext/gen_gallery.py deleted file mode 100644 index 812a0b4ad6ab..000000000000 --- a/doc/sphinxext/gen_gallery.py +++ /dev/null @@ -1,170 +0,0 @@ -# -*- coding: utf-8 -*- -import codecs -import os -import re -import glob -import warnings - -import sphinx.errors - -import matplotlib.image as image - - -exclude_example_sections = ['units'] -multiimage = re.compile('(.*?)(_\d\d){1,2}') - -# generate a thumbnail gallery of examples -gallery_template = u"""\ -{{% extends "layout.html" %}} -{{% set title = "Thumbnail gallery" %}} - - -{{% block body %}} - -

    Click on any image to see full size image and source code

    -
    - -
  • Gallery - -
  • - -{gallery} - -{{% endblock %}} -""" - -header_template = u"""\ -
    -

    - {title}ΒΆ -

    """ - -link_template = """\ -
    - {basename}
    -
    {title}
    -
    -""" - -toc_template = u"""\ -
  • {title}
  • """ - - -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/image_tutorial.rst b/doc/users/image_tutorial.rst index 1d1f58ee5e82..6fbc4194ce39 100644 --- a/doc/users/image_tutorial.rst +++ b/doc/users/image_tutorial.rst @@ -226,7 +226,7 @@ Note that you can also change colormaps on existing plot objects using the There are many other colormap schemes available. See the `list and images of the colormaps -<../examples/color/colormaps_reference.html>`_. +<../examples/color/plot_colormaps_reference.html>`_. .. _`Color Bars`: diff --git a/doc/users/legend_guide.rst b/doc/users/legend_guide.rst index c7fb0621df9f..59686ce70c35 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:`lines_bars_and_markers-scatter_with_legend` * :ref:`api-plot_legend` +* :ref:`lines_bars_and_markers-plot_scatter_with_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..d00db765e133 100644 --- a/doc/users/prev_whats_new/whats_new_1.1.rst +++ b/doc/users/prev_whats_new/whats_new_1.1.rst @@ -20,7 +20,7 @@ Kevin Davies has extended Yannick Copin's original Sankey example into a module (:ref:`api-plot_sankey_basics`, :ref:`api-plot_sankey_links`, :ref:`api-plot_sankey_rankine`). -.. plot:: mpl_examples/api/plot_sankey_rankine.py +.. plot:: auto_examples/api/plot_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:: auto_examples/mplot3d/plot_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:: auto_examples/mplot3d/plot_contourf3d_2.py Numerix support removed ----------------------- @@ -205,6 +205,6 @@ Other improvements * Pim Schellart added a new colormap called "cubehelix". Sameer Grover also added a colormap called "coolwarm". See it and all - other colormaps :ref:`here `. + other colormaps :ref:`here `. * Many bug fixes and documentation improvements. 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..979afc4b1c6b 100644 --- a/doc/users/prev_whats_new/whats_new_1.2.rst +++ b/doc/users/prev_whats_new/whats_new_1.2.rst @@ -61,7 +61,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:: auto_examples/mplot3d/plot_trisurf3d.py Control the lengths of colorbar extensions ------------------------------------------ @@ -152,7 +152,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:: auto_examples/images_contours_and_fields/plot_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..cfaa741b550d 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:: auto_examples/showcase/plot_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:: auto_examples/mplot3d/plot_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..2d77f145c0db 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-plot_boxplot` and +:ref:`statistics-plot_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:: auto_examples/api/plot_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:: auto_examples/mplot3d/plot_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..ed943a243be1 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:: auto_examples/color/plot_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:: auto_examples/api/plot_filled_step.py Square Plot diff --git a/doc/users/screenshots.rst b/doc/users/screenshots.rst index d5ab16bb7870..bf1a7039e50b 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:: auto_examples/subplots_axes_and_figures/plot_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:: auto_examples/statistics/plot_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:: auto_examples/shapes_and_collections/plot_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:: auto_examples/mplot3d/plot_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:: auto_examples/images_contours_and_fields/plot_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>`_). +(`plot_barh.py <../examples/lines_bars_and_markers/plot_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:: auto_examples/pie_and_polar_charts/plot_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:: auto_examples/lines_bars_and_markers/plot_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:: auto_examples/api/plot_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:: auto_examples/api/plot_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:: auto_examples/showcase/plot_xkcd.py diff --git a/doc/users/whats_new.rst b/doc/users/whats_new.rst index 078eef4e4912..6923a00af092 100644 --- a/doc/users/whats_new.rst +++ b/doc/users/whats_new.rst @@ -287,7 +287,7 @@ Filled ``+`` and ``x`` markers New fillable *plus* and *x* markers have been added. See the :mod:`~matplotlib.markers` module and -:ref:`marker reference ` +:ref:`marker reference ` examples. `rcount` and `ccount` for `plot_surface()` 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_patch_collection.py b/examples/api/plot_patch_collection.py index a39ab4ad56a0..d3e6ec5d0556 100644 --- a/examples/api/plot_patch_collection.py +++ b/examples/api/plot_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/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/plot_color_cycle.py similarity index 100% rename from examples/color/color_cycle_demo.py rename to examples/color/plot_color_cycle.py diff --git a/examples/color/color_cycle_default.py b/examples/color/plot_color_cycle_default.py similarity index 100% rename from examples/color/color_cycle_default.py rename to examples/color/plot_color_cycle_default.py diff --git a/examples/color/colormaps_reference.py b/examples/color/plot_colormaps_reference.py similarity index 100% rename from examples/color/colormaps_reference.py rename to examples/color/plot_colormaps_reference.py diff --git a/examples/color/named_colors.py b/examples/color/plot_named_colors.py similarity index 100% rename from examples/color/named_colors.py rename to examples/color/plot_named_colors.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/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/contourf_log.py b/examples/images_contours_and_fields/plot_contourf_log.py similarity index 100% rename from examples/images_contours_and_fields/contourf_log.py rename to examples/images_contours_and_fields/plot_contourf_log.py diff --git a/examples/images_contours_and_fields/image_demo_clip_path.py b/examples/images_contours_and_fields/plot_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/plot_image_clip_path.py diff --git a/examples/images_contours_and_fields/image_demo.py b/examples/images_contours_and_fields/plot_image_demo.py similarity index 100% rename from examples/images_contours_and_fields/image_demo.py rename to examples/images_contours_and_fields/plot_image_demo.py diff --git a/examples/images_contours_and_fields/interpolation_methods.py b/examples/images_contours_and_fields/plot_interpolation_methods.py similarity index 100% rename from examples/images_contours_and_fields/interpolation_methods.py rename to examples/images_contours_and_fields/plot_interpolation_methods.py diff --git a/examples/images_contours_and_fields/pcolormesh_levels.py b/examples/images_contours_and_fields/plot_pcolormesh_levels.py similarity index 100% rename from examples/images_contours_and_fields/pcolormesh_levels.py rename to examples/images_contours_and_fields/plot_pcolormesh_levels.py diff --git a/examples/images_contours_and_fields/streamplot_demo_features.py b/examples/images_contours_and_fields/plot_streamplot_features.py similarity index 100% rename from examples/images_contours_and_fields/streamplot_demo_features.py rename to examples/images_contours_and_fields/plot_streamplot_features.py diff --git a/examples/images_contours_and_fields/streamplot_demo_masking.py b/examples/images_contours_and_fields/plot_streamplot_masking.py similarity index 100% rename from examples/images_contours_and_fields/streamplot_demo_masking.py rename to examples/images_contours_and_fields/plot_streamplot_masking.py diff --git a/examples/images_contours_and_fields/streamplot_demo_start_points.py b/examples/images_contours_and_fields/plot_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/plot_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/plot_barh.py similarity index 100% rename from examples/lines_bars_and_markers/barh_demo.py rename to examples/lines_bars_and_markers/plot_barh.py diff --git a/examples/lines_bars_and_markers/cohere_demo.py b/examples/lines_bars_and_markers/plot_cohere.py similarity index 100% rename from examples/lines_bars_and_markers/cohere_demo.py rename to examples/lines_bars_and_markers/plot_cohere.py diff --git a/examples/lines_bars_and_markers/fill_demo.py b/examples/lines_bars_and_markers/plot_fill.py similarity index 100% rename from examples/lines_bars_and_markers/fill_demo.py rename to examples/lines_bars_and_markers/plot_fill.py diff --git a/examples/lines_bars_and_markers/line_demo_dash_control.py b/examples/lines_bars_and_markers/plot_line_demo_dash_control.py similarity index 100% rename from examples/lines_bars_and_markers/line_demo_dash_control.py rename to examples/lines_bars_and_markers/plot_line_demo_dash_control.py diff --git a/examples/lines_bars_and_markers/line_styles_reference.py b/examples/lines_bars_and_markers/plot_line_styles_reference.py similarity index 100% rename from examples/lines_bars_and_markers/line_styles_reference.py rename to examples/lines_bars_and_markers/plot_line_styles_reference.py diff --git a/examples/lines_bars_and_markers/linestyles.py b/examples/lines_bars_and_markers/plot_linestyles.py similarity index 100% rename from examples/lines_bars_and_markers/linestyles.py rename to examples/lines_bars_and_markers/plot_linestyles.py diff --git a/examples/lines_bars_and_markers/marker_fillstyle_reference.py b/examples/lines_bars_and_markers/plot_marker_fillstyle_reference.py similarity index 100% rename from examples/lines_bars_and_markers/marker_fillstyle_reference.py rename to examples/lines_bars_and_markers/plot_marker_fillstyle_reference.py diff --git a/examples/lines_bars_and_markers/marker_reference.py b/examples/lines_bars_and_markers/plot_marker_reference.py similarity index 100% rename from examples/lines_bars_and_markers/marker_reference.py rename to examples/lines_bars_and_markers/plot_marker_reference.py diff --git a/examples/lines_bars_and_markers/multicolored_line.py b/examples/lines_bars_and_markers/plot_multicolored_line.py similarity index 100% rename from examples/lines_bars_and_markers/multicolored_line.py rename to examples/lines_bars_and_markers/plot_multicolored_line.py diff --git a/examples/lines_bars_and_markers/scatter_with_legend.py b/examples/lines_bars_and_markers/plot_scatter_with_legend.py similarity index 84% rename from examples/lines_bars_and_markers/scatter_with_legend.py rename to examples/lines_bars_and_markers/plot_scatter_with_legend.py index 8f86bc51f8ed..bca9215ef8aa 100644 --- a/examples/lines_bars_and_markers/scatter_with_legend.py +++ b/examples/lines_bars_and_markers/plot_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/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/2dcollections3d_demo.py b/examples/mplot3d/plot_2dcollections3d.py similarity index 100% rename from examples/mplot3d/2dcollections3d_demo.py rename to examples/mplot3d/plot_2dcollections3d.py diff --git a/examples/mplot3d/bars3d_demo.py b/examples/mplot3d/plot_bars3d.py similarity index 100% rename from examples/mplot3d/bars3d_demo.py rename to examples/mplot3d/plot_bars3d.py diff --git a/examples/mplot3d/contour3d_demo.py b/examples/mplot3d/plot_contour3d.py similarity index 100% rename from examples/mplot3d/contour3d_demo.py rename to examples/mplot3d/plot_contour3d.py diff --git a/examples/mplot3d/contour3d_demo2.py b/examples/mplot3d/plot_contour3d_2.py similarity index 100% rename from examples/mplot3d/contour3d_demo2.py rename to examples/mplot3d/plot_contour3d_2.py diff --git a/examples/mplot3d/contour3d_demo3.py b/examples/mplot3d/plot_contour3d_3.py similarity index 100% rename from examples/mplot3d/contour3d_demo3.py rename to examples/mplot3d/plot_contour3d_3.py diff --git a/examples/mplot3d/contourf3d_demo.py b/examples/mplot3d/plot_contourf3d.py similarity index 100% rename from examples/mplot3d/contourf3d_demo.py rename to examples/mplot3d/plot_contourf3d.py diff --git a/examples/mplot3d/contourf3d_demo2.py b/examples/mplot3d/plot_contourf3d_2.py similarity index 100% rename from examples/mplot3d/contourf3d_demo2.py rename to examples/mplot3d/plot_contourf3d_2.py diff --git a/examples/mplot3d/custom_shaded_3d_surface.py b/examples/mplot3d/plot_custom_shaded_3d_surface.py similarity index 100% rename from examples/mplot3d/custom_shaded_3d_surface.py rename to examples/mplot3d/plot_custom_shaded_3d_surface.py diff --git a/examples/mplot3d/hist3d_demo.py b/examples/mplot3d/plot_hist3d.py similarity index 100% rename from examples/mplot3d/hist3d_demo.py rename to examples/mplot3d/plot_hist3d.py diff --git a/examples/mplot3d/lines3d_demo.py b/examples/mplot3d/plot_lines3d.py similarity index 100% rename from examples/mplot3d/lines3d_demo.py rename to examples/mplot3d/plot_lines3d.py diff --git a/examples/mplot3d/lorenz_attractor.py b/examples/mplot3d/plot_lorenz_attractor.py similarity index 100% rename from examples/mplot3d/lorenz_attractor.py rename to examples/mplot3d/plot_lorenz_attractor.py diff --git a/examples/mplot3d/mixed_subplots_demo.py b/examples/mplot3d/plot_mixed_subplots.py similarity index 100% rename from examples/mplot3d/mixed_subplots_demo.py rename to examples/mplot3d/plot_mixed_subplots.py diff --git a/examples/mplot3d/offset_demo.py b/examples/mplot3d/plot_offset.py similarity index 100% rename from examples/mplot3d/offset_demo.py rename to examples/mplot3d/plot_offset.py diff --git a/examples/mplot3d/pathpatch3d_demo.py b/examples/mplot3d/plot_pathpatch3d.py similarity index 100% rename from examples/mplot3d/pathpatch3d_demo.py rename to examples/mplot3d/plot_pathpatch3d.py diff --git a/examples/mplot3d/polys3d_demo.py b/examples/mplot3d/plot_polys3d.py similarity index 100% rename from examples/mplot3d/polys3d_demo.py rename to examples/mplot3d/plot_polys3d.py diff --git a/examples/mplot3d/quiver3d_demo.py b/examples/mplot3d/plot_quiver3d.py similarity index 100% rename from examples/mplot3d/quiver3d_demo.py rename to examples/mplot3d/plot_quiver3d.py diff --git a/examples/mplot3d/rotate_axes3d_demo.py b/examples/mplot3d/plot_rotate_axes3d.py similarity index 100% rename from examples/mplot3d/rotate_axes3d_demo.py rename to examples/mplot3d/plot_rotate_axes3d.py diff --git a/examples/mplot3d/scatter3d_demo.py b/examples/mplot3d/plot_scatter3d.py similarity index 100% rename from examples/mplot3d/scatter3d_demo.py rename to examples/mplot3d/plot_scatter3d.py diff --git a/examples/mplot3d/subplot3d_demo.py b/examples/mplot3d/plot_subplot3d.py similarity index 100% rename from examples/mplot3d/subplot3d_demo.py rename to examples/mplot3d/plot_subplot3d.py diff --git a/examples/mplot3d/surface3d_demo.py b/examples/mplot3d/plot_surface3d.py similarity index 100% rename from examples/mplot3d/surface3d_demo.py rename to examples/mplot3d/plot_surface3d.py diff --git a/examples/mplot3d/surface3d_demo2.py b/examples/mplot3d/plot_surface3d_2.py similarity index 100% rename from examples/mplot3d/surface3d_demo2.py rename to examples/mplot3d/plot_surface3d_2.py diff --git a/examples/mplot3d/surface3d_demo3.py b/examples/mplot3d/plot_surface3d_3.py similarity index 100% rename from examples/mplot3d/surface3d_demo3.py rename to examples/mplot3d/plot_surface3d_3.py diff --git a/examples/mplot3d/surface3d_radial_demo.py b/examples/mplot3d/plot_surface3d_radial.py similarity index 100% rename from examples/mplot3d/surface3d_radial_demo.py rename to examples/mplot3d/plot_surface3d_radial.py diff --git a/examples/mplot3d/text3d_demo.py b/examples/mplot3d/plot_text3d.py similarity index 76% rename from examples/mplot3d/text3d_demo.py rename to examples/mplot3d/plot_text3d.py index 6b1963e2a43b..d26cf2b74eaf 100644 --- a/examples/mplot3d/text3d_demo.py +++ b/examples/mplot3d/plot_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/plot_tricontour3d.py similarity index 100% rename from examples/mplot3d/tricontour3d_demo.py rename to examples/mplot3d/plot_tricontour3d.py diff --git a/examples/mplot3d/tricontourf3d_demo.py b/examples/mplot3d/plot_tricontourf3d.py similarity index 100% rename from examples/mplot3d/tricontourf3d_demo.py rename to examples/mplot3d/plot_tricontourf3d.py diff --git a/examples/mplot3d/trisurf3d_demo.py b/examples/mplot3d/plot_trisurf3d.py similarity index 100% rename from examples/mplot3d/trisurf3d_demo.py rename to examples/mplot3d/plot_trisurf3d.py diff --git a/examples/mplot3d/trisurf3d_demo2.py b/examples/mplot3d/plot_trisurf3d_2.py similarity index 100% rename from examples/mplot3d/trisurf3d_demo2.py rename to examples/mplot3d/plot_trisurf3d_2.py diff --git a/examples/mplot3d/wire3d_demo.py b/examples/mplot3d/plot_wire3d.py similarity index 100% rename from examples/mplot3d/wire3d_demo.py rename to examples/mplot3d/plot_wire3d.py diff --git a/examples/mplot3d/wire3d_animation_demo.py b/examples/mplot3d/plot_wire3d_animation.py similarity index 100% rename from examples/mplot3d/wire3d_animation_demo.py rename to examples/mplot3d/plot_wire3d_animation.py diff --git a/examples/mplot3d/wire3d_zero_stride.py b/examples/mplot3d/plot_wire3d_zero_stride.py similarity index 100% rename from examples/mplot3d/wire3d_zero_stride.py rename to examples/mplot3d/plot_wire3d_zero_stride.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/plot_pie_features.py similarity index 100% rename from examples/pie_and_polar_charts/pie_demo_features.py rename to examples/pie_and_polar_charts/plot_pie_features.py diff --git a/examples/pie_and_polar_charts/polar_bar_demo.py b/examples/pie_and_polar_charts/plot_polar_bar.py similarity index 100% rename from examples/pie_and_polar_charts/polar_bar_demo.py rename to examples/pie_and_polar_charts/plot_polar_bar.py diff --git a/examples/pie_and_polar_charts/polar_scatter_demo.py b/examples/pie_and_polar_charts/plot_polar_scatter.py similarity index 100% rename from examples/pie_and_polar_charts/polar_scatter_demo.py rename to examples/pie_and_polar_charts/plot_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/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/anatomy.py b/examples/showcase/plot_anatomy.py similarity index 100% rename from examples/showcase/anatomy.py rename to examples/showcase/plot_anatomy.py diff --git a/examples/showcase/bachelors_degrees_by_gender.py b/examples/showcase/plot_bachelors_degrees_by_gender.py similarity index 100% rename from examples/showcase/bachelors_degrees_by_gender.py rename to examples/showcase/plot_bachelors_degrees_by_gender.py diff --git a/examples/showcase/firefox.py b/examples/showcase/plot_firefox.py similarity index 100% rename from examples/showcase/firefox.py rename to examples/showcase/plot_firefox.py diff --git a/examples/showcase/integral_demo.py b/examples/showcase/plot_integral.py similarity index 100% rename from examples/showcase/integral_demo.py rename to examples/showcase/plot_integral.py diff --git a/examples/showcase/mandelbrot.py b/examples/showcase/plot_mandelbrot.py similarity index 100% rename from examples/showcase/mandelbrot.py rename to examples/showcase/plot_mandelbrot.py diff --git a/examples/showcase/xkcd.py b/examples/showcase/plot_xkcd.py similarity index 100% rename from examples/showcase/xkcd.py rename to examples/showcase/plot_xkcd.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/plot_boxplot.py similarity index 100% rename from examples/statistics/boxplot_demo.py rename to examples/statistics/plot_boxplot.py diff --git a/examples/statistics/boxplot_color_demo.py b/examples/statistics/plot_boxplot_color.py similarity index 100% rename from examples/statistics/boxplot_color_demo.py rename to examples/statistics/plot_boxplot_color.py diff --git a/examples/statistics/boxplot_vs_violin_demo.py b/examples/statistics/plot_boxplot_vs_violin.py similarity index 100% rename from examples/statistics/boxplot_vs_violin_demo.py rename to examples/statistics/plot_boxplot_vs_violin.py diff --git a/examples/statistics/bxp_demo.py b/examples/statistics/plot_bxp.py similarity index 100% rename from examples/statistics/bxp_demo.py rename to examples/statistics/plot_bxp.py diff --git a/examples/statistics/customized_violin_demo.py b/examples/statistics/plot_customized_violin.py similarity index 100% rename from examples/statistics/customized_violin_demo.py rename to examples/statistics/plot_customized_violin.py diff --git a/examples/statistics/errorbar_demo.py b/examples/statistics/plot_errorbar.py similarity index 100% rename from examples/statistics/errorbar_demo.py rename to examples/statistics/plot_errorbar.py diff --git a/examples/statistics/errorbar_demo_features.py b/examples/statistics/plot_errorbar_features.py similarity index 100% rename from examples/statistics/errorbar_demo_features.py rename to examples/statistics/plot_errorbar_features.py diff --git a/examples/statistics/errorbar_limits.py b/examples/statistics/plot_errorbar_limits.py similarity index 100% rename from examples/statistics/errorbar_limits.py rename to examples/statistics/plot_errorbar_limits.py diff --git a/examples/statistics/errorbars_and_boxes.py b/examples/statistics/plot_errorbars_and_boxes.py similarity index 100% rename from examples/statistics/errorbars_and_boxes.py rename to examples/statistics/plot_errorbars_and_boxes.py diff --git a/examples/statistics/histogram_demo_cumulative.py b/examples/statistics/plot_histogram_cumulative.py similarity index 100% rename from examples/statistics/histogram_demo_cumulative.py rename to examples/statistics/plot_histogram_cumulative.py diff --git a/examples/statistics/histogram_demo_features.py b/examples/statistics/plot_histogram_features.py similarity index 100% rename from examples/statistics/histogram_demo_features.py rename to examples/statistics/plot_histogram_features.py diff --git a/examples/statistics/histogram_demo_histtypes.py b/examples/statistics/plot_histogram_histtypes.py similarity index 100% rename from examples/statistics/histogram_demo_histtypes.py rename to examples/statistics/plot_histogram_histtypes.py diff --git a/examples/statistics/histogram_demo_multihist.py b/examples/statistics/plot_histogram_multihist.py similarity index 100% rename from examples/statistics/histogram_demo_multihist.py rename to examples/statistics/plot_histogram_multihist.py diff --git a/examples/statistics/multiple_histograms_side_by_side.py b/examples/statistics/plot_multiple_histograms_side_by_side.py similarity index 100% rename from examples/statistics/multiple_histograms_side_by_side.py rename to examples/statistics/plot_multiple_histograms_side_by_side.py diff --git a/examples/statistics/violinplot_demo.py b/examples/statistics/plot_violinplot.py similarity index 100% rename from examples/statistics/violinplot_demo.py rename to examples/statistics/plot_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/style_sheets_reference.py b/examples/style_sheets/plot_style_sheets_reference.py similarity index 100% rename from examples/style_sheets/style_sheets_reference.py rename to examples/style_sheets/plot_style_sheets_reference.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/fahrenheit_celsius_scales.py b/examples/subplots_axes_and_figures/plot_fahrenheit_celsius_scales.py similarity index 100% rename from examples/subplots_axes_and_figures/fahrenheit_celsius_scales.py rename to examples/subplots_axes_and_figures/plot_fahrenheit_celsius_scales.py diff --git a/examples/subplots_axes_and_figures/ganged_plots.py b/examples/subplots_axes_and_figures/plot_ganged_plots.py similarity index 100% rename from examples/subplots_axes_and_figures/ganged_plots.py rename to examples/subplots_axes_and_figures/plot_ganged_plots.py diff --git a/examples/subplots_axes_and_figures/subplot_demo.py b/examples/subplots_axes_and_figures/plot_subplot.py similarity index 100% rename from examples/subplots_axes_and_figures/subplot_demo.py rename to examples/subplots_axes_and_figures/plot_subplot.py diff --git a/examples/tests/backend_driver.py b/examples/tests/backend_driver.py index e084e032f9d8..7e269561ce52 100644 --- a/examples/tests/backend_driver.py +++ b/examples/tests/backend_driver.py @@ -51,13 +51,13 @@ files = dict() files['lines'] = [ - 'barh_demo.py', - 'cohere_demo.py', - 'fill_demo.py', + 'plot_barh.py', + 'plot_cohere.py', + 'plot_fill.py', 'fill_demo_features.py', - 'line_demo_dash_control.py', - 'line_styles_reference.py', - 'scatter_with_legend.py' + 'plot_line_demo_dash_control.py', + 'plot_line_styles_reference.py', + 'plot_scatter_with_legend.py' ] files['shapes'] = [ @@ -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', + 'plot_errorbar.py', + 'plot_errorbar_features.py', + 'plot_histogram_cumulative.py', + 'plot_histogram_features.py', + 'plot_histogram_histtypes.py', + 'plot_histogram_multihist.py', ] files['pie'] = [ 'pie_demo.py', - 'polar_bar_demo.py', - 'polar_scatter_demo.py', + 'plot_polar_bar.py', + 'plot_polar_scatter.py', ] files['text_labels_and_annotations'] = [ 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/accented_text.py b/examples/text_labels_and_annotations/plot_accented_text.py similarity index 100% rename from examples/text_labels_and_annotations/accented_text.py rename to examples/text_labels_and_annotations/plot_accented_text.py diff --git a/examples/text_labels_and_annotations/autowrap_demo.py b/examples/text_labels_and_annotations/plot_autowrap.py similarity index 100% rename from examples/text_labels_and_annotations/autowrap_demo.py rename to examples/text_labels_and_annotations/plot_autowrap.py diff --git a/examples/text_labels_and_annotations/rainbow_text.py b/examples/text_labels_and_annotations/plot_rainbow_text.py similarity index 97% rename from examples/text_labels_and_annotations/rainbow_text.py rename to examples/text_labels_and_annotations/plot_rainbow_text.py index 95142175ce3d..3a930b4a7c40 100644 --- a/examples/text_labels_and_annotations/rainbow_text.py +++ b/examples/text_labels_and_annotations/plot_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_alignment.py b/examples/text_labels_and_annotations/plot_text_alignment.py similarity index 100% rename from examples/text_labels_and_annotations/text_alignment.py rename to examples/text_labels_and_annotations/plot_text_alignment.py diff --git a/examples/text_labels_and_annotations/text_demo_fontdict.py b/examples/text_labels_and_annotations/plot_text_fontdict.py similarity index 100% rename from examples/text_labels_and_annotations/text_demo_fontdict.py rename to examples/text_labels_and_annotations/plot_text_fontdict.py diff --git a/examples/text_labels_and_annotations/text_rotation.py b/examples/text_labels_and_annotations/plot_text_rotation.py similarity index 100% rename from examples/text_labels_and_annotations/text_rotation.py rename to examples/text_labels_and_annotations/plot_text_rotation.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/spines_demo.py b/examples/ticks_and_spines/plot_spines.py similarity index 100% rename from examples/ticks_and_spines/spines_demo.py rename to examples/ticks_and_spines/plot_spines.py diff --git a/examples/ticks_and_spines/spines_demo_dropped.py b/examples/ticks_and_spines/plot_spines_dropped.py similarity index 100% rename from examples/ticks_and_spines/spines_demo_dropped.py rename to examples/ticks_and_spines/plot_spines_dropped.py diff --git a/examples/ticks_and_spines/tick-formatters.py b/examples/ticks_and_spines/plot_tick-formatters.py similarity index 100% rename from examples/ticks_and_spines/tick-formatters.py rename to examples/ticks_and_spines/plot_tick-formatters.py diff --git a/examples/ticks_and_spines/tick-locators.py b/examples/ticks_and_spines/plot_tick-locators.py similarity index 100% rename from examples/ticks_and_spines/tick-locators.py rename to examples/ticks_and_spines/plot_tick-locators.py diff --git a/examples/ticks_and_spines/tick_labels_from_values.py b/examples/ticks_and_spines/plot_tick_labels_from_values.py similarity index 100% rename from examples/ticks_and_spines/tick_labels_from_values.py rename to examples/ticks_and_spines/plot_tick_labels_from_values.py diff --git a/examples/ticks_and_spines/ticklabels_demo_rotation.py b/examples/ticks_and_spines/plot_ticklabels_rotation.py similarity index 100% rename from examples/ticks_and_spines/ticklabels_demo_rotation.py rename to examples/ticks_and_spines/plot_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..6a4da2a1628d 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:: auto_examples/api/plot_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/plot_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:: auto_examples/statistics/plot_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:: auto_examples/statistics/plot_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:: auto_examples/statistics/plot_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:: auto_examples/shapes_and_collections/plot_scatter.py """ @@ -4699,7 +4700,7 @@ def fill(self, *args, **kwargs): Examples -------- - .. plot:: mpl_examples/lines_bars_and_markers/fill_demo.py + .. plot:: auto_examples/lines_bars_and_markers/plot_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:: auto_examples/statistics/plot_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:: auto_examples/statistics/plot_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:: auto_examples/lines_bars_and_markers/plot_cohere.py """ if not self._hold: self.cla() diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index 7b895db13b2e..cad9be9b1a0f 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:: auto_examples/api/plot_histogram_path.py """ diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 3a8f70f761b6..d4df4880fc75 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:`auto_examples/pie_and_polar_charts/plot_polar_scatter.py` For an example **Example:** - .. plot:: mpl_examples/subplots_axes_and_figures/subplot_demo.py + .. plot:: auto_examples/subplots_axes_and_figures/plot_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..c7254cb7b150 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:: auto_examples/api/plot_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..1d343786a636 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:: auto_examples/mplot3d/plot_trisurf3d.py + .. plot:: auto_examples/mplot3d/plot_trisurf3d_2.py .. versionadded:: 1.2.0 This plotting function was added for the v1.2.0 release.