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


Python cm.summer方法代码示例

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


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

示例1: summer

# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import summer [as 别名]
def summer():
    '''
    set the default colormap to summer and apply to current image if any.
    See help(colormaps) for more information
    '''
    rc('image', cmap='summer')
    im = gci()

    if im is not None:
        im.set_cmap(cm.summer)
    draw_if_interactive()


# This function was autogenerated by boilerplate.py.  Do not edit as
# changes will be lost 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:17,代码来源:pyplot.py

示例2: heatmap_barplot

# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import summer [as 别名]
def heatmap_barplot(grid, h=4, width=10, bar_scale=0.9, num_colors=10, colormap=cm.summer, bevel_width=0.015, logarithmic=False):
    """Create 3D barplot from heatmap grid"""

    # Logarithmic scale
    if logarithmic:
        grid = np.log(grid + 1)

    # Find maximum value
    z_max = np.max(grid)

    n, m = grid.shape
    bar_width = bar_scale * width / max(n, m)

    # List of bmesh elements for each color group
    bmList = [bmesh.new() for i in range(num_colors)]

    # Iterate over grid
    for i in range(n):
        for j in range(m):
            x, y, z = i / (n - 1), j / (m - 1), grid[i][j]
            if z > 0.001:
                bar_height = ((h - bar_width) * z / z_max) + bar_width
                t = 1 - np.exp(-(z / z_max)/0.2)
                k = min(int(num_colors*t), num_colors - 1)
                bm = bmList[k]

                T = Matrix.Translation((
                    width*(x - 0.5),
                    width*(y - 0.5),
                    bar_height / 2))

                S = Matrix.Scale(bar_height / bar_width, 4, (0, 0, 1))
                bmesh.ops.create_cube(bm, size=bar_width, matrix=T*S)

    objList = []
    for i, bm in enumerate(bmList):
        # Create object
        obj = utils.bmesh_to_object(bm)

        # Create material with colormap
        color = colormap(i / num_colors)
        mat = utils.simple_material(color[:3])
        obj.data.materials.append(mat)
        objList.append(obj)

        # Add bevel modifier
        bevel = obj.modifiers.new('Bevel', 'BEVEL')
        bevel.width = bevel_width 
开发者ID:njanakiev,项目名称:openstreetmap-heatmap,代码行数:50,代码来源:render_osm_data.py


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