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


Python Normalize.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from matplotlib.colors import Normalize [as 别名]
# 或者: from matplotlib.colors.Normalize import __init__ [as 别名]
 def __init__(self):
     Normalize.__init__(self)
     self.stretch = "linear"
     self.bias = 0.5
     self.contrast = 0.5
     self.clip_lo = 5.0
     self.clip_hi = 95.0
开发者ID:hihihippp,项目名称:glue,代码行数:9,代码来源:layer_artist.py

示例2: __init__

# 需要导入模块: from matplotlib.colors import Normalize [as 别名]
# 或者: from matplotlib.colors.Normalize import __init__ [as 别名]
    def __init__(self, stretch='linear', exponent=5, vmid=None, vmin=None,
                 vmax=None, clip=False):
        '''
        Initalize an APLpyNormalize instance.

        Optional Keyword Arguments:

            *vmin*: [ None | float ]
                Minimum pixel value to use for the scaling.

            *vmax*: [ None | float ]
                Maximum pixel value to use for the scaling.

            *stretch*: [ 'linear' | 'log' | 'sqrt' | 'arcsinh' | 'power' ]
                The stretch function to use (default is 'linear').

            *vmid*: [ None | float ]
                Mid-pixel value used for the log and arcsinh stretches. If
                set to None, a default value is picked.

            *exponent*: [ float ]
                if self.stretch is set to 'power', this is the exponent to use.

            *clip*: [ True | False ]
                If clip is True and the given value falls outside the range,
                the returned value will be 0 or 1, whichever is closer.
        '''

        if vmax < vmin:
            raise Exception("vmax should be larger than vmin")

        # Call original initalization routine
        Normalize.__init__(self, vmin=vmin, vmax=vmax, clip=clip)

        # Save parameters
        self.stretch = stretch
        self.exponent = exponent

        if stretch == 'power' and np.equal(self.exponent, None):
            raise Exception("For stretch=='power', an exponent should be specified")

        if np.equal(vmid, None):
            if stretch == 'log':
                if vmin > 0:
                    self.midpoint = vmax / vmin
                else:
                    raise Exception("When using a log stretch, if vmin < 0, then vmid has to be specified")
            elif stretch == 'arcsinh':
                self.midpoint = -1./30.
            else:
                self.midpoint = None
        else:
            if stretch == 'log':
                if vmin < vmid:
                    raise Exception("When using a log stretch, vmin should be larger than vmid")
                self.midpoint = (vmax - vmid) / (vmin - vmid)
            elif stretch == 'arcsinh':
                self.midpoint = (vmid - vmin) / (vmax - vmin)
            else:
                self.midpoint = None
开发者ID:cdeil,项目名称:aplpy,代码行数:62,代码来源:normalize.py

示例3: __init__

# 需要导入模块: from matplotlib.colors import Normalize [as 别名]
# 或者: from matplotlib.colors.Normalize import __init__ [as 别名]
 def __init__(self, vmin=None, vmax=None, midpoint=0, clip=False):
     """
     Copied from SO answer: http://stackoverflow.com/questions/20144529/shifted-colorbar-matplotlib
     :param vmin:
     :param vmax:
     :param midpoint:
     :param clip:
     """
     self.midpoint = midpoint
     Normalize.__init__(self, vmin, vmax, clip)
开发者ID:guziy,项目名称:RPN,代码行数:12,代码来源:norms.py

示例4: __init__

# 需要导入模块: from matplotlib.colors import Normalize [as 别名]
# 或者: from matplotlib.colors.Normalize import __init__ [as 别名]
    def __init__(self, vmin=None, vmax=None, midpoint=None,
                 clip=False, nlevs=9):
        """.. warning::
             MidpointNormalize is deprecated and will be removed in
             future versions.  Please use
             :class:`timutils.get_discrete_midpt_cmap_norm` instead

        returns a colormap and a matplotlib.colors.Normalize
        instance that implement a *continuous* colormap with an
        arbitrary midpoint.

        ARGS:
            vmin (real): the minimum value in the colormap
            vmax (real): the maximum value in the colormap
            midpoint (real): the midpoint to center on
            clip (boolean):
            nlevs (integer): number of levels to divide the colormap
                into.  Not currently functional.

        EXAMPLE:
            >>> import matplotlib.pyplot as plt
            >>> import numpy as np
            >>> from timutils.midpt_norm import MidpointNormalize
            >>> plt.close('all')
            >>> data = np.random.randint(-120, 20, [124, 124])
            >>> fix, ax = plt.subplots(1, 2)
            >>> mycmap = plt.get_cmap('Blues')
            >>> mynorm = MidpointNormalize(vmin=-120, vmax=20, midpoint=0.0)
            >>> cm = ax[0].pcolormesh(data, norm=mynorm, cmap=mycmap)
            >>> plt.colorbar(cm, cax=ax[1], norm=mynorm, cmap=mycmap)
            >>> plt.show()

        adapted by Timothy W. Hilton from `code posted by Joe Kington
        <http://stackoverflow.com/questions/20144529/shifted-colorbar-matplotlib>`_
        accessed 19 January 2015
        """
        warnings.warn(('MidpointNormalize is (1) deprecated and (2)'
                       'buggy and will be' 'removed in future versions. '
                       'Please use get_discrete_midpt_cmap_norm instead'))
        self.midpoint = midpoint
        self.nlevs = nlevs
        Normalize.__init__(self, vmin, vmax, clip)
开发者ID:Timothy-W-Hilton,项目名称:TimPyUtils,代码行数:44,代码来源:midpt_norm.py

示例5: __init__

# 需要导入模块: from matplotlib.colors import Normalize [as 别名]
# 或者: from matplotlib.colors.Normalize import __init__ [as 别名]
 def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):
     self.midpoint = midpoint
     Normalize.__init__(self, vmin, vmax, clip)
开发者ID:jonathan-sahar,项目名称:ML-project,代码行数:5,代码来源:optimizeRBFParameters.py

示例6: __init__

# 需要导入模块: from matplotlib.colors import Normalize [as 别名]
# 或者: from matplotlib.colors.Normalize import __init__ [as 别名]
 def __init__(self,linthresh,vmin=None,vmax=None,clip=False):
   Normalize.__init__(self,vmin,vmax,clip)
   self.linthresh=linthresh
   self.vmin, self.vmax = vmin, vmax
开发者ID:awickert,项目名称:GRASSplot,代码行数:6,代码来源:grassplot.py

示例7: __init__

# 需要导入模块: from matplotlib.colors import Normalize [as 别名]
# 或者: from matplotlib.colors.Normalize import __init__ [as 别名]
 def __init__(self, vmin=None, vmax=None, vanchor=None,
              clip=False, canchor=0.5):
     self.vanchor = vanchor
     self.canchor = canchor
     Normalize.__init__(self, vmin, vmax, clip)
开发者ID:gitter-badger,项目名称:decond,代码行数:7,代码来源:plot-sdcorr.py

示例8: __init__

# 需要导入模块: from matplotlib.colors import Normalize [as 别名]
# 或者: from matplotlib.colors.Normalize import __init__ [as 别名]
 def __init__(self,vmin=None,vmax=None,clip=False):
     Normalize.__init__(self,vmin,vmax,clip)
开发者ID:cmp346,项目名称:densityplot,代码行数:4,代码来源:new_norm.py

示例9: __init__

# 需要导入模块: from matplotlib.colors import Normalize [as 别名]
# 或者: from matplotlib.colors.Normalize import __init__ [as 别名]
 def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):
     """
     Requires a midpoint value
     """
     self.midpoint = midpoint
     Normalize.__init__(self, vmin, vmax, clip)
开发者ID:uranc,项目名称:locmea,代码行数:8,代码来源:locView.py

示例10: __init__

# 需要导入模块: from matplotlib.colors import Normalize [as 别名]
# 或者: from matplotlib.colors.Normalize import __init__ [as 别名]
 def __init__(self, vmin=None, vmax=None, clip=False, vin=None, cin=0.01):
   self.vin = vin
   self.cin = cin
   Normalize.__init__(self, vmin, vmax, clip)
开发者ID:neishm,项目名称:pygeode,代码行数:6,代码来源:cnt_helpers.py

示例11: __init__

# 需要导入模块: from matplotlib.colors import Normalize [as 别名]
# 或者: from matplotlib.colors.Normalize import __init__ [as 别名]
 def __init__(self, epoch0, epoch1):
     Normalize.__init__(self, self.mktime(epoch0), self.mktime(epoch1))
开发者ID:flomertens,项目名称:libwise,代码行数:4,代码来源:plotutils_base.py


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