Skip to content

Commit 76c76e6

Browse files
committed
transforms api changes
1 parent 2887c49 commit 76c76e6

File tree

5 files changed

+130
-48
lines changed

5 files changed

+130
-48
lines changed

doc/_templates/autoclass.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{ fullname | escape | underline }}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. autoclass:: {{ objname }}
6+
:no-members:
7+
:show-inheritance:
8+
9+
{% if '__init__' in methods %}
10+
{% set caught_result = methods.remove('__init__') %}
11+
{% endif %}
12+
13+
{% block methods %}
14+
{% if methods %}
15+
16+
.. rubric:: Methods
17+
18+
.. autosummary::
19+
:template: autosummary.rst
20+
:toctree:
21+
:nosignatures:
22+
{% for item in methods %}
23+
~{{ name }}.{{ item }}
24+
{% endfor %}
25+
26+
{% endif %}
27+
{% endblock %}

doc/api/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Modules
5757
text_api.rst
5858
ticker_api.rst
5959
tight_layout_api.rst
60-
transformations.rst
60+
transforms_api.rst
6161
tri_api.rst
6262
type1font.rst
6363
units_api.rst

doc/api/transformations.rst

Lines changed: 0 additions & 20 deletions
This file was deleted.

doc/api/transforms_api.rst

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
**********
2+
transforms
3+
**********
4+
.. inheritance-diagram:: matplotlib.transforms matplotlib.path
5+
:parts: 1
6+
7+
:mod:`matplotlib.transforms`
8+
=============================
9+
10+
.. currentmodule:: matplotlib.transforms
11+
12+
.. automodule:: matplotlib.transforms
13+
:no-members:
14+
15+
Classes
16+
-------
17+
18+
.. autosummary::
19+
:toctree: _as_gen/
20+
:template: autoclass.rst
21+
:nosignatures:
22+
23+
TransformNode
24+
BboxBase
25+
Bbox
26+
TransformedBbox
27+
LockableBbox
28+
Transform
29+
TransformWrapper
30+
AffineBase
31+
Affine2DBase
32+
Affine2D
33+
IdentityTransform
34+
BlendedGenericTransform
35+
BlendedAffine2D
36+
CompositeGenericTransform
37+
CompositeAffine2D
38+
BboxTransform
39+
BboxTransformTo
40+
BboxTransformToMaxOnly
41+
BboxTransformFrom
42+
ScaledTranslation
43+
TransformedPath
44+
TransformedPatchPath
45+
46+
Functions
47+
---------
48+
49+
.. autosummary::
50+
:toctree: _as_gen/
51+
:template: autosummary.rst
52+
:nosignatures:
53+
54+
blended_transform_factory
55+
composite_transform_factory
56+
nonsingular
57+
interval_contains
58+
interval_contains_open
59+
offset_copy

lib/matplotlib/transforms.py

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,12 +1814,16 @@ def to_values(self):
18141814
@staticmethod
18151815
def matrix_from_values(a, b, c, d, e, f):
18161816
"""
1817-
(staticmethod) Create a new transformation matrix as a 3x3
1818-
numpy array of the form::
1817+
(staticmethod) Create a new transformation matrix.
18191818
1820-
a c e
1821-
b d f
1822-
0 0 1
1819+
Parameters
1820+
----------
1821+
a, b, c, d, e, f: floats
1822+
The parameters in the transformation matrix of the form::
1823+
1824+
a c e
1825+
b d f
1826+
0 0 1
18231827
"""
18241828
return np.array([[a, c, e], [b, d, f], [0.0, 0.0, 1.0]], float)
18251829

@@ -1869,13 +1873,18 @@ class Affine2D(Affine2DBase):
18691873

18701874
def __init__(self, matrix=None, **kwargs):
18711875
"""
1872-
Initialize an Affine transform from a 3x3 numpy float array::
1876+
Initialize an Affine transform from a 3x3 numpy float array.
1877+
1878+
Parameters
1879+
----------
1880+
matrix : 3 x 3 numpy float array, optional
1881+
The *matrix* should have the following form:
18731882
1874-
a c e
1875-
b d f
1876-
0 0 1
1883+
a c e
1884+
b d f
1885+
0 0 1
18771886
1878-
If *matrix* is None, initialize with the identity transform.
1887+
If *matrix* is None, initialize with the identity transform.
18791888
"""
18801889
Affine2DBase.__init__(self, **kwargs)
18811890
if matrix is None:
@@ -1893,40 +1902,47 @@ def __str__(self):
18931902
@staticmethod
18941903
def from_values(a, b, c, d, e, f):
18951904
"""
1896-
(staticmethod) Create a new Affine2D instance from the given
1897-
values::
1905+
(staticmethod) Create a new Affine2D instance.
18981906
1899-
a c e
1900-
b d f
1901-
0 0 1
1907+
Parameters
1908+
----------
1909+
a, b, c, d, e, f: floats
1910+
The parameters in the transformation matrix of the form::
19021911
1903-
.
1912+
a c e
1913+
b d f
1914+
0 0 1
19041915
"""
19051916
return Affine2D(
19061917
np.array([a, c, e, b, d, f, 0.0, 0.0, 1.0], float).reshape((3, 3)))
19071918

19081919
def get_matrix(self):
19091920
"""
1910-
Get the underlying transformation matrix as a 3x3 numpy array::
1911-
1912-
a c e
1913-
b d f
1914-
0 0 1
1921+
Get the underlying transformation matrix.
19151922
1916-
.
1923+
Returns
1924+
-------
1925+
matrix: a 3x3 numpy array
1926+
The form of the matrix::
1927+
a c e
1928+
b d f
1929+
0 0 1
19171930
"""
19181931
self._invalid = 0
19191932
return self._mtx
19201933

19211934
def set_matrix(self, mtx):
19221935
"""
1923-
Set the underlying transformation matrix from a 3x3 numpy array::
1936+
Set the underlying transformation matrix.
19241937
1925-
a c e
1926-
b d f
1927-
0 0 1
1938+
Parameters
1939+
----------
1940+
mtx: a 3x3 numpy array
1941+
The transformation matrix of the form::
19281942
1929-
.
1943+
a c e
1944+
b d f
1945+
0 0 1
19301946
"""
19311947
self._mtx = mtx
19321948
self.invalidate()

0 commit comments

Comments
 (0)