简体   繁体   中英

How to remove the contour of nodes in networkx

在此输入图像描述

I am using networkx in python to draw a network for emojis. Here is my code:

G = nx.Graph()
# emoji_sim is a nested list contains cosine similarity of each emojis pair.
G = nx.from_numpy_matrix(np.array(emoji_sim))

labels=dict(zip(range(len(G.nodes())),emoji_dict.values()))

nx.draw(G, edge_color='white', node_color='none', with_labels=True, labels=labels)
plt.show()

My question is, is there anyway to remove the contour of the node? Thanks a lot!

Add the node_shape attribute, which is specified like a matplotlib marker (see http://matplotlib.org/api/markers_api.html ).

You can just specify None for the attribute:

nx.draw(G, edge_color='white', node_color='none', with_labels=True, labels=labels, node_shape=None)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM