當前位置: 首頁>>代碼示例>>Python>>正文


Python texmanager.TexManager方法代碼示例

本文整理匯總了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 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:26,代碼來源:contour.py

示例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 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:26,代碼來源:contour.py

示例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 
開發者ID:boris-kz,項目名稱:CogAlg,代碼行數:26,代碼來源:contour.py

示例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 
開發者ID:alvarobartt,項目名稱:twitter-stock-recommendation,代碼行數:26,代碼來源:contour.py

示例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 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:10,代碼來源:backend_bases.py

示例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 
開發者ID:PacktPublishing,項目名稱:Mastering-Elasticsearch-7.0,代碼行數:8,代碼來源:backend_bases.py

示例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 
開發者ID:holzschu,項目名稱:python3_ios,代碼行數:16,代碼來源:test_texmanager.py

示例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 
開發者ID:boris-kz,項目名稱:CogAlg,代碼行數:8,代碼來源:textpath.py


注:本文中的matplotlib.texmanager.TexManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。