Matplotlib has four distinct coordinate systems which can be leveraged to ease the positioning of different object, e.g., text. Each system has a corresponding transformation object which transform coordinates from that system to the so called display coordinate system.

**Data coordinate system** is the system defined by the data on the respective axes. It is useful when trying to position some object relative to the data plotted. The range is given by the `xlim`

and `ylim`

properties of `Axes`

. Its corresponding transformation object is `ax.transData`

.

**Axes coordinate system** is the system tied to its `Axes`

object. Points (0, 0) and (1, 1) define the bottom-left and top-right corners of the axes. As such it is useful when positioning relative to the axes, like top-center of the plot. Its corresponding transformation object is `ax.transAxes`

.

**Figure coordinate system** is analogous to the axes coordinate system, except that it is tied to the `Figure`

. Points (0, 0) and (1, 1) represent the bottom-left and top-right corners of the figure. It is useful when trying to position something relative to the whole image. Its corresponding transformation object is `fig.transFigure`

.

**Display coordinate system** is the system of the image given in pixels. Points (0, 0) and (width, height) are the bottom-left and top-right pixels of image or display. It can be used for positioning absolutely. Since transformation objects transform coordinates into this coordinate system, display system has no transformation object associated with it. However, `None`

or `matplotlib.transforms.IdentityTransform()`

can be used when necessary.

More details are available here.

This modified text is an extract of the original Stack Overflow Documentation created by following contributors and released under CC BY-SA 3.0

This website is not affiliated with Stack Overflow