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

Class Text

lib/matplotlib/text.py:149–1602  ·  view source on GitHub ↗

Handle storing and drawing of text in window or data coordinates.

Source from the content-addressed store, hash-verified

147 "multialignment": ["ma"],
148})
149class Text(Artist):
150 """Handle storing and drawing of text in window or data coordinates."""
151
152 zorder = 3
153 _charsize_cache = dict()
154
155 def __repr__(self):
156 return f"Text({self._x}, {self._y}, {self._text!r})"
157
158 def __init__(self,
159 x=0, y=0, text='', *,
160 color=None, # defaults to rc params
161 verticalalignment='baseline',
162 horizontalalignment='left',
163 multialignment=None,
164 fontproperties=None, # defaults to FontProperties()
165 rotation=None,
166 linespacing=None,
167 rotation_mode=None,
168 usetex=None, # defaults to rcParams['text.usetex']
169 wrap=False,
170 transform_rotates_text=False,
171 parse_math=None, # defaults to rcParams['text.parse_math']
172 antialiased=None, # defaults to rcParams['text.antialiased']
173 **kwargs
174 ):
175 """
176 Create a `.Text` instance at *x*, *y* with string *text*.
177
178 The text is aligned relative to the anchor point (*x*, *y*) according
179 to ``horizontalalignment`` (default: 'left') and ``verticalalignment``
180 (default: 'baseline'). See also
181 :doc:`/gallery/text_labels_and_annotations/text_alignment`.
182
183 While Text accepts the 'label' keyword argument, by default it is not
184 added to the handles of a legend.
185
186 Valid keyword arguments are:
187
188 %(Text:kwdoc)s
189 """
190 super().__init__()
191 self._x, self._y = x, y
192 self._text = ''
193 self._features = None
194 self.set_language(None)
195 self._reset_visual_defaults(
196 text=text,
197 color=color,
198 fontproperties=fontproperties,
199 usetex=usetex,
200 parse_math=parse_math,
201 wrap=wrap,
202 verticalalignment=verticalalignment,
203 horizontalalignment=horizontalalignment,
204 multialignment=multialignment,
205 rotation=rotation,
206 transform_rotates_text=transform_rotates_text,

Callers 15

test_text_3dFunction · 0.90
__init__Method · 0.90
textMethod · 0.90
_get_nth_label_widthMethod · 0.90
add_labelMethod · 0.90
test_get_rotation_stringFunction · 0.90
test_get_rotation_floatFunction · 0.90
test_get_rotation_intFunction · 0.90
test_get_rotation_raisesFunction · 0.90
test_get_rotation_noneFunction · 0.90
test_get_rotation_mod360Function · 0.90
test_update_mutate_inputFunction · 0.90

Calls

no outgoing calls

Tested by 14

test_text_3dFunction · 0.72
test_get_rotation_stringFunction · 0.72
test_get_rotation_floatFunction · 0.72
test_get_rotation_intFunction · 0.72
test_get_rotation_raisesFunction · 0.72
test_get_rotation_noneFunction · 0.72
test_get_rotation_mod360Function · 0.72
test_update_mutate_inputFunction · 0.72
test_get_set_antialiasedFunction · 0.72
test_ha_for_angleFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…