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


Python matplotlib.axis方法代码示例

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


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

示例1: get_xaxis_transform

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def get_xaxis_transform(self, which='grid'):
        """
        Get the transformation used for drawing x-axis labels, ticks
        and gridlines.  The x-direction is in data coordinates and the
        y-direction is in axis coordinates.

        .. note::

            This transformation is primarily used by the
            :class:`~matplotlib.axis.Axis` class, and is meant to be
            overridden by new kinds of projections that may need to
            place axis elements in different locations.

        """
        if which == 'grid':
            return self._xaxis_transform
        elif which == 'tick1':
            # for cartesian projection, this is bottom spine
            return self.spines['bottom'].get_spine_transform()
        elif which == 'tick2':
            # for cartesian projection, this is top spine
            return self.spines['top'].get_spine_transform()
        else:
            raise ValueError('unknown value for which') 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:26,代码来源:_base.py

示例2: get_xaxis_text2_transform

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def get_xaxis_text2_transform(self, pad_points):
        """
        Get the transformation used for drawing the secondary x-axis
        labels, which will add the given amount of padding (in points)
        between the axes and the label.  The x-direction is in data
        coordinates and the y-direction is in axis coordinates.
        Returns a 3-tuple of the form::

          (transform, valign, halign)

        where *valign* and *halign* are requested alignments for the
        text.

        .. note::

            This transformation is primarily used by the
            :class:`~matplotlib.axis.Axis` class, and is meant to be
            overridden by new kinds of projections that may need to
            place axis elements in different locations.

        """
        return (self.get_xaxis_transform(which='tick2') +
                mtransforms.ScaledTranslation(0, pad_points / 72.0,
                                              self.figure.dpi_scale_trans),
                "bottom", "center") 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:27,代码来源:_base.py

示例3: get_yaxis_transform

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def get_yaxis_transform(self, which='grid'):
        """
        Get the transformation used for drawing y-axis labels, ticks
        and gridlines.  The x-direction is in axis coordinates and the
        y-direction is in data coordinates.

        .. note::

            This transformation is primarily used by the
            :class:`~matplotlib.axis.Axis` class, and is meant to be
            overridden by new kinds of projections that may need to
            place axis elements in different locations.

        """
        if which == 'grid':
            return self._yaxis_transform
        elif which == 'tick1':
            # for cartesian projection, this is bottom spine
            return self.spines['left'].get_spine_transform()
        elif which == 'tick2':
            # for cartesian projection, this is top spine
            return self.spines['right'].get_spine_transform()
        else:
            raise ValueError('unknown value for which') 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:26,代码来源:_base.py

示例4: get_yaxis_text1_transform

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def get_yaxis_text1_transform(self, pad_points):
        """
        Get the transformation used for drawing y-axis labels, which
        will add the given amount of padding (in points) between the
        axes and the label.  The x-direction is in axis coordinates
        and the y-direction is in data coordinates.  Returns a 3-tuple
        of the form::

          (transform, valign, halign)

        where *valign* and *halign* are requested alignments for the
        text.

        .. note::

            This transformation is primarily used by the
            :class:`~matplotlib.axis.Axis` class, and is meant to be
            overridden by new kinds of projections that may need to
            place axis elements in different locations.

        """
        return (self.get_yaxis_transform(which='tick1') +
                mtransforms.ScaledTranslation(-1 * pad_points / 72.0, 0,
                                              self.figure.dpi_scale_trans),
                "center", "right") 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:27,代码来源:_base.py

示例5: get_yaxis_text2_transform

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def get_yaxis_text2_transform(self, pad_points):
        """
        Get the transformation used for drawing the secondary y-axis
        labels, which will add the given amount of padding (in points)
        between the axes and the label.  The x-direction is in axis
        coordinates and the y-direction is in data coordinates.
        Returns a 3-tuple of the form::

          (transform, valign, halign)

        where *valign* and *halign* are requested alignments for the
        text.

        .. note::

            This transformation is primarily used by the
            :class:`~matplotlib.axis.Axis` class, and is meant to be
            overridden by new kinds of projections that may need to
            place axis elements in different locations.

        """
        return (self.get_yaxis_transform(which='tick2') +
                mtransforms.ScaledTranslation(pad_points / 72.0, 0,
                                              self.figure.dpi_scale_trans),
                "center", "left") 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:27,代码来源:_base.py

示例6: set_xscale

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def set_xscale(self, value, **kwargs):
        """
        Call signature::

          set_xscale(value)

        Set the scaling of the x-axis: %(scale)s

        ACCEPTS: [%(scale)s]

        Different kwargs are accepted, depending on the scale:
        %(scale_docs)s
        """
        # If the scale is being set to log, clip nonposx to prevent headaches
        # around zero
        if value.lower() == 'log' and 'nonposx' not in kwargs.keys():
            kwargs['nonposx'] = 'clip'
        self.xaxis._set_scale(value, **kwargs)
        self.autoscale_view(scaley=False)
        self._update_transScale() 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:22,代码来源:_base.py

示例7: set_xticklabels

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs):
        """
        Call signature::

          set_xticklabels(labels, fontdict=None, minor=False, **kwargs)

        Set the xtick labels with list of strings *labels*. Return a
        list of axis text instances.

        *kwargs* set the :class:`~matplotlib.text.Text` properties.
        Valid properties are
        %(Text)s

        ACCEPTS: sequence of strings
        """
        return self.xaxis.set_ticklabels(labels, fontdict,
                                         minor=minor, **kwargs) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:19,代码来源:_base.py

示例8: set_yscale

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def set_yscale(self, value, **kwargs):
        """
        Call signature::

          set_yscale(value)

        Set the scaling of the y-axis: %(scale)s

        ACCEPTS: [%(scale)s]

        Different kwargs are accepted, depending on the scale:
        %(scale_docs)s
        """
        # If the scale is being set to log, clip nonposy to prevent headaches
        # around zero
        if value.lower() == 'log' and 'nonposy' not in kwargs.keys():
            kwargs['nonposy'] = 'clip'
        self.yaxis._set_scale(value, **kwargs)
        self.autoscale_view(scalex=False)
        self._update_transScale() 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:22,代码来源:_base.py

示例9: twiny

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def twiny(self):
        """
        Call signature::

          ax = twiny()

        create a twin of Axes for generating a plot with a shared
        y-axis but independent x axis.  The x-axis of self will have
        ticks on bottom and the returned axes will have ticks on the
        top.

        .. note::
            For those who are 'picking' artists while using twiny, pick
            events are only called for the artists in the top-most axes.
        """

        ax2 = self._make_twin_axes(sharey=self)
        ax2.xaxis.tick_top()
        ax2.xaxis.set_label_position('top')
        self.xaxis.tick_bottom()
        ax2.yaxis.set_visible(False)
        ax2.patch.set_visible(False)
        return ax2 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:25,代码来源:_base.py

示例10: set_axisbelow

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def set_axisbelow(self, b):
        """
        Set the zorder for the axes ticks and gridlines.

        Parameters
        ----------
        b : bool or 'line'
            ``True`` corresponds to a zorder of 0.5, ``False`` to a zorder of
            2.5, and ``"line"`` to a zorder of 1.5.

        """
        self._axisbelow = axisbelow = validate_axisbelow(b)
        if axisbelow is True:
            zorder = 0.5
        elif axisbelow is False:
            zorder = 2.5
        elif axisbelow == "line":
            zorder = 1.5
        else:
            raise ValueError("Unexpected axisbelow value")
        for axis in self._get_axis_list():
            axis.set_zorder(zorder)
        self.stale = True 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:25,代码来源:_base.py

示例11: set_xticks

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def set_xticks(self, ticks, minor=False):
        """
        Set the x ticks with list of *ticks*

        Parameters
        ----------
        ticks : list
            List of x-axis tick locations.

        minor : bool, optional
            If ``False`` sets major ticks, if ``True`` sets minor ticks.
            Default is ``False``.
        """
        ret = self.xaxis.set_ticks(ticks, minor=minor)
        self.stale = True
        return ret 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:18,代码来源:_base.py

示例12: get_ylim

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def get_ylim(self):
        """
        Get the y-axis range

        Returns
        -------
        ylimits : tuple
            Returns the current y-axis limits as the tuple
            (`bottom`, `top`).

        Notes
        -----
        The y-axis may be inverted, in which case the `bottom` value
        will be greater than the `top` value.

        """
        return tuple(self.viewLim.intervaly) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:19,代码来源:_base.py

示例13: plotter

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def plotter(args: argparse.Namespace):

    config = vars(args)
    subplots = tuple(config.pop("subplots"))
    figsize = tuple(config.pop("figsize"))
    _ = config.pop('func')
    expected_max_performance_data = {}
    average_times = {}
    output_file = config.pop("output_file")
    config = {config.pop("result_file"): config}    
    f, axes = plt.subplots(subplots[0], subplots[1], figsize=figsize)
    if subplots != (1, 1):
        axes_iter = zip(config.items(), np.ndenumerate(axes))
    else:
        axes_iter = zip(config.items(), enumerate([axes]))
    
    for ((data_file, _), (index, _)) in axes_iter:
        duration_field = config[data_file].pop('duration_field')
        model_field = config[data_file].pop('model_field')
        performance_metric_field = config[data_file].pop('performance_metric_field')
        master = pd.read_json(data_file, lines=True)
        data_sizes = [10000]
        for data_size in data_sizes:
            df = master
            avg_time = df.groupby(model_field)[duration_field].mean()
            sample_maxes = df.groupby(model_field)[performance_metric_field].apply(samplemax)
            expected_max_performance_data[data_file] = {data_size: sample_maxes}
            average_times[data_file] = {data_size: avg_time}
            if subplots == (1,1):
                axis = axes
            elif subplots[1] > 1:
                axis = axes[index[0], index[1]]
            else:
                axis = axes[index[0]]
            _one_plot(sample_maxes,
                        avg_time,
                        data_size,
                        axis,
                        **config[data_file])
    print("saving to {}".format(output_file))
    plt.savefig(output_file, dpi=300) 
开发者ID:allenai,项目名称:allentune,代码行数:43,代码来源:plot.py

示例14: __init__

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def __init__(self, axis=None, use_rmin=True):
        Transform.__init__(self)
        self._axis = axis
        self._use_rmin = use_rmin 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:6,代码来源:polar.py

示例15: _set_lim_and_transforms

# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import axis [as 别名]
def _set_lim_and_transforms(self):
        """
        set the *dataLim* and *viewLim*
        :class:`~matplotlib.transforms.Bbox` attributes and the
        *transScale*, *transData*, *transLimits* and *transAxes*
        transformations.

        .. note::

            This method is primarily used by rectilinear projections
            of the :class:`~matplotlib.axes.Axes` class, and is meant
            to be overridden by new kinds of projection axes that need
            different transformations and limits. (See
            :class:`~matplotlib.projections.polar.PolarAxes` for an
            example.

        """
        self.transAxes = mtransforms.BboxTransformTo(self.bbox)

        # Transforms the x and y axis separately by a scale factor.
        # It is assumed that this part will have non-linear components
        # (e.g., for a log scale).
        self.transScale = mtransforms.TransformWrapper(
            mtransforms.IdentityTransform())

        # An affine transformation on the data, generally to limit the
        # range of the axes
        self.transLimits = mtransforms.BboxTransformFrom(
            mtransforms.TransformedBbox(self.viewLim, self.transScale))

        # The parentheses are important for efficiency here -- they
        # group the last two (which are usually affines) separately
        # from the first (which, with log-scaling can be non-affine).
        self.transData = self.transScale + (self.transLimits + self.transAxes)

        self._xaxis_transform = mtransforms.blended_transform_factory(
            self.transData, self.transAxes)
        self._yaxis_transform = mtransforms.blended_transform_factory(
            self.transAxes, self.transData) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:41,代码来源:_base.py


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