在Matplotlib中设置色彩地图的范围 [英] Setting range of a colormap in Matplotlib
问题描述
我使用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
)
我想设置范围在颜色表'Blues'上以这种方式删除在绘图中不可见的白色。
请帮助!
抱歉,英语不好。
范围(或 normilization )并不是色彩映射的一个特性,但通常作为一个功能实现使用色彩映射。例如, imshow
使用 vmin
和 vmax
,因此您可以尝试将这些关键字用作 draw_circular
(我找不到文档),或者 norm
。 除此之外,您可以使用自己想要的颜色排列来制作自己的色彩地图。有很多关于如何制作自定义色彩贴图的示例,以及一些可用的不同方法。这里( a , b , c , d )是一些例子,可能会对你有用。
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.
Please help!
Sorry for bad english.
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
.
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中设置色彩地图的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!