本文整理汇总了Python中matplotlib.cbook.strip_math方法的典型用法代码示例。如果您正苦于以下问题:Python cbook.strip_math方法的具体用法?Python cbook.strip_math怎么用?Python cbook.strip_math使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.cbook
的用法示例。
在下文中一共展示了cbook.strip_math方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_text_width_height_descent
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import strip_math [as 别名]
def get_text_width_height_descent(self, s, prop, ismath):
# docstring inherited
if ismath:
s = cbook.strip_math(s)
if self.gc is None:
gc = self.new_gc()
else:
gc = self.gc
gfx_ctx = gc.gfx_ctx
font = self.get_wx_font(s, prop)
gfx_ctx.SetFont(font, wx.BLACK)
w, h, descent, leading = gfx_ctx.GetFullTextExtent(s)
return w, h, descent
示例2: _strip_math
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import strip_math [as 别名]
def _strip_math(s):
return cbook.strip_math(s) if len(s) >= 2 and s[0] == s[-1] == "$" else s
示例3: strip_math
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import strip_math [as 别名]
def strip_math(self, s):
return cbook.strip_math(s)
示例4: format_data
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import strip_math [as 别名]
def format_data(self, value):
b = self.labelOnlyBase
self.labelOnlyBase = False
value = cbook.strip_math(self.__call__(value))
self.labelOnlyBase = b
return value
示例5: format_cursor_data
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import strip_math [as 别名]
def format_cursor_data(self, data):
if np.ndim(data) == 0 and self.colorbar:
return (
"["
+ cbook.strip_math(
self.colorbar.formatter.format_data_short(data)).strip()
+ "]")
else:
return super().format_cursor_data(data)
示例6: draw_text
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import strip_math [as 别名]
def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
# docstring inherited
if ismath:
s = cbook.strip_math(s)
DEBUG_MSG("draw_text()", 1, self)
gc.select()
self.handle_clip_rectangle(gc)
gfx_ctx = gc.gfx_ctx
font = self.get_wx_font(s, prop)
color = gc.get_wxcolour(gc.get_rgb())
gfx_ctx.SetFont(font, color)
w, h, d = self.get_text_width_height_descent(s, prop, ismath)
x = int(x)
y = int(y - h)
if angle == 0.0:
gfx_ctx.DrawText(s, x, y)
else:
rads = math.radians(angle)
xo = h * math.sin(rads)
yo = h * math.cos(rads)
gfx_ctx.DrawRotatedText(s, x - xo, y - yo, rads)
gc.unselect()