Skip to content

Commit a3c72bd

Browse files
committed
adding gallery sorting
1 parent b198b41 commit a3c72bd

25 files changed

+34
-19
lines changed

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/conf.py

Lines changed: 16 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,18 @@ def _check_deps():
9597
'pandas': ('http://pandas.pydata.org/pandas-docs/stable', None)
9698
}
9799

100+
explicit_order_folders = ['../examples/pyplots',
101+
'../examples/statistics',
102+
'../examples/color',
103+
'../examples/pylab_examples',
104+
'../examples/showcase',
105+
'../tutorials/introductory',
106+
'../tutorials/intermediate',
107+
'../tutorials/advanced']
108+
for folder in glob('../examples/*') + glob('../tutorials/*'):
109+
if not os.path.isdir(folder) or folder in explicit_order_folders:
110+
continue
111+
explicit_order_folders.append(folder)
98112

99113
# Sphinx gallery configuration
100114
sphinx_gallery_conf = {
@@ -107,7 +121,8 @@ def _check_deps():
107121
'numpy': 'https://docs.scipy.org/doc/numpy',
108122
'scipy': 'https://docs.scipy.org/doc/scipy/reference',
109123
},
110-
'backreferences_dir': 'api/_as_gen'
124+
'backreferences_dir': 'api/_as_gen',
125+
'subsection_order': ExplicitOrder(explicit_order_folders)
111126
}
112127

113128
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

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

0 commit comments

Comments
 (0)