本文整理汇总了Python中matplotlib.colors.LinearSegmentedColormap.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python LinearSegmentedColormap.__init__方法的具体用法?Python LinearSegmentedColormap.__init__怎么用?Python LinearSegmentedColormap.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.colors.LinearSegmentedColormap
的用法示例。
在下文中一共展示了LinearSegmentedColormap.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from matplotlib.colors import LinearSegmentedColormap [as 别名]
# 或者: from matplotlib.colors.LinearSegmentedColormap import __init__ [as 别名]
def __init__(self, name, segmented_data, index=None, **kwargs):
if index is None:
# If index not given, RGB colors are evenly-spaced in colormap.
index = np.linspace(0, 1, len(segmented_data['red']))
for key, value in segmented_data.items():
# Combine color index with color values.
segmented_data[key] = zip(index, value)
segmented_data = dict((key, [(x, y, y) for x, y in value])
for key, value in segmented_data.items())
LinearSegmentedColormap.__init__(self, name, segmented_data, **kwargs)
示例2: __init__
# 需要导入模块: from matplotlib.colors import LinearSegmentedColormap [as 别名]
# 或者: from matplotlib.colors.LinearSegmentedColormap import __init__ [as 别名]
def __init__(self, name, color_data, index=None, **kwargs):
if not hasattr(color_data, 'keys'):
color_data = rgb_list_to_colordict(color_data)
if index is None:
# If index not given, RGB colors are evenly-spaced in colormap.
index = np.linspace(0, 1, len(color_data['red']))
# Adapt color_data to the form expected by LinearSegmentedColormap.
color_data = dict((key, [(x, y, y) for x, y in zip(index, value)])
for key, value in color_data.items())
LinearSegmentedColormap.__init__(self, name, color_data, **kwargs)
示例3: __init__
# 需要导入模块: from matplotlib.colors import LinearSegmentedColormap [as 别名]
# 或者: from matplotlib.colors.LinearSegmentedColormap import __init__ [as 别名]
def __init__(self, name, segmented_data, **kwargs):
segmented_data = dict((key, [(x, y, y) for x, y in value])
for key, value in segmented_data.items())
LinearSegmentedColormap.__init__(self, name, segmented_data, **kwargs)
示例4: __init__
# 需要导入模块: from matplotlib.colors import LinearSegmentedColormap [as 别名]
# 或者: from matplotlib.colors.LinearSegmentedColormap import __init__ [as 别名]
def __init__(self, name, segmented_data, **kwargs):
segmented_data = {key: [(x, y, y) for x, y in value]
for key, value in segmented_data.items()}
LinearSegmentedColormap.__init__(self, name, segmented_data, **kwargs)