Skip to content

Customize node size and colormap in circosplot #690

@ViniciusLima94

Description

@ViniciusLima94
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions