Skip to content

Commit

Permalink
fix naming inconsistency in draw()
Browse files Browse the repository at this point in the history
  • Loading branch information
nwlandry committed Aug 7, 2022
1 parent 8a88b3d commit 43ffb28
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 32 deletions.
15 changes: 0 additions & 15 deletions tutorials/Tutorial 5 - Plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -244,21 +244,6 @@
"We can even size/color the nodes by their degree!"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d741e39e",
"metadata": {},
"outputs": [],
"source": [
"d = H.nodes.degree\n",
"s = 10\n",
"node_size = {id: np.sqrt((val+1)*s) for id, val in d.asdict().items()}\n",
"c = plt.cm.Blues\n",
"cmap = [c(i) for i in np.linspace(0.1, 0.9, d.max() + 1)]\n",
"node_fc = {id: np.array(cmap[val]).reshape(1, -1) for id, val in d.asdict().items()}"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
19 changes: 6 additions & 13 deletions tutorials/quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@
"outputs": [],
"source": [
"#Sequential colormap\n",
"cmap = cm.Blues\n",
"cmap = cm.Paired\n",
"\n",
"xgi.draw(H_viz, pos4, cmap=cmap)"
"xgi.draw(H_viz, pos4, edge_fc_cmap=cmap)"
]
},
{
Expand All @@ -348,14 +348,14 @@
"outputs": [],
"source": [
"cmap = cm.Reds\n",
"edge_lc = 'gray'\n",
"edge_lw = 4\n",
"dyad_lc = 'gray'\n",
"dyad_lw = 4\n",
"node_fc = 'black'\n",
"node_ec = 'white'\n",
"node_lw = 2\n",
"node_size = 0.05\n",
"node_size = 20\n",
"\n",
"xgi.draw(H_viz, pos4, cmap=cmap, edge_lc=edge_lc, edge_lw=edge_lw,\n",
"xgi.draw(H_viz, pos4, edge_fc_cmap=cmap, dyad_lc=dyad_lc, dyad_lw=dyad_lw,\n",
" node_fc=node_fc, node_ec=node_ec, node_lw=node_lw, node_size=node_size)"
]
},
Expand Down Expand Up @@ -671,13 +671,6 @@
"source": [
"# For more details, visit https://xgi.readthedocs.io"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
8 changes: 4 additions & 4 deletions xgi/drawing/xgi_pylab.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def draw(
* min_node_lw
* max_node_lw
* node_fc_cmap
* node_lc_cmap
* node_ec_cmap
* edge_fc_cmap
* dyad_color_cmap
Expand All @@ -107,7 +107,7 @@ def draw(
"min_node_lw": 1,
"max_node_lw": 5,
"node_fc_cmap": cm.Reds,
"node_lc_cmap": cm.Greys,
"node_ec_cmap": cm.Greys,
"edge_fc_cmap": cm.Blues,
"dyad_color_cmap": cm.Greys,
}
Expand Down Expand Up @@ -184,15 +184,15 @@ def draw_xgi_nodes(
settings : dict
Default parameters. Keys that may be useful to override default settings:
* node_fc_cmap
* node_lc_cmap
* node_ec_cmap
* min_node_lw
* max_node_lw
* min_node_size
* max_node_size
"""
# Note Iterable covers lists, tuples, ranges, generators, np.ndarrays, etc
node_fc = _color_arg_to_dict(node_fc, H.nodes, settings["node_fc_cmap"])
node_ec = _color_arg_to_dict(node_ec, H.nodes, settings["node_lc_cmap"])
node_ec = _color_arg_to_dict(node_ec, H.nodes, settings["node_ec_cmap"])
node_lw = _scalar_arg_to_dict(
node_lw,
H.nodes,
Expand Down

0 comments on commit 43ffb28

Please sign in to comment.