Skip to content
New issue

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

Customize node size and colormap in circosplot #690

Open
ViniciusLima94 opened this issue Jul 13, 2022 · 0 comments
Open

Customize node size and colormap in circosplot #690

ViniciusLima94 opened this issue Jul 13, 2022 · 0 comments

Comments

@ViniciusLima94
Copy link

  • nxviz version: 0.6.2
  • Python version: 3.8.8
  • Operating System: Linux/Ubuntu

Description

I'm trying to change the node size according to an attribute of my NetworkX object but even if I set node_size="attribute", the size remains invariant.

Also, I would like to change the colormaps for edge/node attributes, but I don't see how to do it.

What I Did

# Creating a graph
G = nx.from_numpy_matrix(adj)

# Removing self-loops
G.remove_edges_from(list(nx.selfloop_edges(G)))

nx.set_node_attributes(G, dict(G.degree(weight="weight")), "strength")

nx.set_node_attributes(G, Convert(list(np.stack(node_sizes))), "size")

nx.set_node_attributes(G, colors, "color")


G = nx.relabel_nodes(G, dict(zip(range(len(nodes)), list(nodes))))

circ = CircosPlot(
    G,
    node_labels=True,
    figsize=(10, 10),
    edge_color="weight",
    edge_width="weight",
    node_color="size",
    node_label_layout="rotation",
    fontsize=12,
    node_palette=colors,
    group_legend=False,
)
circ.draw()

circ.sm.colorbar.remove()

This is the piece of code I'm using to plot.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant