Skip to content

Commit

Permalink
fix example bugs, close #22
Browse files Browse the repository at this point in the history
  • Loading branch information
benmaier committed May 15, 2019
1 parent 9deefab commit 66a5210
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
21 changes: 11 additions & 10 deletions docs/cookbook/groups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ Save as PDF

.. code:: python
import networkx as nx
import netwulf as wulf
G = nx.barabasi_albert_graph(100, 2)
network, config = wulf.visualize(G, plot_in_cell_below=False)
fig, ax = plt.subplots(figsize=(10, 10))
wulf.draw_netwulf(network, fig, ax)
plt.savefig("myfigure.pdf")
import networkx as nx
import netwulf as wulf
import matplotlib.pyplot as plt
G = nx.barabasi_albert_graph(100, 2)
network, config = wulf.visualize(G, plot_in_cell_below=False)
fig, ax = plt.subplots(figsize=(10, 10))
wulf.draw_netwulf(network, fig, ax)
plt.savefig("myfigure.pdf")
8 changes: 4 additions & 4 deletions docs/python_api/network_manipulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ will be grouped and colored in the visualization. Here's an example
G[u][v]['foo'] = np.random.rand()
G[u][v]['bar'] = np.random.rand()
# assign node attributes according to some generic grouping
grp = {u: 'ABCDE'[u%5] for u in G.nodes() }
nx.set_node_attributes(G, grp, 'wum')
# filter the Graph to visualize one where the weight is determined by 'foo'
new_G = wulf.get_filtered_network(G,edge_weight_key='foo')
wulf.visualize(new_G)
# assign node attributes according to some generic grouping
grp = {u: 'ABCDE'[u%5] for u in G.nodes() }
nx.set_node_attributes(G, grp, 'wum')
# filter the Graph to visualize one where the weight is determined by 'bar'
# and the node group (coloring) is determined by the node attribute 'wum'
new_G = wulf.get_filtered_network(G,edge_weight_key='bar',node_group_key='wum')
Expand Down

0 comments on commit 66a5210

Please sign in to comment.