diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..085f48e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +_build/ +savefig/ diff --git a/cheatsheet.rst b/cheatsheet.rst index 9f518d9..86a5d5e 100644 --- a/cheatsheet.rst +++ b/cheatsheet.rst @@ -82,8 +82,8 @@ document. You can also reference classes, modules, functions, etc that are documented using the sphinx `autodoc -`_ facilites. For example, -see the module :mod:`matplotlib.backend_bases` documentation, or the +`_ facilites. +For example, see the module :mod:`matplotlib.backend_bases` documentation, or the class :class:`~matplotlib.backend_bases.LocationEvent`, or the method :meth:`~matplotlib.backend_bases.FigureCanvasBase.mpl_connect`. diff --git a/conf.py b/conf.py index 50e7af4..14375f5 100644 --- a/conf.py +++ b/conf.py @@ -22,8 +22,7 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['matplotlib.sphinxext.only_directives', - 'matplotlib.sphinxext.plot_directive', +extensions = ['matplotlib.sphinxext.plot_directive', 'IPython.sphinxext.ipython_directive', 'IPython.sphinxext.ipython_console_highlighting', 'sphinx.ext.mathjax', diff --git a/custom_look.rst b/custom_look.rst index 8a0041f..444bede 100644 --- a/custom_look.rst +++ b/custom_look.rst @@ -5,7 +5,7 @@ Customizing the look and feel of the site ****************************************** -The `sphinx `_ site itself looks better than +The `sphinx `_ site itself looks better than the sites created with the default css, so here we'll invoke T. S. Eliot's maxim "Talent imitates, but genius steals" and grab their css and part of their layout. As before, you can either diff --git a/extensions.rst b/extensions.rst index 15e44bd..85f1771 100644 --- a/extensions.rst +++ b/extensions.rst @@ -37,8 +37,7 @@ And then we tell it what extensions to load:: # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. - extensions = ['matplotlib.sphinxext.only_directives', - 'matplotlib.sphinxext.plot_directive', + extensions = ['matplotlib.sphinxext.plot_directive', 'IPython.sphinxext.ipython_directive', 'IPython.sphinxext.ipython_console_highlighting', 'sphinx.ext.mathjax', @@ -187,8 +186,8 @@ produces this output: See the matplotlib `pyplot tutorial -`_ and -the `gallery `_ for +`_ +and the `gallery `_ for lots of examples of matplotlib plots. Inheritance diagrams diff --git a/getting_started.rst b/getting_started.rst index 81dcf70..9dfb5e0 100644 --- a/getting_started.rst +++ b/getting_started.rst @@ -10,7 +10,7 @@ Getting started Installing your doc directory ============================= -You may already have sphinx `sphinx `_ +You may already have sphinx `sphinx `_ installed -- you can check by doing:: python -c 'import sphinx' @@ -102,5 +102,5 @@ with:: Next we'll customize the look and feel of our site to give it a logo, some custom css, and update the navigation panels to look more like -the `sphinx `_ site itself -- see +the `sphinx `_ site itself -- see :ref:`custom_look`. diff --git a/ipython_directive.rst b/ipython_directive.rst index 3dab7fe..e550a07 100644 --- a/ipython_directive.rst +++ b/ipython_directive.rst @@ -44,6 +44,7 @@ be renumbered in the rendered docs, and pick up where the block above left off. .. ipython:: + :okexcept: In [1]: z = x * 3 # x is recalled from previous block diff --git a/make.bat b/make.bat new file mode 100644 index 0000000..954237b --- /dev/null +++ b/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/pyplots/ellipses.py b/pyplots/ellipses.py index 8781461..1aef2c8 100644 --- a/pyplots/ellipses.py +++ b/pyplots/ellipses.py @@ -1,19 +1,20 @@ -from pylab import * +import matplotlib.pyplot as plt from matplotlib.patches import Ellipse +import numpy as np delta = 45.0 # degrees -angles = arange(0, 360+delta, delta) +angles = np.arange(0, 360 + delta, delta) ells = [Ellipse((1, 1), 4, 2, a) for a in angles] -a = subplot(111, aspect='equal') +a = plt.subplot(111, aspect='equal') for e in ells: e.set_clip_box(a.bbox) e.set_alpha(0.1) a.add_artist(e) -xlim(-2, 4) -ylim(-1, 3) +plt.xlim(-2, 4) +plt.ylim(-1, 3) -show() +plt.show()