How to use the nxviz.ArcPlot function in nxviz

To help you get started, we’ve selected a few nxviz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ericmjl / nxviz / tests / test_plots.py View on Github external
def test_edge_color():
    # add color as attribute and fill with random numbers
    edges = G.edges()
    for u, v in edges:
        G[u][v]["type"] = "a" if random() < 0.5 else "b"
    # also extract list for testing
    types = [G[u][v]["type"] for u, v in edges]
    # add color as property
    c = CircosPlot(G, edge_color="type")
    assert corresponding_lists(c.edge_colors, types)
    a = ArcPlot(G, edge_color="type")
    assert corresponding_lists(a.edge_colors, types)
github ericmjl / nxviz / tests / test_plots.py View on Github external
def test_node_size():
    # add size as attribute and fill with random numbers
    nodes = G.nodes()
    for u in nodes:
        G.nodes[u]["score"] = random()
    # also extract list for testing
    scores = [G.nodes[u]["score"] for u in nodes]
    # add color as property
    a = ArcPlot(G, node_size="score")
    assert a.node_sizes == scores
    # add types as list
    a = ArcPlot(G, node_size=scores)
    assert a.node_sizes == scores
github ericmjl / nxviz / tests / test_plots.py View on Github external
def test_arc_plot():
    a = ArcPlot(G)  # noqa: F841
    diff = diff_plots(a, "arc.png", baseline_dir, result_dir)
    assert diff is None
github ericmjl / nxviz / tests / test_plots.py View on Github external
def test_edge_widths():
    # add weight as attribute and fill with random numbers
    edges = G.edges()
    for u, v in edges:
        G[u][v]["weight"] = random()
    # also extract list for testing
    weights = [G[u][v]["weight"] for u, v in edges]
    # add weights as property
    c = CircosPlot(G, edge_width="weight")
    assert c.edge_widths == weights
    a = ArcPlot(G, edge_width="weight")
    assert a.edge_widths == weights
    # add weights as list
    c = CircosPlot(G, edge_width=weights)
    assert c.edge_widths == weights
    a = ArcPlot(G, edge_width=weights)
    assert a.edge_widths == weights
github AmoDinho / datacamp-python-data-science-track / Network Analysis in Python (Part 1) / Chapter 1 - Introduction to networks.py View on Github external
#Visualizing using Arc plots
# Import necessary modules
import matplotlib.pyplot as plt
from nxviz import ArcPlot

# Create the un-customized ArcPlot object: a
a = ArcPlot(T)

# Draw a to the screen
a.draw()

# Display the plot
plt.show()

# Create the customized ArcPlot object: a2
a2 = ArcPlot(T, node_order='category', node_color='category')

# Draw a2 to the screen
a2.draw()

# Display the plot
plt.show()
github AmoDinho / datacamp-python-data-science-track / Network Analysis in Python (Part 1) / Chapter 1 - Introduction to networks.py View on Github external
c.draw()

# Display the plot
plt.show()

#---------=======================================================--------------%



#Visualizing using Arc plots
# Import necessary modules
import matplotlib.pyplot as plt
from nxviz import ArcPlot

# Create the un-customized ArcPlot object: a
a = ArcPlot(T)

# Draw a to the screen
a.draw()

# Display the plot
plt.show()

# Create the customized ArcPlot object: a2
a2 = ArcPlot(T, node_order='category', node_color='category')

# Draw a2 to the screen
a2.draw()

# Display the plot
plt.show()