Python matplotlib.patches.FancyBboxPatch() Examples
The following are 30
code examples of matplotlib.patches.FancyBboxPatch().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.patches
, or try the search function
.
Example #1
Source File: fancybox_demo.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test3(ax): # mutation_scale determine overall scale of the mutation, # i.e. both pad and rounding_size is scaled according to this # value. p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), abs(bb.width), abs(bb.height), boxstyle="round,pad=0.1", mutation_scale=2., fc=(1., .8, 1.), ec=(1., 0.5, 1.)) ax.add_patch(p_fancy) ax.text(0.1, 0.8, ' boxstyle="round,pad=0.1"\n mutation_scale=2', size=10, transform=ax.transAxes) # draws control points for the fancy box. # l = p_fancy.get_path().vertices # ax.plot(l[:,0], l[:,1], ".") draw_bbox(ax, bb)
Example #2
Source File: fancybox_demo.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test1(ax): # a fancy box with round corners. pad=0.1 p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), abs(bb.width), abs(bb.height), boxstyle="round,pad=0.1", fc=(1., .8, 1.), ec=(1., 0.5, 1.)) ax.add_patch(p_fancy) ax.text(0.1, 0.8, r' boxstyle="round,pad=0.1"', size=10, transform=ax.transAxes) # draws control points for the fancy box. # l = p_fancy.get_path().vertices # ax.plot(l[:,0], l[:,1], ".") # draw the original bbox in black draw_bbox(ax, bb)
Example #3
Source File: text.py From neural-network-animation with MIT License | 5 votes |
def set_bbox(self, rectprops): """ Draw a bounding box around self. rectprops are any settable properties for a rectangle, e.g., facecolor='red', alpha=0.5. t.set_bbox(dict(facecolor='red', alpha=0.5)) If rectprops has "boxstyle" key. A FancyBboxPatch is initialized with rectprops and will be drawn. The mutation scale of the FancyBboxPath is set to the fontsize. ACCEPTS: rectangle prop dict """ # The self._bbox_patch object is created only if rectprops has # boxstyle key. Otherwise, self._bbox will be set to the # rectprops and the bbox will be drawn using bbox_artist # function. This is to keep the backward compatibility. if rectprops is not None and "boxstyle" in rectprops: props = rectprops.copy() boxstyle = props.pop("boxstyle") bbox_transmuter = props.pop("bbox_transmuter", None) self._bbox_patch = FancyBboxPatch( (0., 0.), 1., 1., boxstyle=boxstyle, bbox_transmuter=bbox_transmuter, transform=mtransforms.IdentityTransform(), **props) self._bbox = None else: self._bbox_patch = None self._bbox = rectprops self._update_clip_properties()
Example #4
Source File: offsetbox.py From twitter-stock-recommendation with MIT License | 5 votes |
def __init__(self, child, pad=None, draw_frame=False, patch_attrs=None): """ *pad* : boundary pad .. note:: *pad* need to given in points and will be scale with the renderer dpi, while *width* and *height* need to be in pixels. """ super(PaddedBox, self).__init__() self.pad = pad self._children = [child] self.patch = FancyBboxPatch( xy=(0.0, 0.0), width=1., height=1., facecolor='w', edgecolor='k', mutation_scale=1, # self.prop.get_size_in_points(), snap=True ) self.patch.set_boxstyle("square", pad=0) if patch_attrs is not None: self.patch.update(patch_attrs) self._drawFrame = draw_frame
Example #5
Source File: offsetbox.py From coffeegrindsize with MIT License | 5 votes |
def __init__(self, child, pad=None, draw_frame=False, patch_attrs=None): """ *pad* : boundary pad .. note:: *pad* need to given in points and will be scale with the renderer dpi, while *width* and *height* need to be in pixels. """ super().__init__() self.pad = pad self._children = [child] self.patch = FancyBboxPatch( xy=(0.0, 0.0), width=1., height=1., facecolor='w', edgecolor='k', mutation_scale=1, # self.prop.get_size_in_points(), snap=True ) self.patch.set_boxstyle("square", pad=0) if patch_attrs is not None: self.patch.update(patch_attrs) self._drawFrame = draw_frame
Example #6
Source File: text.py From ImageFusion with MIT License | 5 votes |
def get_bbox_patch(self): """ Return the bbox Patch object. Returns None if the the FancyBboxPatch is not made. """ return self._bbox_patch
Example #7
Source File: text.py From ImageFusion with MIT License | 5 votes |
def set_bbox(self, rectprops): """ Draw a bounding box around self. rectprops are any settable properties for a rectangle, e.g., facecolor='red', alpha=0.5. t.set_bbox(dict(facecolor='red', alpha=0.5)) If rectprops has "boxstyle" key. A FancyBboxPatch is initialized with rectprops and will be drawn. The mutation scale of the FancyBboxPath is set to the fontsize. ACCEPTS: rectangle prop dict """ # The self._bbox_patch object is created only if rectprops has # boxstyle key. Otherwise, self._bbox will be set to the # rectprops and the bbox will be drawn using bbox_artist # function. This is to keep the backward compatibility. if rectprops is not None and "boxstyle" in rectprops: props = rectprops.copy() boxstyle = props.pop("boxstyle") bbox_transmuter = props.pop("bbox_transmuter", None) self._bbox_patch = FancyBboxPatch( (0., 0.), 1., 1., boxstyle=boxstyle, bbox_transmuter=bbox_transmuter, transform=mtransforms.IdentityTransform(), **props) self._bbox = None else: self._bbox_patch = None self._bbox = rectprops self._update_clip_properties()
Example #8
Source File: offsetbox.py From ImageFusion with MIT License | 5 votes |
def __init__(self, child, pad=None, draw_frame=False, patch_attrs=None): """ *pad* : boundary pad .. note:: *pad* need to given in points and will be scale with the renderer dpi, while *width* and *height* need to be in pixels. """ super(PaddedBox, self).__init__() self.pad = pad self._children = [child] self.patch = FancyBboxPatch( xy=(0.0, 0.0), width=1., height=1., facecolor='w', edgecolor='k', mutation_scale=1, # self.prop.get_size_in_points(), snap=True ) self.patch.set_boxstyle("square", pad=0) if patch_attrs is not None: self.patch.update(patch_attrs) self._drawFrame = draw_frame
Example #9
Source File: fancybox_demo.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test4(ax): # When the aspect ratio of the axes is not 1, the fancy box may # not be what you expected (green) p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), abs(bb.width), abs(bb.height), boxstyle="round,pad=0.2", fc="none", ec=(0., .5, 0.), zorder=4) ax.add_patch(p_fancy) # You can compensate this by setting the mutation_aspect (pink). p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), abs(bb.width), abs(bb.height), boxstyle="round,pad=0.3", mutation_aspect=.5, fc=(1., 0.8, 1.), ec=(1., 0.5, 1.)) ax.add_patch(p_fancy) ax.text(0.1, 0.8, ' boxstyle="round,pad=0.3"\n mutation_aspect=.5', size=10, transform=ax.transAxes) draw_bbox(ax, bb)
Example #10
Source File: fancybox_demo.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test2(ax): # bbox=round has two optional argument. pad and rounding_size. # They can be set during the initialization. p_fancy = FancyBboxPatch((bb.xmin, bb.ymin), abs(bb.width), abs(bb.height), boxstyle="round,pad=0.1", fc=(1., .8, 1.), ec=(1., 0.5, 1.)) ax.add_patch(p_fancy) # boxstyle and its argument can be later modified with # set_boxstyle method. Note that the old attributes are simply # forgotten even if the boxstyle name is same. p_fancy.set_boxstyle("round,pad=0.1, rounding_size=0.2") # or # p_fancy.set_boxstyle("round", pad=0.1, rounding_size=0.2) ax.text(0.1, 0.8, ' boxstyle="round,pad=0.1\n rounding_size=0.2"', size=10, transform=ax.transAxes) # draws control points for the fancy box. # l = p_fancy.get_path().vertices # ax.plot(l[:,0], l[:,1], ".") draw_bbox(ax, bb)
Example #11
Source File: fancybox_demo.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def draw_bbox(ax, bb): # boxstyle=square with pad=0, i.e. bbox itself. p_bbox = FancyBboxPatch((bb.xmin, bb.ymin), abs(bb.width), abs(bb.height), boxstyle="square,pad=0.", ec="k", fc="none", zorder=10., ) ax.add_patch(p_bbox)
Example #12
Source File: offsetbox.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def __init__(self, child, pad=None, draw_frame=False, patch_attrs=None): """ *pad* : boundary pad .. note:: *pad* need to given in points and will be scale with the renderer dpi, while *width* and *height* need to be in pixels. """ super().__init__() self.pad = pad self._children = [child] self.patch = FancyBboxPatch( xy=(0.0, 0.0), width=1., height=1., facecolor='w', edgecolor='k', mutation_scale=1, # self.prop.get_size_in_points(), snap=True ) self.patch.set_boxstyle("square", pad=0) if patch_attrs is not None: self.patch.update(patch_attrs) self._drawFrame = draw_frame
Example #13
Source File: text.py From neural-network-animation with MIT License | 5 votes |
def get_bbox_patch(self): """ Return the bbox Patch object. Returns None if the the FancyBboxPatch is not made. """ return self._bbox_patch
Example #14
Source File: offsetbox.py From Computable with MIT License | 5 votes |
def __init__(self, child, pad=None, draw_frame=False, patch_attrs=None): """ *pad* : boundary pad .. note:: *pad* need to given in points and will be scale with the renderer dpi, while *width* and *height* need to be in pixels. """ super(PaddedBox, self).__init__() self.pad = pad self._children = [child] self.patch = FancyBboxPatch( xy=(0.0, 0.0), width=1., height=1., facecolor='w', edgecolor='k', mutation_scale=1, # self.prop.get_size_in_points(), snap=True ) self.patch.set_boxstyle("square", pad=0) if patch_attrs is not None: self.patch.update(patch_attrs) self._drawFrame = draw_frame
Example #15
Source File: offsetbox.py From neural-network-animation with MIT License | 5 votes |
def __init__(self, child, pad=None, draw_frame=False, patch_attrs=None): """ *pad* : boundary pad .. note:: *pad* need to given in points and will be scale with the renderer dpi, while *width* and *height* need to be in pixels. """ super(PaddedBox, self).__init__() self.pad = pad self._children = [child] self.patch = FancyBboxPatch( xy=(0.0, 0.0), width=1., height=1., facecolor='w', edgecolor='k', mutation_scale=1, # self.prop.get_size_in_points(), snap=True ) self.patch.set_boxstyle("square", pad=0) if patch_attrs is not None: self.patch.update(patch_attrs) self._drawFrame = draw_frame
Example #16
Source File: text.py From matplotlib-4-abaqus with MIT License | 5 votes |
def get_bbox_patch(self): """ Return the bbox Patch object. Returns None if the the FancyBboxPatch is not made. """ return self._bbox_patch
Example #17
Source File: text.py From matplotlib-4-abaqus with MIT License | 5 votes |
def set_bbox(self, rectprops): """ Draw a bounding box around self. rectprops are any settable properties for a rectangle, eg facecolor='red', alpha=0.5. t.set_bbox(dict(facecolor='red', alpha=0.5)) If rectprops has "boxstyle" key. A FancyBboxPatch is initialized with rectprops and will be drawn. The mutation scale of the FancyBboxPath is set to the fontsize. ACCEPTS: rectangle prop dict """ # The self._bbox_patch object is created only if rectprops has # boxstyle key. Otherwise, self._bbox will be set to the # rectprops and the bbox will be drawn using bbox_artist # function. This is to keep the backward compatibility. if rectprops is not None and "boxstyle" in rectprops: props = rectprops.copy() boxstyle = props.pop("boxstyle") bbox_transmuter = props.pop("bbox_transmuter", None) self._bbox_patch = FancyBboxPatch( (0., 0.), 1., 1., boxstyle=boxstyle, bbox_transmuter=bbox_transmuter, transform=mtransforms.IdentityTransform(), **props) self._bbox = None else: self._bbox_patch = None self._bbox = rectprops
Example #18
Source File: offsetbox.py From matplotlib-4-abaqus with MIT License | 5 votes |
def __init__(self, child, pad=None, draw_frame=False, patch_attrs=None): """ *pad* : boundary pad .. note:: *pad* need to given in points and will be scale with the renderer dpi, while *width* and *height* need to be in pixels. """ super(PaddedBox, self).__init__() self.pad = pad self._children = [child] self.patch = FancyBboxPatch( xy=(0.0, 0.0), width=1., height=1., facecolor='w', edgecolor='k', mutation_scale=1, # self.prop.get_size_in_points(), snap=True ) self.patch.set_boxstyle("square", pad=0) if patch_attrs is not None: self.patch.update(patch_attrs) self._drawFrame = draw_frame
Example #19
Source File: map_viz.py From ms_deisotope with Apache License 2.0 | 5 votes |
def draw_features(features, ax=None, alpha=0.65, width=2e-5, **kwargs): if ax is None: fig, ax = plt.subplots(1) ellipses = [] kwargs.setdefault("lw", 0.05) lw = kwargs.get("linewidth", kwargs.get("lw")) for feat in features: if feat is None: continue center = (feat.end_time + feat.start_time) / 2. height = feat.end_time - feat.start_time center_mz = feat.mz mz_width = center_mz * width ellipses.append( FancyBboxPatch((feat.mz - mz_width / 4., center - height / 2.), width=mz_width / 2., height=height, boxstyle=mpatches.BoxStyle.Round(pad=mz_width / 2.))) for ell in ellipses: ell.set_alpha(alpha) ell.set_facecolor("blue") ell.set_edgecolor("blue") ell.set_linewidth(lw) ax.add_artist(ell) ax.set_xlim( min(features, key=lambda x: x.mz if x is not None else float('inf')).mz - 1, max(features, key=lambda x: x.mz if x is not None else -float('inf')).mz + 1) ax.set_ylim( min(features, key=lambda x: x.start_time if x is not None else float('inf')).start_time - 1, max(features, key=lambda x: x.end_time if x is not None else -float('inf')).end_time + 1) return ax
Example #20
Source File: shapes.py From viznet with MIT License | 5 votes |
def rectangle(xy, size, angle, roundness, **kwargs): '''width is relative width with respect to height.''' if np.ndim(size) == 0: size = (size, size) width, height = 2*size[0], 2*size[1] xy_ = xy[0] - width / 2., xy[1] - height / 2. if roundness!=0: pad = roundness c = patches.FancyBboxPatch(xy_+np.array([pad,pad]), width-pad*2, height-pad*2, boxstyle=patches.BoxStyle("Round", pad=pad), **_fix(kwargs)) else: c = patches.Rectangle(xy_, width, height, **_fix(kwargs)) return [c] ########################## Derived types #############################
Example #21
Source File: edgenode.py From viznet with MIT License | 5 votes |
def width(self): shape = self.brush.style[1] if isinstance(self.obj, plt.Circle): return self.obj.radius * 2 elif isinstance(self.obj, plt.Rectangle): return self.obj.get_width() elif isinstance(self.obj, patches.FancyBboxPatch): return self.obj.get_width() + 2*self.obj.get_boxstyle().pad elif isinstance(self.obj, (plt.Polygon, patches.PathPatch)): x = self.path[:,0] return x.max() - x.min() else: raise
Example #22
Source File: edgenode.py From viznet with MIT License | 5 votes |
def height(self): shape = self.brush.style[1] if isinstance(self.obj, plt.Circle): return self.obj.radius * 2 elif isinstance(self.obj, plt.Rectangle): return self.obj.get_height() elif isinstance(self.obj, patches.FancyBboxPatch): return self.obj.get_height() + 2*self.obj.get_boxstyle().pad elif isinstance(self.obj, (plt.Polygon, patches.PathPatch)): y = self.path[:,1] return y.max() - y.min() else: raise
Example #23
Source File: text.py From Computable with MIT License | 5 votes |
def get_bbox_patch(self): """ Return the bbox Patch object. Returns None if the the FancyBboxPatch is not made. """ return self._bbox_patch
Example #24
Source File: text.py From Computable with MIT License | 5 votes |
def set_bbox(self, rectprops): """ Draw a bounding box around self. rectprops are any settable properties for a rectangle, eg facecolor='red', alpha=0.5. t.set_bbox(dict(facecolor='red', alpha=0.5)) If rectprops has "boxstyle" key. A FancyBboxPatch is initialized with rectprops and will be drawn. The mutation scale of the FancyBboxPath is set to the fontsize. ACCEPTS: rectangle prop dict """ # The self._bbox_patch object is created only if rectprops has # boxstyle key. Otherwise, self._bbox will be set to the # rectprops and the bbox will be drawn using bbox_artist # function. This is to keep the backward compatibility. if rectprops is not None and "boxstyle" in rectprops: props = rectprops.copy() boxstyle = props.pop("boxstyle") bbox_transmuter = props.pop("bbox_transmuter", None) self._bbox_patch = FancyBboxPatch( (0., 0.), 1., 1., boxstyle=boxstyle, bbox_transmuter=bbox_transmuter, transform=mtransforms.IdentityTransform(), **props) self._bbox = None else: self._bbox_patch = None self._bbox = rectprops
Example #25
Source File: text.py From neural-network-animation with MIT License | 4 votes |
def __init__(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, **kwargs ): """ Create a :class:`~matplotlib.text.Text` instance at *x*, *y* with string *text*. Valid kwargs are %(Text)s """ Artist.__init__(self) self._x, self._y = x, y if color is None: color = rcParams['text.color'] if fontproperties is None: fontproperties = FontProperties() elif is_string_like(fontproperties): fontproperties = FontProperties(fontproperties) self.set_text(text) self.set_color(color) self._verticalalignment = verticalalignment self._horizontalalignment = horizontalalignment self._multialignment = multialignment self._rotation = rotation self._fontproperties = fontproperties self._bbox = None self._bbox_patch = None # a FancyBboxPatch instance self._renderer = None if linespacing is None: linespacing = 1.2 # Maybe use rcParam later. self._linespacing = linespacing self.set_rotation_mode(rotation_mode) self.update(kwargs) #self.set_bbox(dict(pad=0))
Example #26
Source File: text.py From matplotlib-4-abaqus with MIT License | 4 votes |
def __init__(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, **kwargs ): """ Create a :class:`~matplotlib.text.Text` instance at *x*, *y* with string *text*. Valid kwargs are %(Text)s """ Artist.__init__(self) self._x, self._y = x, y if color is None: color = rcParams['text.color'] if fontproperties is None: fontproperties = FontProperties() elif is_string_like(fontproperties): fontproperties = FontProperties(fontproperties) self.set_text(text) self.set_color(color) self._verticalalignment = verticalalignment self._horizontalalignment = horizontalalignment self._multialignment = multialignment self._rotation = rotation self._fontproperties = fontproperties self._bbox = None self._bbox_patch = None # a FancyBboxPatch instance self._renderer = None if linespacing is None: linespacing = 1.2 # Maybe use rcParam later. self._linespacing = linespacing self.set_rotation_mode(rotation_mode) self.update(kwargs) #self.set_bbox(dict(pad=0))
Example #27
Source File: map_viz.py From ms_deisotope with Apache License 2.0 | 4 votes |
def draw_feature_sets(feature_sets, ax=None, alpha=0.65, width=2e-5, **kwargs): if ax is None: fig, ax = plt.subplots(1) kwargs.setdefault("lw", 0.05) lw = kwargs.get("linewidth", kwargs.get("lw")) features = [] ellipse_sets = [] for feature_set in feature_sets: ellipses = [] for feat in feature_set: if feat is None: continue center = (feat.end_time + feat.start_time) / 2. height = feat.end_time - feat.start_time center_mz = feat.mz mz_width = center_mz * width ellipses.append( FancyBboxPatch((feat.mz - mz_width / 4., center - height / 2.), width=mz_width / 2., height=height, boxstyle=mpatches.BoxStyle.Round(pad=mz_width / 2.))) features.append(feat) ellipse_sets.append(ellipses) for ellipses in ellipse_sets: color = np.random.rand(3) for ell in ellipses: ell.set_alpha(alpha) ell.set_facecolor(color) ell.set_edgecolor(color) ell.set_linewidth(lw) ax.add_artist(ell) ax.set_xlim( min(features, key=lambda x: x.mz if x is not None else float('inf')).mz - 1, max(features, key=lambda x: x.mz if x is not None else -float('inf')).mz + 1) ax.set_ylim( min(features, key=lambda x: x.start_time if x is not None else float('inf')).start_time - 1, max(features, key=lambda x: x.end_time if x is not None else -float('inf')).end_time + 1) return ax
Example #28
Source File: facet.py From plotnine with GNU General Public License v2.0 | 4 votes |
def draw_strip_text(self, text_lines, location, ax): """ Create a background patch and put a label on it """ themeable = self.figure._themeable dim = self.strip_dimensions(text_lines, location, ax) if location == 'right': rotation = -90 label = '\n'.join(reversed(text_lines)) else: rotation = 0 label = '\n'.join(text_lines) rect = mpatch.FancyBboxPatch((dim.box_x, dim.box_y), width=dim.box_width, height=dim.box_height, facecolor='lightgrey', edgecolor='None', transform=ax.transAxes, zorder=2.2, # > ax line & boundary boxstyle='square, pad=0', clip_on=False) text = mtext.Text(dim.x, dim.y, label, rotation=rotation, verticalalignment='center', horizontalalignment='center', transform=ax.transAxes, zorder=3.3, # > rect clip_on=False) ax.add_artist(rect) ax.add_artist(text) for key in ('strip_text_x', 'strip_text_y', 'strip_background_x', 'strip_background_y'): if key not in themeable: themeable[key] = [] if location == 'right': themeable['strip_background_y'].append(rect) themeable['strip_text_y'].append(text) else: themeable['strip_background_x'].append(rect) themeable['strip_text_x'].append(text)
Example #29
Source File: text.py From ImageFusion with MIT License | 4 votes |
def __init__(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, **kwargs ): """ Create a :class:`~matplotlib.text.Text` instance at *x*, *y* with string *text*. Valid kwargs are %(Text)s """ Artist.__init__(self) self._x, self._y = x, y if color is None: color = rcParams['text.color'] if fontproperties is None: fontproperties = FontProperties() elif is_string_like(fontproperties): fontproperties = FontProperties(fontproperties) self.set_text(text) self.set_color(color) self._verticalalignment = verticalalignment self._horizontalalignment = horizontalalignment self._multialignment = multialignment self._rotation = rotation self._fontproperties = fontproperties self._bbox = None self._bbox_patch = None # a FancyBboxPatch instance self._renderer = None if linespacing is None: linespacing = 1.2 # Maybe use rcParam later. self._linespacing = linespacing self.set_rotation_mode(rotation_mode) self.update(kwargs) #self.set_bbox(dict(pad=0))
Example #30
Source File: text.py From Computable with MIT License | 4 votes |
def __init__(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, **kwargs ): """ Create a :class:`~matplotlib.text.Text` instance at *x*, *y* with string *text*. Valid kwargs are %(Text)s """ Artist.__init__(self) self._x, self._y = x, y if color is None: color = rcParams['text.color'] if fontproperties is None: fontproperties = FontProperties() elif is_string_like(fontproperties): fontproperties = FontProperties(fontproperties) self.set_text(text) self.set_color(color) self._verticalalignment = verticalalignment self._horizontalalignment = horizontalalignment self._multialignment = multialignment self._rotation = rotation self._fontproperties = fontproperties self._bbox = None self._bbox_patch = None # a FancyBboxPatch instance self._renderer = None if linespacing is None: linespacing = 1.2 # Maybe use rcParam later. self._linespacing = linespacing self.set_rotation_mode(rotation_mode) self.update(kwargs) #self.set_bbox(dict(pad=0))