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

Skip to content

Commit 6582a9d

Browse files
authored
Merge pull request #8975 from choldgraf/examples_order
adding gallery sorting
2 parents b198b41 + 0cb00ea commit 6582a9d

38 files changed

+69
-51
lines changed

doc-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ mock
1313
numpydoc
1414
pillow
1515
scipy
16-
sphinx-gallery
16+
sphinx-gallery>=0.1.12

doc/_templates/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ <h1>Introduction</h1>
5555
interface toolkits.</p>
5656

5757
<div class="responsive_screenshots">
58-
<a a href="{{ pathto('tutorials/01_introductory/sample_plots') }}">
58+
<a a href="{{ pathto('tutorials/introductory/sample_plots') }}">
5959
<div class="responsive_subfig">
6060
<img align="middle", src="{{ pathto('_images/sphx_glr_membrane_thumb.png', 1) }}", border="0", alt="screenshots"/>
6161
</div>
@@ -75,7 +75,7 @@ <h1>Introduction</h1>
7575
<p>Matplotlib tries to make easy things easy and hard things possible.
7676
You can generate plots, histograms, power spectra, bar charts,
7777
errorcharts, scatterplots, etc., with just a few lines of code.
78-
For examples, see the <a href="{{ pathto('tutorials/01_introductory/sample_plots')
78+
For examples, see the <a href="{{ pathto('tutorials/introductory/sample_plots')
7979
}}">sample plots</a> and <a href="{{ pathto('gallery/index') }}">thumbnail</a> gallery.</p>
8080

8181
<p>For simple plotting the <tt>pyplot</tt> module provides a

doc/api/api_changes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ original location:
821821
* The legend handler interface has changed from a callable, to any object
822822
which implements the ``legend_artists`` method (a deprecation phase will
823823
see this interface be maintained for v1.4). See
824-
:ref:`sphx_glr_tutorials_02_intermediate_legend_guide.py` for further details. Further legend changes
824+
:ref:`sphx_glr_tutorials_intermediate_legend_guide.py` for further details. Further legend changes
825825
include:
826826

827827
* :func:`matplotlib.axes.Axes._get_legend_handles` now returns a generator

doc/api/pyplot_summary.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The Pyplot API
88
The :mod:`matplotlib.pyplot` module contains functions that allow you to generate
99
many kinds of plots quickly. For examples that showcase the use
1010
of the :mod:`matplotlib.pyplot` module, see the
11-
:ref:`sphx_glr_tutorials_01_introductory_pyplot.py`
11+
:ref:`sphx_glr_tutorials_introductory_pyplot.py`
1212
or the :ref:`pyplots_examples`. We also recommend that you look into
1313
the object-oriented approach to plotting, described below.
1414

doc/conf.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import sys
1616
import sphinx
1717
import six
18+
from glob import glob
19+
from sphinx_gallery.sorting import ExplicitOrder
1820

1921
# If your extensions are in another directory, add it here. If the directory
2022
# is relative to the documentation root, use os.path.abspath to make it
@@ -95,6 +97,27 @@ def _check_deps():
9597
'pandas': ('http://pandas.pydata.org/pandas-docs/stable', None)
9698
}
9799

100+
explicit_order_folders = [
101+
'../examples/api',
102+
'../examples/pyplots',
103+
'../examples/subplots_axes_and_figures',
104+
'../examples/color',
105+
'../examples/statistics',
106+
'../examples/lines_bars_and_markers',
107+
'../examples/images_contours_and_fields',
108+
'../examples/shapes_and_collections',
109+
'../examples/text_labels_and_annotations',
110+
'../examples/pie_and_polar_charts',
111+
'../examples/style_sheets',
112+
'../examples/axes_grid',
113+
'../examples/showcase',
114+
'../tutorials/introductory',
115+
'../tutorials/intermediate',
116+
'../tutorials/advanced']
117+
for folder in sorted(glob('../examples/*') + glob('../tutorials/*')):
118+
if not os.path.isdir(folder) or folder in explicit_order_folders:
119+
continue
120+
explicit_order_folders.append(folder)
98121

99122
# Sphinx gallery configuration
100123
sphinx_gallery_conf = {
@@ -107,7 +130,8 @@ def _check_deps():
107130
'numpy': 'https://docs.scipy.org/doc/numpy',
108131
'scipy': 'https://docs.scipy.org/doc/scipy/reference',
109132
},
110-
'backreferences_dir': 'api/_as_gen'
133+
'backreferences_dir': 'api/_as_gen',
134+
'subsection_order': ExplicitOrder(explicit_order_folders)
111135
}
112136

113137
plot_gallery = True

doc/devel/contributing.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Submitting a bug report
1414

1515
If you find a bug in the code or documentation, do not hesitate to submit a
1616
ticket to the
17-
`Bug Tracker <https://github.com/matplotlib/matplotlib/issues>`_. You are also
17+
`Bug Tracker <https://github.com/matplotlib/matplotlib/issues>`_. You are also
1818
welcome to post feature requests or pull requests.
1919

2020
If you are reporting a bug, please do your best to include the following:
@@ -23,7 +23,7 @@ If you are reporting a bug, please do your best to include the following:
2323
sentences.
2424

2525
2. A short, self-contained code snippet to reproduce the bug, ideally allowing
26-
a simple copy and paste to reproduce. Please do your best to reduce the code
26+
a simple copy and paste to reproduce. Please do your best to reduce the code
2727
snippet to the minimum required.
2828

2929
3. The actual outcome of the code snippet
@@ -42,7 +42,7 @@ If you are reporting a bug, please do your best to include the following:
4242

4343
We have preloaded the issue creation page with a Markdown template that you can
4444
use to organize this information.
45-
45+
4646
Thank you for your help in keeping bug reports complete, targeted and descriptive.
4747

4848
Retrieving and installing the latest version of the code
@@ -79,8 +79,8 @@ You can check out the latest sources with the command (see
7979

8080
git clone https://github.com:matplotlib/matplotlib.git
8181

82-
and navigate to the :file:`matplotlib` directory. If you have the proper privileges,
83-
you can use ``git@`` instead of ``https://``, which works through the ssh protocol
82+
and navigate to the :file:`matplotlib` directory. If you have the proper privileges,
83+
you can use ``git@`` instead of ``https://``, which works through the ssh protocol
8484
and might be easier to use if you are using 2-factor authentication.
8585

8686

@@ -427,7 +427,7 @@ Developing a new backend
427427
------------------------
428428

429429
If you are working on a custom backend, the *backend* setting in
430-
:file:`matplotlibrc` (:ref:`sphx_glr_tutorials_01_introductory_customizing.py`) supports an
430+
:file:`matplotlibrc` (:ref:`sphx_glr_tutorials_introductory_customizing.py`) supports an
431431
external backend via the ``module`` directive. If
432432
:file:`my_backend.py` is a Matplotlib backend in your
433433
:envvar:`PYTHONPATH`, you can set it on one of several ways

doc/faq/howto_faq.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ If you only want to use the `pandas` converter for `datetime64` values ::
4848
Find all objects in a figure of a certain type
4949
----------------------------------------------
5050

51-
Every Matplotlib artist (see :ref:`sphx_glr_tutorials_02_intermediate_artists.py`) has a method
51+
Every Matplotlib artist (see :ref:`sphx_glr_tutorials_intermediate_artists.py`) has a method
5252
called :meth:`~matplotlib.artist.Artist.findobj` that can be used to
5353
recursively search the artist for any artists it may contain that meet
5454
some criteria (e.g., match all :class:`~matplotlib.lines.Line2D`
@@ -160,7 +160,7 @@ labels::
160160
ax = fig.add_subplot(111)
161161

162162
You can control the defaults for these parameters in your
163-
:file:`matplotlibrc` file; see :ref:`sphx_glr_tutorials_01_introductory_customizing.py`. For
163+
:file:`matplotlibrc` file; see :ref:`sphx_glr_tutorials_introductory_customizing.py`. For
164164
example, to make the above setting permanent, you would set::
165165

166166
figure.subplot.bottom : 0.2 # the bottom of the subplots of the figure
@@ -201,7 +201,7 @@ Automatically make room for tick labels
201201
.. note::
202202
This is now easier to handle than ever before.
203203
Calling :func:`~matplotlib.pyplot.tight_layout` can fix many common
204-
layout issues. See the :ref:`sphx_glr_tutorials_02_intermediate_tight_layout_guide.py`.
204+
layout issues. See the :ref:`sphx_glr_tutorials_intermediate_tight_layout_guide.py`.
205205

206206
The information below is kept here in case it is useful for other
207207
purposes.

doc/faq/installing_faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ and run it with::
3434

3535
This will give you additional information about which backends matplotlib is
3636
loading, version information, and more. At this point you might want to make
37-
sure you understand matplotlib's :ref:`configuration <sphx_glr_tutorials_01_introductory_customizing.py>`
37+
sure you understand matplotlib's :ref:`configuration <sphx_glr_tutorials_introductory_customizing.py>`
3838
process, governed by the :file:`matplotlibrc` configuration file which contains
3939
instructions within and the concept of the matplotlib backend.
4040

doc/faq/troubleshooting_faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ please provide the following information in your e-mail to the
108108

109109

110110
* any customizations to your ``matplotlibrc`` file (see
111-
:ref:`sphx_glr_tutorials_01_introductory_customizing.py`).
111+
:ref:`sphx_glr_tutorials_introductory_customizing.py`).
112112

113113
* if the problem is reproducible, please try to provide a *minimal*,
114114
standalone Python script that demonstrates the problem. This is

doc/users/intro.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ The Matplotlib code is conceptually divided into three parts: the
6262
*pylab interface* is the set of functions provided by
6363
:mod:`matplotlib.pylab` which allow the user to create plots with code
6464
quite similar to MATLAB figure generating code
65-
(:ref:`sphx_glr_tutorials_01_introductory_pyplot.py`). The *Matplotlib frontend* or *Matplotlib
65+
(:ref:`sphx_glr_tutorials_introductory_pyplot.py`). The *Matplotlib frontend* or *Matplotlib
6666
API* is the set of classes that do the heavy lifting, creating and
6767
managing figures, text, lines, plots and so on
68-
(:ref:`sphx_glr_tutorials_02_intermediate_artists.py`). This is an abstract interface that knows
68+
(:ref:`sphx_glr_tutorials_intermediate_artists.py`). This is an abstract interface that knows
6969
nothing about output. The *backends* are device-dependent drawing
7070
devices, aka renderers, that transform the frontend representation to
7171
hardcopy or a display device (:ref:`what-is-a-backend`). Example

doc/users/prev_whats_new/whats_new_0.99.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ New in matplotlib 0.99
1111
New documentation
1212
-----------------
1313

14-
Jae-Joon Lee has written two new guides :ref:`sphx_glr_tutorials_02_intermediate_legend_guide.py`
14+
Jae-Joon Lee has written two new guides :ref:`sphx_glr_tutorials_intermediate_legend_guide.py`
1515
and :ref:`plotting-guide-annotation`. Michael Sarahan has written
16-
:ref:`sphx_glr_tutorials_01_introductory_images.py`. John Hunter has written two new tutorials on
17-
working with paths and transformations: :ref:`sphx_glr_tutorials_03_advanced_path_tutorial.py` and
18-
:ref:`sphx_glr_tutorials_03_advanced_transforms_tutorial.py`.
16+
:ref:`sphx_glr_tutorials_introductory_images.py`. John Hunter has written two new tutorials on
17+
working with paths and transformations: :ref:`sphx_glr_tutorials_advanced_path_tutorial.py` and
18+
:ref:`sphx_glr_tutorials_advanced_transforms_tutorial.py`.
1919

2020
.. _whats-new-mplot3d:
2121

doc/users/prev_whats_new/whats_new_1.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Sophisticated subplot grid layout
2323

2424
Jae-Joon Lee has written :mod:`~matplotlib.gridspec`, a new module for
2525
doing complex subplot layouts, featuring row and column spans and
26-
more. See :ref:`sphx_glr_tutorials_02_intermediate_gridspec.py` for a tutorial overview.
26+
more. See :ref:`sphx_glr_tutorials_intermediate_gridspec.py` for a tutorial overview.
2727

2828
.. figure:: ../../gallery/userdemo/images/sphx_glr_demo_gridspec01_000.png
2929
:target: ../../gallery/userdemo/demo_gridspec01.html

doc/users/prev_whats_new/whats_new_1.1.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ The usage of this functionality can be as simple as ::
8787

8888
and it will adjust the spacing between subplots
8989
so that the axis labels do not overlap with neighboring subplots. A
90-
:ref:`sphx_glr_tutorials_02_intermediate_tight_layout_guide.py` has been created to show how to use
90+
:ref:`sphx_glr_tutorials_intermediate_tight_layout_guide.py` has been created to show how to use
9191
this new tool.
9292

9393
PyQT4, PySide, and IPython
@@ -116,7 +116,7 @@ legends for complex plots such as :meth:`~matplotlib.pyplot.stem` plots
116116
will now display correctly. Second, the 'best' placement of a legend has
117117
been improved in the presence of NANs.
118118

119-
See the :ref:`sphx_glr_tutorials_02_intermediate_legend_guide.py` for more detailed explanation and
119+
See the :ref:`sphx_glr_tutorials_intermediate_legend_guide.py` for more detailed explanation and
120120
examples.
121121

122122
.. figure:: ../../gallery/text_labels_and_annotations/images/sphx_glr_legend_demo_004.png
@@ -228,7 +228,3 @@ Other improvements
228228
other colormaps :ref:`here <color-colormaps_reference>`.
229229

230230
* Many bug fixes and documentation improvements.
231-
232-
233-
234-

doc/users/prev_whats_new/whats_new_1.4.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ instead of ``:context:`` any time you want to reset the context.
410410

411411
Legend and PathEffects documentation
412412
------------------------------------
413-
The :ref:`sphx_glr_tutorials_02_intermediate_legend_guide.py` and :ref:`sphx_glr_tutorials_03_advanced_patheffects_guide.py` have both been
413+
The :ref:`sphx_glr_tutorials_intermediate_legend_guide.py` and :ref:`sphx_glr_tutorials_advanced_patheffects_guide.py` have both been
414414
updated to better reflect the full potential of each of these powerful
415415
features.
416416

@@ -427,5 +427,3 @@ rectangle stay on the axes after you release the mouse.
427427
GAE integration
428428
---------------
429429
Matplotlib will now run on google app engine.
430-
431-

doc/users/shell.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ are going to need to understand what a matplotlib backend is
9292
With the TkAgg backend, which uses the Tkinter user interface toolkit,
9393
you can use matplotlib from an arbitrary non-gui python shell. Just set your
9494
``backend : TkAgg`` and ``interactive : True`` in your
95-
:file:`matplotlibrc` file (see :ref:`sphx_glr_tutorials_01_introductory_customizing.py`) and fire
95+
:file:`matplotlibrc` file (see :ref:`sphx_glr_tutorials_introductory_customizing.py`) and fire
9696
up python. Then::
9797

9898
>>> from pylab import *

examples/recipes/placing_text_boxes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
==================
44
55
When decorating axes with text boxes, two useful tricks are to place
6-
the text in axes coordinates (see :ref:`sphx_glr_tutorials_03_advanced_transforms_tutorial.py`), so the
6+
the text in axes coordinates (see :ref:`sphx_glr_tutorials_advanced_transforms_tutorial.py`), so the
77
text doesn't move around with changes in x or y limits. You can also
88
use the ``bbox`` property of text to surround the text with a
99
:class:`~matplotlib.patches.Patch` instance -- the ``bbox`` keyword

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ def legend(self, *args, **kwargs):
502502
-----
503503
504504
Not all kinds of artist are supported by the legend command. See
505-
:ref:`sphx_glr_tutorials_02_intermediate_legend_guide.py` for details.
505+
:ref:`sphx_glr_tutorials_intermediate_legend_guide.py` for details.
506506
507507
Examples
508508
--------

lib/matplotlib/figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ def legend(self, *args, **kwargs):
14501450
Notes
14511451
-----
14521452
Not all kinds of artist are supported by the legend command. See
1453-
:ref:`sphx_glr_tutorials_02_intermediate_legend_guide.py` for details.
1453+
:ref:`sphx_glr_tutorials_intermediate_legend_guide.py` for details.
14541454
"""
14551455

14561456
# If no arguments given, collect up all the artists on the figure

lib/matplotlib/legend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Most users would normally create a legend via the
99
:meth:`~matplotlib.axes.Axes.legend` function. For more details on legends
1010
there is also a :ref:`legend guide
11-
<sphx_glr_tutorials_02_intermediate_legend_guide.py>`.
11+
<sphx_glr_tutorials_intermediate_legend_guide.py>`.
1212
1313
The Legend class can be considered as a container of legend handles
1414
and legend texts. Creation of corresponding legend handles from the
@@ -19,7 +19,7 @@
1919
Note that not all kinds of artist are supported by the legend yet by default
2020
but it is possible to extend the legend handler's capabilities to support
2121
arbitrary objects. See the :ref:`legend guide
22-
<sphx_glr_tutorials_02_intermediate_legend_guide.py>` for more information.
22+
<sphx_glr_tutorials_intermediate_legend_guide.py>` for more information.
2323
2424
"""
2525
from __future__ import (absolute_import, division, print_function,

lib/matplotlib/legend_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
This module defines default legend handlers.
33
44
It is strongly encouraged to have read the :ref:`legend guide
5-
<sphx_glr_tutorials_02_intermediate_legend_guide.py>` before this documentation.
5+
<sphx_glr_tutorials_intermediate_legend_guide.py>` before this documentation.
66
77
Legend handlers are expected to be a callable object with a following
88
signature. ::
File renamed without changes.

tutorials/02_intermediate/tight_layout_guide.py renamed to tutorials/intermediate/tight_layout_guide.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def example_plot(ax, fontsize=12):
108108
###############################################################################
109109
# It works with subplots created with
110110
# :func:`~matplotlib.pyplot.subplot2grid`. In general, subplots created
111-
# from the gridspec (:ref:`sphx_glr_tutorials_02_intermediate_gridspec.py`) will work.
111+
# from the gridspec (:ref:`sphx_glr_tutorials_intermediate_gridspec.py`) will work.
112112

113113
plt.close('all')
114114
fig = plt.figure()

tutorials/01_introductory/lifecycle.py renamed to tutorials/introductory/lifecycle.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
The second is based on MATLAB and uses
2727
a state-based interface. This is encapsulated in the :mod:`pyplot`
2828
module. See the :ref:`pyplot tutorials
29-
<sphx_glr_tutorials_01_introductory_pyplot.py>`
29+
<sphx_glr_tutorials_introductory_pyplot.py>`
3030
for a more in-depth look at the pyplot interface.
3131
3232
Most of the terms are straightforward but the main thing to remember
@@ -86,7 +86,7 @@
8686
#
8787
# Figures can have multiple axes on them. For information on how to do this,
8888
# see the :ref:`Tight Layout tutorial
89-
# <sphx_glr_tutorials_02_intermediate_tight_layout_guide.py>`.
89+
# <sphx_glr_tutorials_intermediate_tight_layout_guide.py>`.
9090

9191
fig, ax = plt.subplots()
9292

@@ -149,7 +149,7 @@
149149
# that we create. To do this we'll set the ``autolayout`` value of our
150150
# rcParams. For more information on controlling the style, layout, and
151151
# other features of plots with rcParams, see
152-
# :ref:`sphx_glr_tutorials_01_introductory_customizing.py`.
152+
# :ref:`sphx_glr_tutorials_introductory_customizing.py`.
153153

154154
plt.rcParams.update({'figure.autolayout': True})
155155

tutorials/01_introductory/pyplot.py renamed to tutorials/introductory/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def f(t):
307307
# it annoying that states (specifically the current image, figure and axes)
308308
# are being maintained for you behind the scenes, don't despair: this is just a thin
309309
# stateful wrapper around an object oriented API, which you can use
310-
# instead (see :ref:`sphx_glr_tutorials_02_intermediate_artists.py`)
310+
# instead (see :ref:`sphx_glr_tutorials_intermediate_artists.py`)
311311
#
312312
# If you are making lots of figures, you need to be aware of one
313313
# more thing: the memory required for a figure is not completely

0 commit comments

Comments
 (0)