當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。