We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
element_color
We're currently not using the properties `element_name` and `element_color`. Is there a future use case for those?
Originally posted by @JanCBrammer in #81 (comment)
The text was updated successfully, but these errors were encountered:
Some quick and dirty code how to pass on element_color to nx.kamada_kawai_layout(G):
nx.kamada_kawai_layout(G)
node_color_list = [] for i in G: element_color = G.nodes.data('element_color')[i] if element_color == "lightgrey": element_color = "0xD3D3D3" color_code = '#'+element_color[2:] node_color_list.append(color_code) node_size = 1 / G.order() * 10000 options = { "with_labels": False, "font_size": 18, "node_size": node_size, "edgecolors": "black", "linewidths": 2, "width": 2, "node_color": node_color_list } positions = nx.kamada_kawai_layout(G) pos_attrs = {} for node, coords in positions.items(): pos_attrs[node] = (coords[0], coords[1]) node_attrs1 = nx.get_node_attributes(G, 'element_symbol') node_attrs2 = nx.get_node_attributes(G, 'atomic_number') custom_node_attrs1 = {} custom_node_attrs2 = {} for node, attr in node_attrs1.items(): custom_node_attrs1[node] = str(node) custom_node_attrs2[node] = attr for node, attr in node_attrs2.items(): custom_node_attrs2[node] = custom_node_attrs2[node]+"\n"+str(attr) nx.draw(G, positions, **options)
Sorry, something went wrong.
No branches or pull requests
Originally posted by @JanCBrammer in #81 (comment)
The text was updated successfully, but these errors were encountered: