Skip to content

Commit 0f6319c

Browse files
committed
Update sampledoc
- update links to sphinx and matplotlib - remove matplotlib.sphinxext.only_directives (part of sphinx now) - add make.bat to build on Windows - replace pylab imports by matplotlib and numpy - add :okexcept: in ipython_directive.rst to build without errors - add .gitignore file
1 parent b5ad3ea commit 0f6319c

9 files changed

Lines changed: 54 additions & 17 deletions

File tree

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_build/
2+
savefig/

‎cheatsheet.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ document.
8282

8383
You can also reference classes, modules, functions, etc that are
8484
documented using the sphinx `autodoc
85-
<http://sphinx.pocoo.org/ext/autodoc.html>`_ facilites. For example,
86-
see the module :mod:`matplotlib.backend_bases` documentation, or the
85+
<https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html>`_ facilites.
86+
For example, see the module :mod:`matplotlib.backend_bases` documentation, or the
8787
class :class:`~matplotlib.backend_bases.LocationEvent`, or the method
8888
:meth:`~matplotlib.backend_bases.FigureCanvasBase.mpl_connect`.
8989

‎conf.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
# Add any Sphinx extension module names here, as strings. They can be extensions
2424
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
25-
extensions = ['matplotlib.sphinxext.only_directives',
26-
'matplotlib.sphinxext.plot_directive',
25+
extensions = ['matplotlib.sphinxext.plot_directive',
2726
'IPython.sphinxext.ipython_directive',
2827
'IPython.sphinxext.ipython_console_highlighting',
2928
'sphinx.ext.mathjax',

‎custom_look.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Customizing the look and feel of the site
66
******************************************
77

8-
The `sphinx <http://www.sphinx-doc.org>`_ site itself looks better than
8+
The `sphinx <https://www.sphinx-doc.org/en/master/>`_ site itself looks better than
99
the sites created with the default css, so here we'll
1010
invoke T. S. Eliot's maxim "Talent imitates, but genius steals" and
1111
grab their css and part of their layout. As before, you can either

‎extensions.rst‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ And then we tell it what extensions to load::
3737

3838
# Add any Sphinx extension module names here, as strings. They can be extensions
3939
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
40-
extensions = ['matplotlib.sphinxext.only_directives',
41-
'matplotlib.sphinxext.plot_directive',
40+
extensions = ['matplotlib.sphinxext.plot_directive',
4241
'IPython.sphinxext.ipython_directive',
4342
'IPython.sphinxext.ipython_console_highlighting',
4443
'sphinx.ext.mathjax',
@@ -187,8 +186,8 @@ produces this output:
187186

188187

189188
See the matplotlib `pyplot tutorial
190-
<https://matplotlib.org/users/pyplot_tutorial.html>`_ and
191-
the `gallery <https://matplotlib.org/gallery.html>`_ for
189+
<https://matplotlib.org/stable/tutorials/introductory/pyplot.html#sphx-glr-tutorials-introductory-pyplot-py>`_
190+
and the `gallery <https://matplotlib.org/stable/gallery/index.html>`_ for
192191
lots of examples of matplotlib plots.
193192

194193
Inheritance diagrams

‎getting_started.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Getting started
1010
Installing your doc directory
1111
=============================
1212

13-
You may already have sphinx `sphinx <http://sphinx.pocoo.org/>`_
13+
You may already have sphinx `sphinx <https://www.sphinx-doc.org/en/master/>`_
1414
installed -- you can check by doing::
1515

1616
python -c 'import sphinx'
@@ -102,5 +102,5 @@ with::
102102

103103
Next we'll customize the look and feel of our site to give it a logo,
104104
some custom css, and update the navigation panels to look more like
105-
the `sphinx <http://sphinx.pocoo.org/>`_ site itself -- see
105+
the `sphinx <https://www.sphinx-doc.org/en/master/>`_ site itself -- see
106106
:ref:`custom_look`.

‎ipython_directive.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ be renumbered in the rendered docs, and pick up where the block above
4444
left off.
4545

4646
.. ipython::
47+
:okexcept:
4748

4849
In [1]: z = x * 3 # x is recalled from previous block
4950

‎make.bat‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

‎pyplots/ellipses.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
from pylab import *
1+
import matplotlib.pyplot as plt
22
from matplotlib.patches import Ellipse
3+
import numpy as np
34

45
delta = 45.0 # degrees
56

6-
angles = arange(0, 360+delta, delta)
7+
angles = np.arange(0, 360 + delta, delta)
78
ells = [Ellipse((1, 1), 4, 2, a) for a in angles]
89

9-
a = subplot(111, aspect='equal')
10+
a = plt.subplot(111, aspect='equal')
1011

1112
for e in ells:
1213
e.set_clip_box(a.bbox)
1314
e.set_alpha(0.1)
1415
a.add_artist(e)
1516

16-
xlim(-2, 4)
17-
ylim(-1, 3)
17+
plt.xlim(-2, 4)
18+
plt.ylim(-1, 3)
1819

19-
show()
20+
plt.show()

0 commit comments

Comments
 (0)