diff --git a/doc/_templates/autoclass.rst b/doc/_templates/autoclass.rst new file mode 100644 index 000000000000..f974368b851b --- /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/api/index.rst b/doc/api/index.rst index 2646cb783bcd..6f28baca0ade 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -57,7 +57,7 @@ Modules text_api.rst ticker_api.rst tight_layout_api.rst - transformations.rst + transforms_api.rst tri_api.rst type1font.rst units_api.rst diff --git a/doc/api/transformations.rst b/doc/api/transformations.rst deleted file mode 100644 index a50d35b080b8..000000000000 --- a/doc/api/transformations.rst +++ /dev/null @@ -1,20 +0,0 @@ -*************** -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: - diff --git a/doc/api/transforms_api.rst b/doc/api/transforms_api.rst new file mode 100644 index 000000000000..ee58af3403cd --- /dev/null +++ b/doc/api/transforms_api.rst @@ -0,0 +1,59 @@ +********** +transforms +********** +.. inheritance-diagram:: matplotlib.transforms matplotlib.path + :parts: 1 + +:mod:`matplotlib.transforms` +============================= + +.. currentmodule:: matplotlib.transforms + +.. automodule:: matplotlib.transforms + :no-members: + +Classes +------- + +.. autosummary:: + :toctree: _as_gen/ + :template: autoclass.rst + :nosignatures: + + TransformNode + BboxBase + Bbox + TransformedBbox + LockableBbox + Transform + TransformWrapper + AffineBase + Affine2DBase + Affine2D + IdentityTransform + BlendedGenericTransform + BlendedAffine2D + CompositeGenericTransform + CompositeAffine2D + BboxTransform + BboxTransformTo + BboxTransformToMaxOnly + BboxTransformFrom + ScaledTranslation + TransformedPath + TransformedPatchPath + +Functions +--------- + +.. autosummary:: + :toctree: _as_gen/ + :template: autosummary.rst + :nosignatures: + + blended_transform_factory + composite_transform_factory + nonsingular + interval_contains + interval_contains_open + offset_copy diff --git a/lib/matplotlib/transforms.py b/lib/matplotlib/transforms.py index 89942d87e319..e605591d1e54 100644 --- a/lib/matplotlib/transforms.py +++ b/lib/matplotlib/transforms.py @@ -1814,12 +1814,16 @@ def to_values(self): @staticmethod def matrix_from_values(a, b, c, d, e, f): """ - (staticmethod) Create a new transformation matrix as a 3x3 - numpy array of the form:: + (staticmethod) Create a new transformation matrix. - a c e - b d f - 0 0 1 + Parameters + ---------- + a, b, c, d, e, f: floats + The parameters in the transformation matrix of the form:: + + a c e + b d f + 0 0 1 """ return np.array([[a, c, e], [b, d, f], [0.0, 0.0, 1.0]], float) @@ -1869,13 +1873,18 @@ 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. + + Parameters + ---------- + matrix : 3 x 3 numpy float array, optional + The *matrix* should have the following form:: - a c e - b d f - 0 0 1 + a c e + b d f + 0 0 1 - If *matrix* is None, initialize with the identity transform. + If *matrix* is None, initialize with the identity transform. """ Affine2DBase.__init__(self, **kwargs) if matrix is None: @@ -1893,40 +1902,48 @@ def __str__(self): @staticmethod def from_values(a, b, c, d, e, f): """ - (staticmethod) Create a new Affine2D instance from the given - values:: + (staticmethod) Create a new Affine2D instance. - a c e - b d f - 0 0 1 + Parameters + ---------- + a, b, c, d, e, f: floats + The parameters in the transformation matrix of the form:: - . + a c e + b d f + 0 0 1 """ return Affine2D( np.array([a, c, e, b, d, f, 0.0, 0.0, 1.0], float).reshape((3, 3))) def get_matrix(self): """ - Get the underlying transformation matrix as a 3x3 numpy array:: + Get the underlying transformation matrix. - a c e - b d f - 0 0 1 + Returns + ------- + matrix: a 3x3 numpy array + The form of the matrix:: - . + a c e + b d f + 0 0 1 """ self._invalid = 0 return self._mtx def set_matrix(self, mtx): """ - Set the underlying transformation matrix from a 3x3 numpy array:: + Set the underlying transformation matrix. - a c e - b d f - 0 0 1 + Parameters + ---------- + mtx: a 3x3 numpy array + The transformation matrix of the form:: - . + a c e + b d f + 0 0 1 """ self._mtx = mtx self.invalidate()