我正在使用 matplotlib 绘制一个简单的图形:
I'm using matplotlib to plot a simple graph:
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
)
我想在颜色图蓝色"上设置一个范围,以删除绘图中不可见的白色.
I want to set a range on the colormap 'Blues' in such a way to delete the white color which is not visible in the draw.
请帮忙!
抱歉英语不好.
范围(或 规范化) 并不是颜色图的真正功能,但通常在使用颜色图进行绘图的函数中实现为功能.例如,imshow
使用 vmin
和 vmax
,因此您可以尝试将这些作为关键字与 draw_circular
一起使用(我找不到文档),或者可能是 norm
.
The range (or normilization) is not really a feature of the colormap, but is often implemented as a feature in the functions that plot using colormaps. For example, imshow
uses vmin
and vmax
, so you might try using these as keywords with draw_circular
(I can't find the documentation), or maybe norm
.
除此之外,您还可以根据自己的需要制作具有精确颜色排列的颜色图.有很多关于如何制作自定义颜色图的示例,以及一些可用的不同方法.这里(a, b, c、d) 是一些可能的例子对你有用.
Other than this, you can make your own colormap with exact color arrangement that you want. There are plenty of examples on how to make custom colormaps, and a few different approaches available. Here (a, b, c, d) are a few examples that might be useful to you.
这篇关于在 Matplotlib 中设置颜色图的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!