Skip to content

Commit 6028039

Browse files
authored
Merge pull request #25906 from anntzer/tt
Tweak transforms tutorial.
2 parents 7d2acfd + 519ace8 commit 6028039

File tree

1 file changed

+54
-57
lines changed

1 file changed

+54
-57
lines changed

galleries/users_explain/artists/transforms_tutorial.py

Lines changed: 54 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -23,55 +23,51 @@
2323
:class:`~matplotlib.figure.SubFigure` instance.
2424
2525
26-
+----------------+-----------------------------------+---------------------------------------------------+
27-
|Coordinate |Description |Transformation object |
28-
|system | |from system to display |
29-
+================+===================================+===================================================+
30-
|"data" |The coordinate system of the data |``ax.transData`` |
31-
| |in the Axes. | |
32-
+----------------+-----------------------------------+---------------------------------------------------+
33-
|"axes" |The coordinate system of the |``ax.transAxes`` |
34-
| |`~matplotlib.axes.Axes`; (0, 0) | |
35-
| |is bottom left of the axes, and | |
36-
| |(1, 1) is top right of the axes. | |
37-
+----------------+-----------------------------------+---------------------------------------------------+
38-
|"subfigure" |The coordinate system of the |``subfigure.transSubfigure`` |
39-
| |`.SubFigure`; (0, 0) is bottom left| |
40-
| |of the subfigure, and (1, 1) is top| |
41-
| |right of the subfigure. If a | |
42-
| |figure has no subfigures, this is | |
43-
| |the same as ``transFigure``. | |
44-
+----------------+-----------------------------------+---------------------------------------------------+
45-
|"figure" |The coordinate system of the |``fig.transFigure`` |
46-
| |`.Figure`; (0, 0) is bottom left | |
47-
| |of the figure, and (1, 1) is top | |
48-
| |right of the figure. | |
49-
+----------------+-----------------------------------+---------------------------------------------------+
50-
|"figure-inches" |The coordinate system of the |``fig.dpi_scale_trans`` |
51-
| |`.Figure` in inches; (0, 0) is | |
52-
| |bottom left of the figure, and | |
53-
| |(width, height) is the top right | |
54-
| |of the figure in inches. | |
55-
+----------------+-----------------------------------+---------------------------------------------------+
56-
|"xaxis", |Blended coordinate systems, using |``ax.get_xaxis_transform()``, |
57-
|"yaxis" |data coordinates on one direction |``ax.get_yaxis_transform()`` |
58-
| |and axes coordinates on the other. | |
59-
+----------------+-----------------------------------+---------------------------------------------------+
60-
|"display" |The native coordinate system of the|`None`, or |
61-
| |output ; (0, 0) is the bottom left |:class:`~matplotlib.transforms.IdentityTransform()`|
62-
| |of the window, and (width, height) | |
63-
| |is top right of the output in | |
64-
| |"display units". | |
65-
| | | |
66-
| |The exact interpretation of the | |
67-
| |units depends on the back end. For | |
68-
| |example it is pixels for Agg and | |
69-
| |points for svg/pdf. | |
70-
+----------------+-----------------------------------+---------------------------------------------------+
71-
72-
73-
74-
26+
+----------------+-----------------------------------+-----------------------------+
27+
|Coordinate |Description |Transformation object |
28+
|system | |from system to display |
29+
+================+===================================+=============================+
30+
|"data" |The coordinate system of the data |``ax.transData`` |
31+
| |in the Axes. | |
32+
+----------------+-----------------------------------+-----------------------------+
33+
|"axes" |The coordinate system of the |``ax.transAxes`` |
34+
| |`~matplotlib.axes.Axes`; (0, 0) | |
35+
| |is bottom left of the axes, and | |
36+
| |(1, 1) is top right of the axes. | |
37+
+----------------+-----------------------------------+-----------------------------+
38+
|"subfigure" |The coordinate system of the |``subfigure.transSubfigure`` |
39+
| |`.SubFigure`; (0, 0) is bottom left| |
40+
| |of the subfigure, and (1, 1) is top| |
41+
| |right of the subfigure. If a | |
42+
| |figure has no subfigures, this is | |
43+
| |the same as ``transFigure``. | |
44+
+----------------+-----------------------------------+-----------------------------+
45+
|"figure" |The coordinate system of the |``fig.transFigure`` |
46+
| |`.Figure`; (0, 0) is bottom left | |
47+
| |of the figure, and (1, 1) is top | |
48+
| |right of the figure. | |
49+
+----------------+-----------------------------------+-----------------------------+
50+
|"figure-inches" |The coordinate system of the |``fig.dpi_scale_trans`` |
51+
| |`.Figure` in inches; (0, 0) is | |
52+
| |bottom left of the figure, and | |
53+
| |(width, height) is the top right | |
54+
| |of the figure in inches. | |
55+
+----------------+-----------------------------------+-----------------------------+
56+
|"xaxis", |Blended coordinate systems, using |``ax.get_xaxis_transform()``,|
57+
|"yaxis" |data coordinates on one direction |``ax.get_yaxis_transform()`` |
58+
| |and axes coordinates on the other. | |
59+
+----------------+-----------------------------------+-----------------------------+
60+
|"display" |The native coordinate system of the|`None`, or |
61+
| |output ; (0, 0) is the bottom left |`.IdentityTransform()` |
62+
| |of the window, and (width, height) | |
63+
| |is top right of the output in | |
64+
| |"display units". | |
65+
| | | |
66+
| |The exact interpretation of the | |
67+
| |units depends on the back end. For | |
68+
| |example it is pixels for Agg and | |
69+
| |points for svg/pdf. | |
70+
+----------------+-----------------------------------+-----------------------------+
7571
7672
The `~matplotlib.transforms.Transform` objects are naive to the source and
7773
destination coordinate systems, however the objects referred to in the table
@@ -247,14 +243,15 @@
247243
#
248244
# After the *data* coordinate system, *axes* is probably the second most
249245
# useful coordinate system. Here the point (0, 0) is the bottom left of
250-
# your axes or subplot, (0.5, 0.5) is the center, and (1.0, 1.0) is the
251-
# top right. You can also refer to points outside the range, so (-0.1,
252-
# 1.1) is to the left and above your axes. This coordinate system is
253-
# extremely useful when placing text in your axes, because you often
254-
# want a text bubble in a fixed, location, e.g., the upper left of the axes
255-
# pane, and have that location remain fixed when you pan or zoom. Here
256-
# is a simple example that creates four panels and labels them 'A', 'B',
257-
# 'C', 'D' as you often see in journals.
246+
# your axes or subplot, (0.5, 0.5) is the center, and (1.0, 1.0) is the top
247+
# right. You can also refer to points outside the range, so (-0.1, 1.1)
248+
# is to the left and above your axes. This coordinate system is extremely
249+
# useful when placing text in your axes, because you often want a text bubble
250+
# in a fixed, location, e.g., the upper left of the axes pane, and have that
251+
# location remain fixed when you pan or zoom. Here is a simple example that
252+
# creates four panels and labels them 'A', 'B', 'C', 'D' as you often see in
253+
# journals. A more sophisticated approach for such labeling is presented at
254+
# :doc:`/gallery/text_labels_and_annotations/label_subplots`.
258255

259256
fig = plt.figure()
260257
for i, label in enumerate(('A', 'B', 'C', 'D')):

0 commit comments

Comments
 (0)