当前位置: 首页>>代码示例>>Python>>正文


Python text.Text方法代码示例

本文整理汇总了Python中matplotlib.text.Text方法的典型用法代码示例。如果您正苦于以下问题:Python text.Text方法的具体用法?Python text.Text怎么用?Python text.Text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.text的用法示例。


在下文中一共展示了text.Text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_text1

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def _get_text1(self):
        'Get the default Text instance'
        # the y loc is 3 points below the min of y axis
        # get the affine as an a,b,c,d,tx,ty list
        # x in data coords, y in axes coords
        #t =  mtext.Text(
        trans, vert, horiz = self._get_text1_transform()
        t = mtext.Text(
            x=0, y=0,
            fontproperties=font_manager.FontProperties(size=self._labelsize),
            color=self._labelcolor,
            verticalalignment=vert,
            horizontalalignment=horiz,
            )
        t.set_transform(trans)
        self._set_artist_props(t)
        return t 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:19,代码来源:axis.py

示例2: _get_text2

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def _get_text2(self):

        'Get the default Text 2 instance'
        # x in data coords, y in axes coords
        #t =  mtext.Text(
        trans, vert, horiz = self._get_text2_transform()
        t = mtext.Text(
            x=0, y=1,
            fontproperties=font_manager.FontProperties(size=self._labelsize),
            color=self._labelcolor,
            verticalalignment=vert,
            horizontalalignment=horiz,
            )
        t.set_transform(trans)
        self._set_artist_props(t)
        return t 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:axis.py

示例3: _get_label

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def _get_label(self):
        # x in axes coords, y in display coords (to be updated at draw
        # time by _update_label_positions)
        label = mtext.Text(x=0.5, y=0,
            fontproperties=font_manager.FontProperties(
                               size=rcParams['axes.labelsize'],
                               weight=rcParams['axes.labelweight']),
            color=rcParams['axes.labelcolor'],
            verticalalignment='top',
            horizontalalignment='center',
            )

        label.set_transform(mtransforms.blended_transform_factory(
            self.axes.transAxes, mtransforms.IdentityTransform()))

        self._set_artist_props(label)
        self.label_position = 'bottom'
        return label 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:20,代码来源:axis.py

示例4: get_label_width

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [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

示例5: get_real_label_width

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def get_real_label_width(self, lev, fmt, fsize):
        """
        This computes actual onscreen label width.
        This uses some black magic to determine onscreen extent of non-drawn
        label.  This magic may not be very robust.

        This method is not being used, and may be modified or removed.
        """
        # Find middle of axes
        xx = np.mean(np.asarray(self.ax.axis()).reshape(2, 2), axis=1)

        # Temporarily create text object
        t = text.Text(xx[0], xx[1])
        self.set_label_props(t, self.get_text(lev, fmt), 'k')

        # Some black magic to get onscreen extent
        # NOTE: This will only work for already drawn figures, as the canvas
        # does not have a renderer otherwise.  This is the reason this function
        # can't be integrated into the rest of the code.
        bbox = t.get_window_extent(renderer=self.ax.figure.canvas.renderer)

        # difference in pixel extent of image
        lw = np.diff(bbox.corners()[0::2, 0])[0]

        return lw 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:27,代码来源:contour.py

示例6: _get_text1

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def _get_text1(self):
        'Get the default Text instance'
        # the y loc is 3 points below the min of y axis
        # get the affine as an a,b,c,d,tx,ty list
        # x in data coords, y in axes coords
        trans, vert, horiz = self._get_text1_transform()
        t = mtext.Text(
            x=0, y=0,
            fontproperties=font_manager.FontProperties(size=self._labelsize),
            color=self._labelcolor,
            verticalalignment=vert,
            horizontalalignment=horiz,
            )
        t.set_transform(trans)
        self._set_artist_props(t)
        return t 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:18,代码来源:axis.py

示例7: set_label_text

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def set_label_text(self, label, fontdict=None, **kwargs):
        """
        Set the text value of the axis label.

        Parameters
        ----------
        label : str
            Text string.
        fontdict : dict
            Text properties.
        **kwargs
            Merged into fontdict.
        """
        self.isDefault_label = False
        self.label.set_text(label)
        if fontdict is not None:
            self.label.update(fontdict)
        self.label.update(kwargs)
        self.stale = True
        return self.label 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:22,代码来源:axis.py

示例8: _get_label

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def _get_label(self):
        # x in axes coords, y in display coords (to be updated at draw
        # time by _update_label_positions)
        label = mtext.Text(x=0.5, y=0,
                           fontproperties=font_manager.FontProperties(
                               size=rcParams['axes.labelsize'],
                               weight=rcParams['axes.labelweight']),
                           color=rcParams['axes.labelcolor'],
                           verticalalignment='top',
                           horizontalalignment='center')

        label.set_transform(mtransforms.blended_transform_factory(
            self.axes.transAxes, mtransforms.IdentityTransform()))

        self._set_artist_props(label)
        self.label_position = 'bottom'
        return label 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:19,代码来源:axis.py

示例9: get_yticklabels

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def get_yticklabels(self, minor=False, which=None):
        """
        Get the y tick labels as a list of `~matplotlib.text.Text` instances.

        Parameters
        ----------
        minor : bool
           If True return the minor ticklabels,
           else return the major ticklabels

        which : None, ('minor', 'major', 'both')
           Overrides `minor`.

           Selects which ticklabels to return

        Returns
        -------
        ret : list
           List of `~matplotlib.text.Text` instances.
        """
        return cbook.silent_list('Text yticklabel',
                                 self.yaxis.get_ticklabels(minor=minor,
                                                           which=which)) 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:25,代码来源:_base.py

示例10: get_label

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def get_label(self):
        'Return the axis label as a Text instance'
        return self.label 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:axis.py

示例11: get_offset_text

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def get_offset_text(self):
        'Return the axis offsetText as a Text instance'
        return self.offsetText 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:axis.py

示例12: get_majorticklabels

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def get_majorticklabels(self):
        'Return a list of Text instances for the major ticklabels'
        ticks = self.get_major_ticks()
        labels1 = [tick.label1 for tick in ticks if tick.label1On]
        labels2 = [tick.label2 for tick in ticks if tick.label2On]
        return cbook.silent_list('Text major ticklabel', labels1 + labels2) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:8,代码来源:axis.py

示例13: get_minorticklabels

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def get_minorticklabels(self):
        'Return a list of Text instances for the minor ticklabels'
        ticks = self.get_minor_ticks()
        labels1 = [tick.label1 for tick in ticks if tick.label1On]
        labels2 = [tick.label2 for tick in ticks if tick.label2On]
        return cbook.silent_list('Text minor ticklabel', labels1 + labels2) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:8,代码来源:axis.py

示例14: get_ticklabels

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def get_ticklabels(self, minor=False):
        'Return a list of Text instances for ticklabels'
        if minor:
            return self.get_minorticklabels()
        return self.get_majorticklabels() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:7,代码来源:axis.py

示例15: _get_offset_text

# 需要导入模块: from matplotlib import text [as 别名]
# 或者: from matplotlib.text import Text [as 别名]
def _get_offset_text(self):
        # x in axes coords, y in display coords (to be updated at draw time)
        offsetText = mtext.Text(x=1, y=0,
            fontproperties=font_manager.FontProperties(
                                          size=rcParams['xtick.labelsize']),
            color=rcParams['xtick.color'],
            verticalalignment='top',
            horizontalalignment='right',
            )
        offsetText.set_transform(mtransforms.blended_transform_factory(
                self.axes.transAxes, mtransforms.IdentityTransform()))
        self._set_artist_props(offsetText)
        self.offset_text_position = 'bottom'
        return offsetText 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:16,代码来源:axis.py


注:本文中的matplotlib.text.Text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。