我正在使用 matplotlib 绘制一个简单的图表:
cm=plt.get_cmap('Blues')
nx.draw_circular(G,
node_color='White',
edge_color=range(G.number_of_edges()),
edge_cmap=cm,
node_size=900,
width=4
)
我想在颜色图“蓝色”上设置一个范围,以删除绘图中不可见的白色。
请帮忙!
抱歉英语不好。
范围(或正常化 http://matplotlib.sourceforge.net/api/colors_api.html#module-matplotlib.colors)实际上并不是颜色图的一个特征,但通常作为使用颜色图绘制的函数中的一个特征来实现。例如,imshow uses vmin and vmax http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.imshow,所以你可以尝试使用这些作为关键字draw_circular
(我找不到文档),或者也许norm
.
除此之外,您可以使用您想要的精确颜色排列来制作自己的颜色图。有很多关于如何制作自定义颜色图的示例,以及一些不同的方法可用。这里 (a http://assorted-experience.blogspot.com/2007/07/custom-colormaps.html, b http://www.scipy.org/Cookbook/Matplotlib/ColormapTransformations, c http://matplotlib.sourceforge.net/examples/api/colorbar_only.html, d http://sites.google.com/site/theodoregoetz/notes/matplotlib_colormapadjust)是一些可能对您有用的示例。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)