Python matplotlib.scale() Examples

The following are 30 code examples for showing how to use matplotlib.scale(). These examples are extracted from open source projects. 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 check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module matplotlib , or try the search function .

Example 1
Project: Computable   Author: ktraunmueller   File: pyplot.py    License: 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
Project: Computable   Author: ktraunmueller   File: pyplot.py    License: 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 3
Project: matplotlib-4-abaqus   Author: Solid-Mechanics   File: pyplot.py    License: 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 4
Project: matplotlib-4-abaqus   Author: Solid-Mechanics   File: pyplot.py    License: 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 5
Project: neural-network-animation   Author: miloharper   File: _base.py    License: 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 6
Project: neural-network-animation   Author: miloharper   File: _base.py    License: 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 7
Project: neural-network-animation   Author: miloharper   File: pyplot.py    License: 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 8
Project: neural-network-animation   Author: miloharper   File: pyplot.py    License: 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 9
Project: neural-network-animation   Author: miloharper   File: pyplot.py    License: 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 10
Project: GraphicDesignPatternByPython   Author: Relph1119   File: _base.py    License: 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
Project: python3_ios   Author: holzschu   File: _base.py    License: 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 12
Project: python3_ios   Author: holzschu   File: pyplot.py    License: 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 13
Project: FlowCal   Author: taborlab   File: plot.py    License: 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 14
Project: ImageFusion   Author: pfchai   File: _base.py    License: 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 15
Project: ImageFusion   Author: pfchai   File: _base.py    License: 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 16
Project: coffeegrindsize   Author: jgagneastro   File: _base.py    License: 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 17
Project: coffeegrindsize   Author: jgagneastro   File: pyplot.py    License: 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 18
Project: CogAlg   Author: boris-kz   File: pyplot.py    License: 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 19
Project: twitter-stock-recommendation   Author: alvarobartt   File: pyplot.py    License: 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 20
Project: twitter-stock-recommendation   Author: alvarobartt   File: pyplot.py    License: 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 21
Project: twitter-stock-recommendation   Author: alvarobartt   File: pyplot.py    License: 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 22
Project: neural-network-animation   Author: miloharper   File: _base.py    License: MIT License 5 votes vote down vote up
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) 
Example 23
Project: neural-network-animation   Author: miloharper   File: _base.py    License: 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(math.fabs(math.log10(xmax) - math.log10(xmin)), 1e-30)
        ysize = max(math.fabs(math.log10(ymax) - math.log10(ymin)), 1e-30)

        return ysize / xsize 
Example 24
Project: GraphicDesignPatternByPython   Author: Relph1119   File: _base.py    License: 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 25
Project: GraphicDesignPatternByPython   Author: Relph1119   File: _base.py    License: 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
Project: GraphicDesignPatternByPython   Author: Relph1119   File: _base.py    License: 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", ...}
            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 27
Project: GraphicDesignPatternByPython   Author: Relph1119   File: _base.py    License: MIT License 5 votes vote down vote up
def set_yscale(self, value, **kwargs):
        """
        Set the y-axis scale.

        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) 
Example 28
Project: GraphicDesignPatternByPython   Author: Relph1119   File: pyplot.py    License: 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=x, Fs=Fs, Fc=Fc, window=window, pad_to=pad_to, sides=sides,
        scale=scale, data=data, **kwargs)

# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example 29
Project: GraphicDesignPatternByPython   Author: Relph1119   File: pyplot.py    License: MIT License 5 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=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, **kwargs)
    sci(__ret[-1])
    return __ret

# Autogenerated by boilerplate.py.  Do not edit as changes will be lost. 
Example 30
Project: python3_ios   Author: holzschu   File: _base.py    License: BSD 3-Clause "New" or "Revised" 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)