MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / Axes

Class Axes

lib/matplotlib/axes/_axes.py:88–9316  ·  view source on GitHub ↗

An Axes object encapsulates all the elements of an individual (sub-)plot in a figure. It contains most of the (sub-)plot elements: `~.axis.Axis`, `~.axis.Tick`, `~.lines.Line2D`, `~.text.Text`, `~.patches.Polygon`, etc., and sets the coordinate system. Like all visible ele

Source from the content-addressed store, hash-verified

86
87@_docstring.interpd
88class Axes(_AxesBase):
89 """
90 An Axes object encapsulates all the elements of an individual (sub-)plot in
91 a figure.
92
93 It contains most of the (sub-)plot elements: `~.axis.Axis`,
94 `~.axis.Tick`, `~.lines.Line2D`, `~.text.Text`, `~.patches.Polygon`, etc.,
95 and sets the coordinate system.
96
97 Like all visible elements in a figure, Axes is an `.Artist` subclass.
98
99 The `Axes` instance supports callbacks through a callbacks attribute which
100 is a `~.cbook.CallbackRegistry` instance. The events you can connect to
101 are 'xlim_changed' and 'ylim_changed' and the callback will be called with
102 func(*ax*) where *ax* is the `Axes` instance.
103
104 .. note::
105
106 As a user, you do not instantiate Axes directly, but use Axes creation
107 methods instead; e.g. from `.pyplot` or `.Figure`:
108 `~.pyplot.subplots`, `~.pyplot.subplot_mosaic` or `.Figure.add_axes`.
109
110 """
111 ### Labelling, legend and texts
112
113 def get_title(self, loc="center"):
114 """
115 Get an Axes title.
116
117 Get one of the three available Axes titles. The available titles
118 are positioned above the Axes in the center, flush with the left
119 edge, and flush with the right edge.
120
121 Parameters
122 ----------
123 loc : {'center', 'left', 'right'}, str, default: 'center'
124 Which title to return.
125
126 Returns
127 -------
128 str
129 The title text string.
130
131 """
132 titles = {'left': self._left_title,
133 'center': self.title,
134 'right': self._right_title}
135 title = _api.getitem_checked(titles, loc=loc.lower())
136 return title.get_text()
137
138 def set_title(self, label, fontdict=None, loc=None, pad=None, *, y=None,
139 **kwargs):
140 """
141 Set a title for the Axes.
142
143 Set one of the three available Axes titles. The available titles
144 are positioned above the Axes in the center, flush with the left
145 edge, and flush with the right edge.

Callers 1

test_old_subplot_compatFunction · 0.90

Calls 2

_preprocess_dataFunction · 0.90
_make_axes_methodFunction · 0.85

Tested by 1

test_old_subplot_compatFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…