Python matplotlib.scale() Examples

The following are 30 code examples of matplotlib.scale(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module matplotlib , or try the search function .
Example #1
Source File: pyplot.py    From Computable with MIT License 6 votes vote down vote up
def xscale(*args, **kwargs):
    """
    Set the scaling of the *x*-axis.

    call signature::

      xscale(scale, **kwargs)

    The available scales are: %(scale)s

    Different keywords may be accepted, depending on the scale:

    %(scale_docs)s
    """
    ax = gca()
    ax.set_xscale(*args, **kwargs)
    draw_if_interactive() 
Example #2
Source File: _base.py    From ImageFusion with MIT License 6 votes vote down vote up
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() 
Example #3
Source File: _base.py    From ImageFusion with MIT License 6 votes vote down vote up
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() 
Example #4
Source File: plot.py    From FlowCal with MIT License 6 votes vote down vote up
def transform_non_affine(self, s):
        """
        Apply transformation to a Nx1 numpy array.

        Parameters
        ----------
        s : array
            Data to be transformed in display scale units.

        Return
        ------
        array or masked array
            Transformed data, in data value units.

        """
        T = self._T
        M = self._M
        W = self._W
        p = self._p
        # Calculate x
        return T * 10**(-(M-W)) * (10**(s-W) - (p**2)*10**(-(s-W)/p) + p**2 - 1) 
Example #5
Source File: pyplot.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def specgram(
        x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None,
        noverlap=None, cmap=None, xextent=None, pad_to=None,
        sides=None, scale_by_freq=None, mode=None, scale=None,
        vmin=None, vmax=None, *, data=None, **kwargs):
    __ret = gca().specgram(
        x, NFFT=NFFT, Fs=Fs, Fc=Fc, detrend=detrend, window=window,
        noverlap=noverlap, cmap=cmap, xextent=xextent, pad_to=pad_to,
        sides=sides, scale_by_freq=scale_by_freq, mode=mode,
        scale=scale, vmin=vmin, vmax=vmax, **({"data": data} if data
        is not None else {}), **kwargs)
    sci(__ret[-1])
    return __ret


# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example #6
Source File: _base.py    From python3_ios with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def minorticks_on(self):
        """
        Display minor ticks on the axes.

        Displaying minor ticks may reduce performance; you may turn them off
        using `minorticks_off()` if drawing speed is a problem.
        """
        for ax in (self.xaxis, self.yaxis):
            scale = ax.get_scale()
            if scale == 'log':
                s = ax._scale
                ax.set_minor_locator(mticker.LogLocator(s.base, s.subs))
            elif scale == 'symlog':
                s = ax._scale
                ax.set_minor_locator(
                    mticker.SymmetricalLogLocator(s._transform, s.subs))
            else:
                ax.set_minor_locator(mticker.AutoMinorLocator()) 
Example #7
Source File: _base.py    From coffeegrindsize with MIT License 6 votes vote down vote up
def minorticks_on(self):
        """
        Display minor ticks on the axes.

        Displaying minor ticks may reduce performance; you may turn them off
        using `minorticks_off()` if drawing speed is a problem.
        """
        for ax in (self.xaxis, self.yaxis):
            scale = ax.get_scale()
            if scale == 'log':
                s = ax._scale
                ax.set_minor_locator(mticker.LogLocator(s.base, s.subs))
            elif scale == 'symlog':
                s = ax._scale
                ax.set_minor_locator(
                    mticker.SymmetricalLogLocator(s._transform, s.subs))
            else:
                ax.set_minor_locator(mticker.AutoMinorLocator()) 
Example #8
Source File: pyplot.py    From coffeegrindsize with MIT License 6 votes vote down vote up
def specgram(
        x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None,
        noverlap=None, cmap=None, xextent=None, pad_to=None,
        sides=None, scale_by_freq=None, mode=None, scale=None,
        vmin=None, vmax=None, *, data=None, **kwargs):
    __ret = gca().specgram(
        x, NFFT=NFFT, Fs=Fs, Fc=Fc, detrend=detrend, window=window,
        noverlap=noverlap, cmap=cmap, xextent=xextent, pad_to=pad_to,
        sides=sides, scale_by_freq=scale_by_freq, mode=mode,
        scale=scale, vmin=vmin, vmax=vmax, **({"data": data} if data
        is not None else {}), **kwargs)
    sci(__ret[-1])
    return __ret


# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example #9
Source File: pyplot.py    From CogAlg with MIT License 6 votes vote down vote up
def specgram(
        x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None,
        noverlap=None, cmap=None, xextent=None, pad_to=None,
        sides=None, scale_by_freq=None, mode=None, scale=None,
        vmin=None, vmax=None, *, data=None, **kwargs):
    __ret = gca().specgram(
        x, NFFT=NFFT, Fs=Fs, Fc=Fc, detrend=detrend, window=window,
        noverlap=noverlap, cmap=cmap, xextent=xextent, pad_to=pad_to,
        sides=sides, scale_by_freq=scale_by_freq, mode=mode,
        scale=scale, vmin=vmin, vmax=vmax, **({"data": data} if data
        is not None else {}), **kwargs)
    sci(__ret[-1])
    return __ret


# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example #10
Source File: _base.py    From GraphicDesignPatternByPython with MIT License 6 votes vote down vote up
def minorticks_on(self):
        """
        Display minor ticks on the axes.

        Displaying minor ticks may reduce performance; you may turn them off
        using `minorticks_off()` if drawing speed is a problem.
        """
        for ax in (self.xaxis, self.yaxis):
            scale = ax.get_scale()
            if scale == 'log':
                s = ax._scale
                ax.set_minor_locator(mticker.LogLocator(s.base, s.subs))
            elif scale == 'symlog':
                s = ax._scale
                ax.set_minor_locator(
                    mticker.SymmetricalLogLocator(s._transform, s.subs))
            else:
                ax.set_minor_locator(mticker.AutoMinorLocator()) 
Example #11
Source File: pyplot.py    From neural-network-animation with MIT License 6 votes vote down vote up
def specgram(x, NFFT=None, Fs=None, Fc=None, detrend=None, window=None,
             noverlap=None, cmap=None, xextent=None, pad_to=None, sides=None,
             scale_by_freq=None, mode=None, scale=None, vmin=None, vmax=None,
             hold=None, **kwargs):
    ax = gca()
    # allow callers to override the hold state by passing hold=True|False
    washold = ax.ishold()

    if hold is not None:
        ax.hold(hold)
    try:
        ret = ax.specgram(x, NFFT=NFFT, Fs=Fs, Fc=Fc, detrend=detrend,
                          window=window, noverlap=noverlap, cmap=cmap,
                          xextent=xextent, pad_to=pad_to, sides=sides,
                          scale_by_freq=scale_by_freq, mode=mode, scale=scale,
                          vmin=vmin, vmax=vmax, **kwargs)
        draw_if_interactive()
    finally:
        ax.hold(washold)
    sci(ret[-1])
    return ret

# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost 
Example #12
Source File: pyplot.py    From neural-network-animation with MIT License 6 votes vote down vote up
def xscale(*args, **kwargs):
    """
    Set the scaling of the *x*-axis.

    call signature::

      xscale(scale, **kwargs)

    The available scales are: %(scale)s

    Different keywords may be accepted, depending on the scale:

    %(scale_docs)s
    """
    ax = gca()
    ax.set_xscale(*args, **kwargs)
    draw_if_interactive() 
Example #13
Source File: pyplot.py    From Computable with MIT License 6 votes vote down vote up
def yscale(*args, **kwargs):
    """
    Set the scaling of the *y*-axis.

    call signature::

      yscale(scale, **kwargs)

    The available scales are: %(scale)s

    Different keywords may be accepted, depending on the scale:

    %(scale_docs)s
    """
    ax = gca()
    ax.set_yscale(*args, **kwargs)
    draw_if_interactive() 
Example #14
Source File: pyplot.py    From twitter-stock-recommendation with MIT License 6 votes vote down vote up
def magnitude_spectrum(x, Fs=None, Fc=None, window=None, pad_to=None,
                       sides=None, scale=None, hold=None, data=None, **kwargs):
    ax = gca()
    # Deprecated: allow callers to override the hold state
    # by passing hold=True|False
    washold = ax._hold

    if hold is not None:
        ax._hold = hold
        from matplotlib.cbook import mplDeprecation
        warnings.warn("The 'hold' keyword argument is deprecated since 2.0.",
                      mplDeprecation)
    try:
        ret = ax.magnitude_spectrum(x, Fs=Fs, Fc=Fc, window=window,
                                    pad_to=pad_to, sides=sides, scale=scale,
                                    data=data, **kwargs)
    finally:
        ax._hold = washold

    return ret

# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example #15
Source File: pyplot.py    From matplotlib-4-abaqus with MIT License 6 votes vote down vote up
def xscale(*args, **kwargs):
    """
    Set the scaling of the *x*-axis.

    call signature::

      xscale(scale, **kwargs)

    The available scales are: %(scale)s

    Different keywords may be accepted, depending on the scale:

    %(scale_docs)s
    """
    ax = gca()
    ax.set_xscale(*args, **kwargs)
    draw_if_interactive() 
Example #16
Source File: pyplot.py    From matplotlib-4-abaqus with MIT License 6 votes vote down vote up
def yscale(*args, **kwargs):
    """
    Set the scaling of the *y*-axis.

    call signature::

      yscale(scale, **kwargs)

    The available scales are: %(scale)s

    Different keywords may be accepted, depending on the scale:

    %(scale_docs)s
    """
    ax = gca()
    ax.set_yscale(*args, **kwargs)
    draw_if_interactive() 
Example #17
Source File: pyplot.py    From twitter-stock-recommendation with MIT License 6 votes vote down vote up
def yscale(*args, **kwargs):
    """
    Set the scaling of the y-axis.

    Call signature::

        yscale(scale, **kwargs)

    Parameters
    ----------
    scale : [%(scale)s]
        The scaling type.
    **kwargs
        Additional parameters depend on *scale*. See Notes.

    Notes
    -----
    This is the pyplot equivalent of calling `~.Axes.set_yscale` on the
    current axes.

    Different keywords may be accepted, depending on the scale:

    %(scale_docs)s
    """
    gca().set_yscale(*args, **kwargs) 
Example #18
Source File: pyplot.py    From twitter-stock-recommendation with MIT License 6 votes vote down vote up
def xscale(*args, **kwargs):
    """
    Set the scaling of the x-axis.

    Call signature::

        xscale(scale, **kwargs)

    Parameters
    ----------
    scale : [%(scale)s]
        The scaling type.
    **kwargs
        Additional parameters depend on *scale*. See Notes.

    Notes
    -----
    This is the pyplot equivalent of calling `~.Axes.set_xscale` on the
    current axes.

    Different keywords may be accepted, depending on the scale:

    %(scale_docs)s
    """
    gca().set_xscale(*args, **kwargs) 
Example #19
Source File: _base.py    From neural-network-animation with MIT License 6 votes vote down vote up
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() 
Example #20
Source File: _base.py    From neural-network-animation with MIT License 6 votes vote down vote up
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() 
Example #21
Source File: pyplot.py    From neural-network-animation with MIT License 6 votes vote down vote up
def magnitude_spectrum(x, Fs=None, Fc=None, window=None, pad_to=None,
                       sides=None, scale=None, hold=None, **kwargs):
    ax = gca()
    # allow callers to override the hold state by passing hold=True|False
    washold = ax.ishold()

    if hold is not None:
        ax.hold(hold)
    try:
        ret = ax.magnitude_spectrum(x, Fs=Fs, Fc=Fc, window=window,
                                    pad_to=pad_to, sides=sides, scale=scale,
                                    **kwargs)
        draw_if_interactive()
    finally:
        ax.hold(washold)

    return ret

# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost 
Example #22
Source File: _base.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def _set_lim_and_transforms(self):
        """
        set the *_xaxis_transform*, *_yaxis_transform*,
        *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) 
Example #23
Source File: pyplot.py    From CogAlg with MIT License 5 votes vote down vote up
def magnitude_spectrum(
        x, Fs=None, Fc=None, window=None, pad_to=None, sides=None,
        scale=None, *, data=None, **kwargs):
    return gca().magnitude_spectrum(
        x, Fs=Fs, Fc=Fc, window=window, pad_to=pad_to, sides=sides,
        scale=scale, **({"data": data} if data is not None else {}),
        **kwargs)


# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example #24
Source File: pyplot.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def magnitude_spectrum(
        x, Fs=None, Fc=None, window=None, pad_to=None, sides=None,
        scale=None, *, data=None, **kwargs):
    return gca().magnitude_spectrum(
        x, Fs=Fs, Fc=Fc, window=window, pad_to=pad_to, sides=sides,
        scale=scale, **({"data": data} if data is not None else {}),
        **kwargs)


# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example #25
Source File: _base.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def get_data_ratio_log(self):
        """
        Returns the aspect ratio of the raw data in log scale.
        Will be used when both axis scales are in log.
        """
        xmin, xmax = self.get_xbound()
        ymin, ymax = self.get_ybound()

        xsize = max(abs(math.log10(xmax) - math.log10(xmin)), 1e-30)
        ysize = max(abs(math.log10(ymax) - math.log10(ymin)), 1e-30)

        return ysize / xsize 
Example #26
Source File: _base.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def get_yscale(self):
        """
        Return the x-axis scale as string.

        See Also
        --------
        set_yscale
        """
        return self.yaxis.get_scale() 
Example #27
Source File: _base.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def set_xscale(self, value, **kwargs):
        """
        Set the x-axis scale.

        .. ACCEPTS: [ 'linear' | 'log' | 'symlog' | 'logit' | ... ]

        Parameters
        ----------
        value : {"linear", "log", "symlog", "logit"}
            scaling strategy to apply

        Notes
        -----
        Different kwargs are accepted, depending on the scale. See
        the `~matplotlib.scale` module for more information.

        See also
        --------
        matplotlib.scale.LinearScale : linear transform

        matplotlib.scale.LogTransform : log transform

        matplotlib.scale.SymmetricalLogTransform : symlog transform

        matplotlib.scale.LogisticTransform : logit transform
        """
        g = self.get_shared_x_axes()
        for ax in g.get_siblings(self):
            ax.xaxis._set_scale(value, **kwargs)
            ax._update_transScale()
            ax.stale = True

        self.autoscale_view(scaley=False) 
Example #28
Source File: _base.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def set_xscale(self, value, **kwargs):
        """
        Set the x-axis scale.

        Parameters
        ----------
        value : {"linear", "log", "symlog", "logit", ...}
            The axis scale type to apply.

        **kwargs
            Different keyword arguments are accepted, depending on the scale.
            See the respective class keyword arguments:

            - `matplotlib.scale.LinearScale`
            - `matplotlib.scale.LogScale`
            - `matplotlib.scale.SymmetricalLogScale`
            - `matplotlib.scale.LogitScale`


        Notes
        -----
        By default, Matplotlib supports the above mentioned scales.
        Additionally, custom scales may be registered using
        `matplotlib.scale.register_scale`. These scales can then also
        be used here.
        """
        g = self.get_shared_x_axes()
        for ax in g.get_siblings(self):
            ax.xaxis._set_scale(value, **kwargs)
            ax._update_transScale()
            ax.stale = True

        self.autoscale_view(scaley=False) 
Example #29
Source File: _base.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def get_xscale(self):
        """
        Return the x-axis scale as string.

        See Also
        --------
        set_xscale
        """
        return self.xaxis.get_scale() 
Example #30
Source File: _base.py    From twitter-stock-recommendation with MIT License 5 votes vote down vote up
def set_yscale(self, value, **kwargs):
        """
        Set the y-axis scale.

        .. ACCEPTS: [ 'linear' | 'log' | 'symlog' | 'logit' | ... ]

        Parameters
        ----------
        value : {"linear", "log", "symlog", "logit"}
            scaling strategy to apply

        Notes
        -----
        Different kwargs are accepted, depending on the scale. See
        the `~matplotlib.scale` module for more information.

        See also
        --------
        matplotlib.scale.LinearScale : linear transform

        matplotlib.scale.LogTransform : log transform

        matplotlib.scale.SymmetricalLogTransform : symlog transform

        matplotlib.scale.LogisticTransform : logit transform
        """
        g = self.get_shared_y_axes()
        for ax in g.get_siblings(self):
            ax.yaxis._set_scale(value, **kwargs)
            ax._update_transScale()
            ax.stale = True
        self.autoscale_view(scalex=False)