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
ylim properties of
Axes. Its corresponding transformation object is
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
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
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,
matplotlib.transforms.IdentityTransform() can be used when necessary.
More details are available here.