本文整理汇总了Python中matplotlib.scale方法的典型用法代码示例。如果您正苦于以下问题:Python matplotlib.scale方法的具体用法?Python matplotlib.scale怎么用?Python matplotlib.scale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib
的用法示例。
在下文中一共展示了matplotlib.scale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: xscale
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [as 别名]
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()
示例2: yscale
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [as 别名]
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()
示例3: set_xscale
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [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()
示例4: set_yscale
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [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()
示例5: magnitude_spectrum
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [as 别名]
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
示例6: specgram
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [as 别名]
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
示例7: minorticks_on
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [as 别名]
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())
示例8: specgram
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [as 别名]
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.
示例9: transform_non_affine
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [as 别名]
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)
示例10: xscale
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [as 别名]
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)
示例11: yscale
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [as 别名]
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)
示例12: magnitude_spectrum
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [as 别名]
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.
示例13: _set_lim_and_transforms
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [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)
示例14: get_data_ratio_log
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [as 别名]
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
示例15: _set_lim_and_transforms
# 需要导入模块: import matplotlib [as 别名]
# 或者: from matplotlib import scale [as 别名]
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)