本文整理匯總了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