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

Skip to content

Commit faabe8c

Browse files
authored
Merge branch 'master' into update-installrst
2 parents 41080b1 + ff67864 commit faabe8c

File tree

106 files changed

+977
-1196
lines changed

Some content is hidden

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

106 files changed

+977
-1196
lines changed

doc-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ ipython
1212
ipywidgets
1313
numpydoc>=0.4
1414
pillow
15-
sphinx-gallery>=0.1.12
15+
sphinx-gallery>=0.1.13

doc/api/animation_api.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ To save an animation to disk use `Animation.save` or `Animation.to_html5_video`
3636
See :ref:`ani_writer_classes` below for details about what movie formats are
3737
supported.
3838

39+
40+
.. _func-animation:
41+
3942
``FuncAnimation``
4043
-----------------
4144

doc/api/api_changes/2017-12-20-TH.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Deprecations
2+
````````````
3+
4+
`.Legend.draggable()` is drepecated in favor of `.Legend.set_draggable()`.
5+
``Legend.draggable`` may be reintroduced as a property in future releases.

doc/api/next_api_changes/2018-02-15-AL-deprecations.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The following classes, methods, functions, and attributes are deprecated:
1212

1313
- ``afm.parse_afm``,
1414
- ``backend_pgf.get_texcommand``,
15+
- ``backend_ps.get_bbox``,
1516
- ``backend_qt5.error_msg_qt``, ``backend_qt5.exception_handler``,
1617
- ``backend_wx.FigureCanvasWx.macros``,
1718
- ``cbook.GetRealpathAndStat``, ``cbook.Locked``,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Consistent handling of \*args in Axes.stem
2+
------------------------------------------
3+
4+
:meth:`matplotlib.axex.Axes.stem` now raises TypeError when passed
5+
unhandled positional arguments. If two or more arguments are passed
6+
(ie X, Y, [linefmt], ...) and Y cannot be cast to an array, an error
7+
will be raised instead of treating X as Y and Y as linefmt.

doc/conf.py

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# All configuration values have a default value; values that are commented out
1010
# serve to show the default value.
1111

12-
from glob import glob
1312
import os
1413
import shutil
1514
import sys
@@ -72,8 +71,10 @@ def _check_deps():
7271
_check_deps()
7372

7473
# Import only after checking for dependencies.
75-
from sphinx_gallery.sorting import ExplicitOrder
76-
# This is only necessary to monkey patch the signature later on.
74+
# gallery_order.py from the sphinxext folder provides the classes that
75+
# allow custom ordering of sections and subsections of the gallery
76+
import sphinxext.gallery_order as gallery_order
77+
# The following import is only necessary to monkey patch the signature later on
7778
from sphinx_gallery import gen_rst
7879

7980
if shutil.which('dot') is None:
@@ -94,27 +95,7 @@ def _check_deps():
9495
'cycler': ('https://matplotlib.org/cycler', None),
9596
}
9697

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

119100
# Sphinx gallery configuration
120101
sphinx_gallery_conf = {
@@ -128,7 +109,8 @@ def _check_deps():
128109
'scipy': 'https://docs.scipy.org/doc/scipy/reference',
129110
},
130111
'backreferences_dir': 'api/_as_gen',
131-
'subsection_order': ExplicitOrder(explicit_order_folders),
112+
'subsection_order': gallery_order.sectionorder,
113+
'within_subsection_order': gallery_order.subsectionorder,
132114
'min_reported_time': 1,
133115
}
134116

doc/devel/documenting_mpl.rst

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ using the Sphinx_ documentation generation tool. There are several extra
4242
requirements that are needed to build the documentation. They are listed in
4343
:file:`doc-requirements.txt` and listed below:
4444

45-
* Sphinx>=1.3, !=1.5.0, !=1.6.4
45+
* Sphinx>=1.3, !=1.5.0, !=1.6.4, !=1.7.3
4646
* colorspacious
4747
* IPython
4848
* numpydoc>=0.4
4949
* Pillow
50-
* sphinx-gallery>=0.1.12
50+
* sphinx-gallery>=0.1.13
5151
* graphviz
5252

5353
.. note::
@@ -680,6 +680,28 @@ are delimited by a line of `###` characters:
680680
681681
In this way text, code, and figures are output in a "notebook" style.
682682

683+
Order of examples in the gallery
684+
--------------------------------
685+
686+
The order of the sections of the :ref:`tutorials` and the :ref:`gallery`, as
687+
well as the order of the examples within each section are determined in a
688+
two step process from within the :file:`/doc/sphinxext/gallery_order.py`:
689+
690+
* *Explicit order*: This file contains a list of folders for the section order
691+
and a list of examples for the subsection order. The order of the items
692+
shown in the doc pages is the order those items appear in those lists.
693+
* *Implicit order*: If a folder or example is not in those lists, it will be
694+
appended after the explicitely ordered items and all of those additional
695+
items will be ordered by pathname (for the sections) or by filename
696+
(for the subsections).
697+
698+
As a consequence, if you want to let your example appear in a certain
699+
position in the gallery, extend those lists with your example.
700+
In case no explicit order is desired or necessary, still make sure
701+
to name your example consistently, i.e. use the main function or subject
702+
of the example as first word in the filename; e.g. an image example
703+
should ideally be named similar to :file:`imshow_mynewexample.py`.
704+
683705
Miscellaneous
684706
=============
685707

doc/sphinxext/gallery_order.py

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
"""
2+
Configuration for the order of gallery sections and examples.
3+
Paths are relative to the conf.py file.
4+
5+
"""
6+
7+
from sphinx_gallery.sorting import ExplicitOrder
8+
9+
# Gallery sections shall be diplayed in the following order.
10+
# Non-matching sections are appended.
11+
explicit_order_folders = [
12+
'../examples/api',
13+
'../examples/pyplots',
14+
'../examples/subplots_axes_and_figures',
15+
'../examples/color',
16+
'../examples/statistics',
17+
'../examples/lines_bars_and_markers',
18+
'../examples/images_contours_and_fields',
19+
'../examples/shapes_and_collections',
20+
'../examples/text_labels_and_annotations',
21+
'../examples/pie_and_polar_charts',
22+
'../examples/style_sheets',
23+
'../examples/axes_grid1',
24+
'../examples/axisartist',
25+
'../examples/showcase',
26+
'../tutorials/introductory',
27+
'../tutorials/intermediate',
28+
'../tutorials/advanced']
29+
30+
31+
class MplExplicitOrder(ExplicitOrder):
32+
""" for use within the 'subsection_order' key"""
33+
def __call__(self, item):
34+
"""Return a string determining the sort order."""
35+
if item in self.ordered_list:
36+
return "{:04d}".format(self.ordered_list.index(item))
37+
else:
38+
# ensure not explicitly listed items come last.
39+
return "zzz" + item
40+
41+
42+
# Subsection order:
43+
# Subsections are ordered by filename, unless they appear in the following
44+
# lists in which case the list order determines the order within the section.
45+
# Examples/tutorials that do not appear in a list will be appended.
46+
47+
list_all = [
48+
# **Tutorials**
49+
# introductory
50+
"usage", "pyplot", "sample_plots", "images", "lifecycle", "customizing",
51+
# intermediate
52+
"artists", "legend_guide", "color_cycle", "gridspec",
53+
"constrainedlayout_guide", "tight_layout_guide",
54+
# advanced
55+
# text
56+
"text_intro", "text_props",
57+
# colors
58+
"colors",
59+
60+
# **Examples**
61+
# color
62+
"color_demo",
63+
# pies
64+
"pie_features", "pie_demo2",
65+
]
66+
explicit_subsection_order = [item + ".py" for item in list_all]
67+
68+
69+
class MplExplicitSubOrder(object):
70+
""" for use within the 'within_subsection_order' key """
71+
def __init__(self, src_dir):
72+
self.src_dir = src_dir #src_dir is unused here
73+
self.ordered_list = explicit_subsection_order
74+
75+
def __call__(self, item):
76+
"""Return a string determining the sort order."""
77+
if item in self.ordered_list:
78+
return "{:04d}".format(self.ordered_list.index(item))
79+
else:
80+
# ensure not explicitly listed items come last.
81+
return "zzz" + item
82+
83+
84+
# Provide the above classes for use in conf.py
85+
sectionorder = MplExplicitOrder(explicit_order_folders)
86+
subsectionorder = MplExplicitSubOrder

doc/sphinxext/mock_gui_toolkits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
class MyCairoCffi(MagicMock):
6-
version_info = (1, 4, 0)
6+
pass
77

88

99
class MyPyQt4(MagicMock):

examples/statistics/histogram_features.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
Demo of the histogram (hist) function with a few features
44
=========================================================
55
6-
In addition to the basic histogram, this demo shows a few optional
7-
features:
6+
In addition to the basic histogram, this demo shows a few optional features:
87
9-
* Setting the number of data bins
10-
* The ``normed`` flag, which normalizes bin heights so that the
11-
integral of the histogram is 1. The resulting histogram is an
12-
approximation of the probability density function.
13-
* Setting the face color of the bars
14-
* Setting the opacity (alpha value).
8+
* Setting the number of data bins.
9+
* The ``normed`` flag, which normalizes bin heights so that the integral of
10+
the histogram is 1. The resulting histogram is an approximation of the
11+
probability density function.
12+
* Setting the face color of the bars.
13+
* Setting the opacity (alpha value).
1514
16-
Selecting different bin counts and sizes can significantly affect the
17-
shape of a histogram. The Astropy docs have a great section on how to
18-
select these parameters:
19-
http://docs.astropy.org/en/stable/visualization/histogram.html
15+
Selecting different bin counts and sizes can significantly affect the shape
16+
of a histogram. The Astropy docs have a great section_ on how to select these
17+
parameters.
18+
19+
.. _section: http://docs.astropy.org/en/stable/visualization/histogram.html
2020
"""
2121

2222
import matplotlib

lib/matplotlib/__init__.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@
102102
# NOTE: This file must remain Python 2 compatible for the foreseeable future,
103103
# to ensure that we error out properly for existing editable installs.
104104

105-
import six
106-
107105
import sys
108106
if sys.version_info < (3, 5): # noqa: E402
109107
raise ImportError("""
@@ -197,11 +195,6 @@ def compare_versions(a, b):
197195
raise ImportError("Matplotlib requires dateutil")
198196

199197

200-
if not compare_versions(six.__version__, '1.10'):
201-
raise ImportError(
202-
"Matplotlib requires six>=1.10; you have %s" % six.__version__)
203-
204-
205198
try:
206199
import pyparsing
207200
except ImportError:

0 commit comments

Comments
 (0)