本文整理汇总了Python中matplotlib.cm.bone方法的典型用法代码示例。如果您正苦于以下问题:Python cm.bone方法的具体用法?Python cm.bone怎么用?Python cm.bone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.cm
的用法示例。
在下文中一共展示了cm.bone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: viz_attn
# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import bone [as 别名]
def viz_attn(input_sentence, output_words, attentions):
maxi = max(len(input_sentence.split()),len(output_words))
attentions = attentions[:maxi,:maxi]
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.matshow(attentions.numpy(), cmap=cm.bone)
fig.colorbar(cax)
ax.set_xticklabels([''] + input_sentence.split(' ') +
['<EOS>'], rotation=90)
ax.set_yticklabels([''] + output_words)
ax.xaxis.set_major_locator(ticker.MultipleLocator(1))
ax.yaxis.set_major_locator(ticker.MultipleLocator(1))
plt.show()
示例2: bone
# 需要导入模块: from matplotlib import cm [as 别名]
# 或者: from matplotlib.cm import bone [as 别名]
def bone():
'''
set the default colormap to bone and apply to current image if any.
See help(colormaps) for more information
'''
rc('image', cmap='bone')
im = gci()
if im is not None:
im.set_cmap(cm.bone)
draw_if_interactive()
# This function was autogenerated by boilerplate.py. Do not edit as
# changes will be lost