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.