From 43ffb28bea65012e4d020b78b001ceb7243cf3f9 Mon Sep 17 00:00:00 2001 From: nwlandry Date: Sun, 7 Aug 2022 12:12:10 -0400 Subject: [PATCH] fix naming inconsistency in draw() --- tutorials/Tutorial 5 - Plotting.ipynb | 15 --------------- tutorials/quickstart.ipynb | 19 ++++++------------- xgi/drawing/xgi_pylab.py | 8 ++++---- 3 files changed, 10 insertions(+), 32 deletions(-) diff --git a/tutorials/Tutorial 5 - Plotting.ipynb b/tutorials/Tutorial 5 - Plotting.ipynb index 04e51f406..ec7eded9a 100644 --- a/tutorials/Tutorial 5 - Plotting.ipynb +++ b/tutorials/Tutorial 5 - Plotting.ipynb @@ -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, diff --git a/tutorials/quickstart.ipynb b/tutorials/quickstart.ipynb index c797acb05..eb7c8a3ba 100644 --- a/tutorials/quickstart.ipynb +++ b/tutorials/quickstart.ipynb @@ -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)" ] }, { @@ -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)" ] }, @@ -671,13 +671,6 @@ "source": [ "# For more details, visit https://xgi.readthedocs.io" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/xgi/drawing/xgi_pylab.py b/xgi/drawing/xgi_pylab.py index 6cade17c0..2472687e9 100644 --- a/xgi/drawing/xgi_pylab.py +++ b/xgi/drawing/xgi_pylab.py @@ -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 @@ -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, } @@ -184,7 +184,7 @@ 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 @@ -192,7 +192,7 @@ def draw_xgi_nodes( """ # 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,