本文整理汇总了Python中matplotlib.texmanager.TexManager方法的典型用法代码示例。如果您正苦于以下问题:Python texmanager.TexManager方法的具体用法?Python texmanager.TexManager怎么用?Python texmanager.TexManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.texmanager
的用法示例。
在下文中一共展示了texmanager.TexManager方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_label_width
# 需要导入模块: from matplotlib import texmanager [as 别名]
# 或者: from matplotlib.texmanager import TexManager [as 别名]
def get_label_width(self, lev, fmt, fsize):
"""
Return the width of the label in points.
"""
if not cbook.is_string_like(lev):
lev = self.get_text(lev, fmt)
lev, ismath = text.Text.is_math_text(lev)
if ismath == 'TeX':
if not hasattr(self, '_TeX_manager'):
self._TeX_manager = texmanager.TexManager()
lw, _, _ = self._TeX_manager.get_text_width_height_descent(lev,
fsize)
elif ismath:
if not hasattr(self, '_mathtext_parser'):
self._mathtext_parser = mathtext.MathTextParser('bitmap')
img, _ = self._mathtext_parser.parse(lev, dpi=72,
prop=self.labelFontProps)
lw = img.get_width() # at dpi=72, the units are PostScript points
else:
# width is much less than "font size"
lw = (len(lev)) * fsize * 0.6
return lw
示例2: get_label_width
# 需要导入模块: from matplotlib import texmanager [as 别名]
# 或者: from matplotlib.texmanager import TexManager [as 别名]
def get_label_width(self, lev, fmt, fsize):
"""
Return the width of the label in points.
"""
if not isinstance(lev, str):
lev = self.get_text(lev, fmt)
lev, ismath = text.Text.is_math_text(lev)
if ismath == 'TeX':
if not hasattr(self, '_TeX_manager'):
self._TeX_manager = texmanager.TexManager()
lw, _, _ = self._TeX_manager.get_text_width_height_descent(lev,
fsize)
elif ismath:
if not hasattr(self, '_mathtext_parser'):
self._mathtext_parser = mathtext.MathTextParser('bitmap')
img, _ = self._mathtext_parser.parse(lev, dpi=72,
prop=self.labelFontProps)
lw = img.get_width() # at dpi=72, the units are PostScript points
else:
# width is much less than "font size"
lw = (len(lev)) * fsize * 0.6
return lw
示例3: get_label_width
# 需要导入模块: from matplotlib import texmanager [as 别名]
# 或者: from matplotlib.texmanager import TexManager [as 别名]
def get_label_width(self, lev, fmt, fsize):
"""
Return the width of the label in points.
"""
if not isinstance(lev, str):
lev = self.get_text(lev, fmt)
lev, ismath = text.Text()._preprocess_math(lev)
if ismath == 'TeX':
if not hasattr(self, '_TeX_manager'):
self._TeX_manager = texmanager.TexManager()
lw, _, _ = self._TeX_manager.get_text_width_height_descent(lev,
fsize)
elif ismath:
if not hasattr(self, '_mathtext_parser'):
self._mathtext_parser = mathtext.MathTextParser('bitmap')
img, _ = self._mathtext_parser.parse(lev, dpi=72,
prop=self.labelFontProps)
lw = img.get_width() # at dpi=72, the units are PostScript points
else:
# width is much less than "font size"
lw = (len(lev)) * fsize * 0.6
return lw
示例4: get_label_width
# 需要导入模块: from matplotlib import texmanager [as 别名]
# 或者: from matplotlib.texmanager import TexManager [as 别名]
def get_label_width(self, lev, fmt, fsize):
"""
Return the width of the label in points.
"""
if not isinstance(lev, six.string_types):
lev = self.get_text(lev, fmt)
lev, ismath = text.Text.is_math_text(lev)
if ismath == 'TeX':
if not hasattr(self, '_TeX_manager'):
self._TeX_manager = texmanager.TexManager()
lw, _, _ = self._TeX_manager.get_text_width_height_descent(lev,
fsize)
elif ismath:
if not hasattr(self, '_mathtext_parser'):
self._mathtext_parser = mathtext.MathTextParser('bitmap')
img, _ = self._mathtext_parser.parse(lev, dpi=72,
prop=self.labelFontProps)
lw = img.get_width() # at dpi=72, the units are PostScript points
else:
# width is much less than "font size"
lw = (len(lev)) * fsize * 0.6
return lw
示例5: get_texmanager
# 需要导入模块: from matplotlib import texmanager [as 别名]
# 或者: from matplotlib.texmanager import TexManager [as 别名]
def get_texmanager(self):
"""
return the :class:`matplotlib.texmanager.TexManager` instance
"""
if self._texmanager is None:
from matplotlib.texmanager import TexManager
self._texmanager = TexManager()
return self._texmanager
示例6: get_texmanager
# 需要导入模块: from matplotlib import texmanager [as 别名]
# 或者: from matplotlib.texmanager import TexManager [as 别名]
def get_texmanager(self):
"""Return the `.TexManager` instance."""
if self._texmanager is None:
from matplotlib.texmanager import TexManager
self._texmanager = TexManager()
return self._texmanager
示例7: test_fontconfig_preamble
# 需要导入模块: from matplotlib import texmanager [as 别名]
# 或者: from matplotlib.texmanager import TexManager [as 别名]
def test_fontconfig_preamble():
"""
Test that the preamble is included in _fontconfig
"""
plt.rcParams['text.usetex'] = True
tm1 = TexManager()
font_config1 = tm1.get_font_config()
plt.rcParams['text.latex.preamble'] = ['\\usepackage{txfonts}']
tm2 = TexManager()
font_config2 = tm2.get_font_config()
assert font_config1 != font_config2
示例8: get_texmanager
# 需要导入模块: from matplotlib import texmanager [as 别名]
# 或者: from matplotlib.texmanager import TexManager [as 别名]
def get_texmanager(self):
"""Return the cached `~.texmanager.TexManager` instance."""
if self._texmanager is None:
from matplotlib.texmanager import TexManager
self._texmanager = TexManager()
return self._texmanager