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

0 commit comments

Comments
 (0)