Create a `.Text` instance at *x*, *y* with string *text*. The text is aligned relative to the anchor point (*x*, *y*) according to ``horizontalalignment`` (default: 'left') and ``verticalalignment`` (default: 'baseline'). See also :doc:`/gallery/text_labels_
(self,
x=0, y=0, text='', *,
color=None, # defaults to rc params
verticalalignment='baseline',
horizontalalignment='left',
multialignment=None,
fontproperties=None, # defaults to FontProperties()
rotation=None,
linespacing=None,
rotation_mode=None,
usetex=None, # defaults to rcParams['text.usetex']
wrap=False,
transform_rotates_text=False,
parse_math=None, # defaults to rcParams['text.parse_math']
antialiased=None, # defaults to rcParams['text.antialiased']
**kwargs
)
| 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, |
| 207 | linespacing=linespacing, |
| 208 | rotation_mode=rotation_mode, |
| 209 | antialiased=antialiased |
| 210 | ) |
| 211 | self.update(kwargs) |
| 212 | |
| 213 | def _reset_visual_defaults( |
| 214 | self, |
no test coverage detected