diff --git a/doc-requirements.txt b/doc-requirements.txt index c0ee2014cf64..b40ca6f8f9fe 100644 --- a/doc-requirements.txt +++ b/doc-requirements.txt @@ -13,3 +13,4 @@ ipywidgets numpydoc>=0.4 pillow sphinx-gallery>=0.1.13 +sphinx-automodapi diff --git a/doc/_templates/autoclass.rst b/doc/_templates/autoclass.rst new file mode 100644 index 000000000000..79f42825d501 --- /dev/null +++ b/doc/_templates/autoclass.rst @@ -0,0 +1,27 @@ +{{ fullname | escape | underline }} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :no-members: + :show-inheritance: + + {% if '__init__' in methods %} + {% set caught_result = methods.remove('__init__') %} + {% endif %} + + {% block methods %} + {% if methods %} + + .. rubric:: Methods + + .. autosummary:: + :template: autosummary.rst + :toctree: + :nosignatures: + {% for item in methods %} + ~{{ name }}.{{ item }} + {% endfor %} + + {% endif %} + {% endblock %} \ No newline at end of file diff --git a/doc/_templates/autoclass_onefile.rst b/doc/_templates/autoclass_onefile.rst new file mode 100644 index 000000000000..0e919d679da1 --- /dev/null +++ b/doc/_templates/autoclass_onefile.rst @@ -0,0 +1,57 @@ +.. contents:: Table of Contents + :depth: 2 + :local: + :backlinks: entry + :class: multicol-toc + +{{ fullname | escape | underline }} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :no-members: + :show-inheritance: + + {% if '__init__' in methods %} + {% set caught_result = methods.remove('__init__') %} + {% endif %} + + {% block methods %} + {% if methods %} + +Methods +^^^^^^^ + + .. autosummary:: + :nosignatures: + {% for item in methods %} + ~{{ name }}.{{ item }} + {% endfor %} + + {% endif %} + {% endblock %} + +Documentation +============= + +.. autoclass:: {{ objname }} + :members: + :undoc-members: + :inherited-members: + :show-inheritance: + +Examples +======== + +.. include:: {{module}}.{{name}}.examples +{% block examples %} +{% if methods %} +{% for item in methods %} +.. include:: {{module}}.{{name}}.{{item}}.examples +.. raw:: html + +
+{% endfor %} +{% endif %} +{% endblock %} + diff --git a/doc/api/collections_api.rst b/doc/api/collections_api.rst index 166dc3690c08..7331d297efaf 100644 --- a/doc/api/collections_api.rst +++ b/doc/api/collections_api.rst @@ -9,8 +9,23 @@ collections :mod:`matplotlib.collections` ============================= +.. currentmodule:: matplotlib.collections + .. automodule:: matplotlib.collections - :members: - :undoc-members: - :show-inheritance: - :inherited-members: + :no-members: + + +Classes +------- + +.. automodsumm:: matplotlib.transforms + :classes-only: + :toctree: _as_gen/ + :template: autoclass_onefile.rst + :nosignatures: + + + + + + diff --git a/doc/api/colors_api.rst b/doc/api/colors_api.rst index 196f167b93e6..7a58550079af 100644 --- a/doc/api/colors_api.rst +++ b/doc/api/colors_api.rst @@ -23,7 +23,7 @@ Classes .. autosummary:: :toctree: _as_gen/ - :template: autosummary.rst + :template: autoclass_onefile.rst BoundaryNorm Colormap diff --git a/doc/api/figure_api.rst b/doc/api/figure_api.rst index e6fee3334f33..d8e47837d12d 100644 --- a/doc/api/figure_api.rst +++ b/doc/api/figure_api.rst @@ -17,7 +17,7 @@ Classes .. autosummary:: :toctree: _as_gen/ - :template: autosummary.rst + :template: autoclass.rst :nosignatures: AxesStack diff --git a/doc/api/transformations.rst b/doc/api/transformations.rst index a50d35b080b8..3617e9006067 100644 --- a/doc/api/transformations.rst +++ b/doc/api/transformations.rst @@ -2,19 +2,17 @@ transformations *************** -.. inheritance-diagram:: matplotlib.transforms matplotlib.path - :parts: 1 - :mod:`matplotlib.transforms` -============================= +============================ .. automodule:: matplotlib.transforms - :members: TransformNode, BboxBase, Bbox, TransformedBbox, Transform, - TransformWrapper, AffineBase, Affine2DBase, Affine2D, IdentityTransform, - BlendedGenericTransform, BlendedAffine2D, blended_transform_factory, - CompositeGenericTransform, CompositeAffine2D, - composite_transform_factory, BboxTransform, BboxTransformTo, - BboxTransformFrom, ScaledTranslation, TransformedPath, nonsingular, - interval_contains, interval_contains_open - :show-inheritance: + :no-members: + :no-undoc-members: +.. automodapi:: matplotlib.transforms + :no-main-docstr: + :skip: affine_transform + :skip: inv + :skip: Path + :skip: count_bboxes_overlapping_bbox + :skip: update_path_extents \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index 5b2395702e62..2fd7ad7429b8 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -29,6 +29,7 @@ extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.autosummary', + 'sphinx_automodapi.automodapi', 'sphinx.ext.doctest', 'sphinx.ext.inheritance_diagram', 'sphinx.ext.intersphinx', @@ -48,6 +49,8 @@ exclude_patterns = ['api/api_changes/*', 'users/whats_new/*'] +automodapi_toctreedirnm = 'api/_as_gen' +automodsumm_inherited_members = True def _check_deps(): names = {"colorspacious": 'colorspacious', diff --git a/lib/matplotlib/transforms.py b/lib/matplotlib/transforms.py index 89942d87e319..ee0ad370c435 100644 --- a/lib/matplotlib/transforms.py +++ b/lib/matplotlib/transforms.py @@ -1815,7 +1815,9 @@ def to_values(self): def matrix_from_values(a, b, c, d, e, f): """ (staticmethod) Create a new transformation matrix as a 3x3 - numpy array of the form:: + numpy array of the form: + + :: a c e b d f @@ -1869,7 +1871,9 @@ class Affine2D(Affine2DBase): def __init__(self, matrix=None, **kwargs): """ - Initialize an Affine transform from a 3x3 numpy float array:: + Initialize an Affine transform from a 3x3 numpy float array: + + :: a c e b d f @@ -1894,7 +1898,9 @@ def __str__(self): def from_values(a, b, c, d, e, f): """ (staticmethod) Create a new Affine2D instance from the given - values:: + values: + + :: a c e b d f @@ -1907,7 +1913,9 @@ def from_values(a, b, c, d, e, f): def get_matrix(self): """ - Get the underlying transformation matrix as a 3x3 numpy array:: + Get the underlying transformation matrix as a 3x3 numpy array: + + :: a c e b d f @@ -1920,7 +1928,9 @@ def get_matrix(self): def set_matrix(self, mtx): """ - Set the underlying transformation matrix from a 3x3 numpy array:: + Set the underlying transformation matrix from a 3x3 numpy array: + + :: a c e b d f