本文整理匯總了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
示例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