Skip to content

Commit b5c141c

Browse files
authored
DOC: user/explain reorg (and moving a lot of tutorials). (matplotlib#25395)
* DOC: make users/explain a sphinx gallery [ci doc] This is a major re-org whereby much of galleries/tutorials is moved to galleries/user_explain, and hence users/explain in the published docs. Much of this may be rearranged more over the 3.8 cycle. Additionally most tutorial references were moved from hard :doc: references to soft :ref: references for ease of further rearrangement. Note this uses the git head of sphinx-gallery and mpl-sphinx-theme. We should watch the release cycle of sphinx-gallery so that it can be changed to one of their releases.
1 parent a7ba07c commit b5c141c

File tree

137 files changed

+1145
-456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+1145
-456
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,12 @@ commands:
9797
- run:
9898
name: Install Python dependencies
9999
command: |
100+
# remove when sphinx-gallery releases #1071:
100101
python -m pip install --user \
101102
numpy<< parameters.numpy_version >> codecov coverage \
102103
-r requirements/doc/doc-requirements.txt
104+
python -m pip install --no-deps --user \
105+
git+https://github.com/sphinx-gallery/sphinx-gallery.git
103106
python -m pip install --no-deps --user \
104107
git+https://github.com/matplotlib/mpl-sphinx-theme.git
105108

.flake8

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,22 @@ per-file-ignores =
5555
lib/pylab.py: F401, F403
5656

5757
doc/conf.py: E402
58-
galleries/tutorials/advanced/path_tutorial.py: E402
59-
galleries/tutorials/advanced/patheffects_guide.py: E402
60-
galleries/tutorials/advanced/transforms_tutorial.py: E402, E501
61-
galleries/tutorials/colors/colormaps.py: E501
62-
galleries/tutorials/colors/colors.py: E402
63-
galleries/tutorials/intermediate/artists.py: E402
64-
galleries/tutorials/intermediate/constrainedlayout_guide.py: E402
65-
galleries/tutorials/intermediate/legend_guide.py: E402
66-
galleries/tutorials/intermediate/tight_layout_guide.py: E402
67-
galleries/tutorials/introductory/animation_tutorial.py: E501
68-
galleries/tutorials/introductory/images.py: E501
69-
galleries/tutorials/introductory/pyplot.py: E402, E501
70-
galleries/tutorials/text/annotations.py: E402, E501
71-
galleries/tutorials/text/mathtext.py: E501
72-
galleries/tutorials/text/text_intro.py: E402
73-
galleries/tutorials/text/text_props.py: E501
58+
galleries/users_explain/artists/paths.py: E402
59+
galleries/users_explain/artists/patheffects_guide.py: E402
60+
galleries/users_explain/artists/transforms_tutorial.py: E402, E501
61+
galleries/users_explain/colors/colormaps.py: E501
62+
galleries/users_explain/colors/colors.py: E402
63+
galleries/tutorials/artists.py: E402
64+
galleries/users_explain/axes/constrainedlayout_guide.py: E402
65+
galleries/users_explain/axes/legend_guide.py: E402
66+
galleries/users_explain/axes/tight_layout_guide.py: E402
67+
galleries/users_explain/animations/animations.py: E501
68+
galleries/tutorials/images.py: E501
69+
galleries/tutorials/pyplot.py: E402, E501
70+
galleries/users_explain/text/annotations.py: E402, E501
71+
galleries/users_explain/text/mathtext.py: E501
72+
galleries/users_explain/text/text_intro.py: E402
73+
galleries/users_explain/text/text_props.py: E501
7474

7575
galleries/examples/animation/frame_grabbing_sgskip.py: E402
7676
galleries/examples/images_contours_and_fields/tricontour_demo.py: E201

doc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ clean:
2222
rm -rf "$(SOURCEDIR)/gallery"
2323
rm -rf "$(SOURCEDIR)/plot_types"
2424
rm -rf "$(SOURCEDIR)/tutorials"
25+
rm -rf "$(SOURCEDIR)/users/explain"
2526
rm -rf "$(SOURCEDIR)/savefig"
2627
rm -rf "$(SOURCEDIR)/sphinxext/__pycache__"
2728
rm -f $(SOURCEDIR)/_static/constrained_layout*.png

doc/api/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ programmatic plot generation.
7575
Further reading:
7676

7777
- The `matplotlib.pyplot` function reference
78-
- :doc:`/tutorials/introductory/pyplot`
78+
- :ref:`pyplot_tutorial`
7979
- :ref:`Pyplot examples <pyplots_examples>`
8080

8181
.. _api-index:

doc/api/prev_api_changes/api_changes_1.4.x.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ original location:
8888
* The legend handler interface has changed from a callable, to any object
8989
which implements the ``legend_artists`` method (a deprecation phase will
9090
see this interface be maintained for v1.4). See
91-
:doc:`/tutorials/intermediate/legend_guide` for further details. Further legend changes
91+
:ref:`legend_guide` for further details. Further legend changes
9292
include:
9393

9494
* ``matplotlib.axes.Axes._get_legend_handles`` now returns a generator of

doc/api/prev_api_changes/api_changes_2.2.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ New dependency
99

1010
`kiwisolver <https://github.com/nucleic/kiwi>`__ is now a required
1111
dependency to support the new constrained_layout, see
12-
:doc:`/tutorials/intermediate/constrainedlayout_guide` for
12+
:ref:`constrainedlayout_guide` for
1313
more details.
1414

1515

doc/api/prev_api_changes/api_changes_3.4.0/behaviour.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ library, so using it should be safe, but layouts may not be exactly the same as
2424
more development takes place.
2525

2626
Details of using ``constrained_layout``, and its algorithm are available at
27-
:doc:`/tutorials/intermediate/constrainedlayout_guide`
27+
:ref:`constrainedlayout_guide`
2828

2929
``plt.subplot`` re-selection without keyword arguments
3030
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

doc/api/style_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Styles are predefined sets of `.rcParams` that define the visual appearance of
66
a plot.
77

8-
:doc:`/tutorials/introductory/customizing` describes the mechanism and usage
8+
:ref:`customizing` describes the mechanism and usage
99
of styles.
1010

1111
The :doc:`/gallery/style_sheets/style_sheets_reference` gives an overview of

doc/api/toolkits/mplot3d.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ and feel as regular 2D plots. Not the fastest or most feature complete 3D
1212
library out there, but it ships with Matplotlib and thus may be a lighter
1313
weight solution for some use cases.
1414

15-
See the :doc:`mplot3d tutorial </tutorials/toolkits/mplot3d>` for
15+
See the :ref:`mplot3d tutorial <mplot3d>` for
1616
more information.
1717

1818
.. image:: /_static/demo_mplot3d.png

doc/conf.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,14 @@ def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
213213
gallery_conf['image_srcset'] = []
214214
return matplotlib_scraper(block, block_vars, gallery_conf, **kwargs)
215215

216-
gallery_dirs = [f'{ed}' for ed in ['gallery', 'tutorials', 'plot_types']
216+
gallery_dirs = [f'{ed}' for ed in
217+
['gallery', 'tutorials', 'plot_types', 'users/explain']
217218
if f'{ed}/*' not in skip_subdirs]
218219

219-
example_dirs = [f'../galleries/{gd}'.replace('gallery', 'examples')
220-
for gd in gallery_dirs]
220+
example_dirs = []
221+
for gd in gallery_dirs:
222+
gd = gd.replace('gallery', 'examples').replace('users/explain', 'users_explain')
223+
example_dirs += [f'../galleries/{gd}']
221224

222225
sphinx_gallery_conf = {
223226
'backreferences_dir': Path('api') / Path('_as_gen'),
@@ -244,6 +247,7 @@ def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
244247
'thumbnail_size': (320, 224),
245248
'within_subsection_order': gallery_order.subsectionorder,
246249
'capture_repr': (),
250+
'copyfile_regex': r'.*\.rst',
247251
}
248252

249253
if 'plot_gallery=0' in sys.argv:

0 commit comments

Comments
 (0)