本文整理匯總了Python中matplotlib.patheffects.PathEffectRenderer.draw_tex方法的典型用法代碼示例。如果您正苦於以下問題:Python PathEffectRenderer.draw_tex方法的具體用法?Python PathEffectRenderer.draw_tex怎麽用?Python PathEffectRenderer.draw_tex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類matplotlib.patheffects.PathEffectRenderer
的用法示例。
在下文中一共展示了PathEffectRenderer.draw_tex方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: draw
# 需要導入模塊: from matplotlib.patheffects import PathEffectRenderer [as 別名]
# 或者: from matplotlib.patheffects.PathEffectRenderer import draw_tex [as 別名]
def draw(self, renderer):
"""
Draws the :class:`Text` object to the given *renderer*.
"""
if renderer is not None:
self._renderer = renderer
if not self.get_visible():
return
if self.text.strip() == '':
return
renderer.open_group('text', self.gid)
bbox, info, descent = self._get_layout(renderer)
trans = self.transform
# don't use self.get_position here, which refers to text position
# in Text, and dash position in TextWithDash:
posx = float(self.convert_xunits(self._x))
posy = float(self.convert_yunits(self._y))
posx, posy = trans.transform_point((posx, posy))
canvasw, canvash = renderer.get_canvas_width_height()
# draw the FancyBboxPatch
if self._bbox_patch:
self._draw_bbox(renderer, posx, posy)
if self.style == None:
self._defaultStyle()
if self.style.clip_path is None and self.style.clip_rectangle is None:
self._set_gc_clip(self.style)
if self._bbox:
bbox_artist(self, renderer, self._bbox)
angle = self.get_rotation()
for line, wh, x, y in info:
if not np.isfinite(x) or not np.isfinite(y):
continue
mtext = self if len(info) == 1 else None
x = x + posx
y = y + posy
if renderer.flipy():
y = canvash - y
clean_line, ismath = self.is_math_text(line)
if self.get_path_effects():
from matplotlib.patheffects import PathEffectRenderer
renderer = PathEffectRenderer(self.get_path_effects(),
renderer)
if rcParams['text.usetex']:
renderer.draw_tex(self.style, x, y, clean_line,
self.font, angle, mtext=mtext)
else:
renderer.draw_text(self.style, x, y, clean_line,
self.font, angle,
ismath=ismath, mtext=mtext)
self.style.restore()
renderer.close_group('text')