Create a `.Text` instance at *x*, *y* with string *text*. Valid kwargs are %(Text)s
(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,
**kwargs
)
| 129 | return "Text(%s, %s, %s)" % (self._x, self._y, repr(self._text)) |
| 130 | |
| 131 | def __init__(self, |
| 132 | x=0, y=0, text='', |
| 133 | color=None, # defaults to rc params |
| 134 | verticalalignment='baseline', |
| 135 | horizontalalignment='left', |
| 136 | multialignment=None, |
| 137 | fontproperties=None, # defaults to FontProperties() |
| 138 | rotation=None, |
| 139 | linespacing=None, |
| 140 | rotation_mode=None, |
| 141 | usetex=None, # defaults to rcParams['text.usetex'] |
| 142 | wrap=False, |
| 143 | **kwargs |
| 144 | ): |
| 145 | """ |
| 146 | Create a `.Text` instance at *x*, *y* with string *text*. |
| 147 | |
| 148 | Valid kwargs are |
| 149 | %(Text)s |
| 150 | """ |
| 151 | |
| 152 | Artist.__init__(self) |
| 153 | self._x, self._y = x, y |
| 154 | |
| 155 | if color is None: |
| 156 | color = rcParams['text.color'] |
| 157 | if fontproperties is None: |
| 158 | fontproperties = FontProperties() |
| 159 | elif isinstance(fontproperties, str): |
| 160 | fontproperties = FontProperties(fontproperties) |
| 161 | |
| 162 | self._text = '' |
| 163 | self.set_text(text) |
| 164 | self.set_color(color) |
| 165 | self.set_usetex(usetex) |
| 166 | self.set_wrap(wrap) |
| 167 | self.set_verticalalignment(verticalalignment) |
| 168 | self.set_horizontalalignment(horizontalalignment) |
| 169 | self._multialignment = multialignment |
| 170 | self._rotation = rotation |
| 171 | self._fontproperties = fontproperties |
| 172 | self._bbox_patch = None # a FancyBboxPatch instance |
| 173 | self._renderer = None |
| 174 | if linespacing is None: |
| 175 | linespacing = 1.2 # Maybe use rcParam later. |
| 176 | self._linespacing = linespacing |
| 177 | self.set_rotation_mode(rotation_mode) |
| 178 | self.update(kwargs) |
| 179 | |
| 180 | def update(self, kwargs): |
| 181 | """ |
no test coverage detected