From ca816e24c87c3a56333fd026575ad5b4d0502b46 Mon Sep 17 00:00:00 2001 From: jimixxperez Date: Wed, 30 Sep 2020 14:00:04 +0200 Subject: [PATCH] fixed nodelist and edgelist reference problem a = pd.DataFrame([{'a': 1, 'c': 0}, {'a': 2, 'c': 2}, {'a': 3, 'c': 5}]) b = a b = b.loc[[0, 2]] b => a c 0 1 0 2 3 5 a => a c 0 1 0 1 2 2 2 3 5 --- nx_altair/draw_altair.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nx_altair/draw_altair.py b/nx_altair/draw_altair.py index 0fb054a..81561a8 100644 --- a/nx_altair/draw_altair.py +++ b/nx_altair/draw_altair.py @@ -73,7 +73,7 @@ def draw_networkx_edges( ###### node list argument if isinstance(edgelist, list): # Subset dataframe. - df_edges = df_edges.loc[df_edges['pair'].isin(edgelist)] + df_edges = edge_chart.data = df_edges.loc[df_edges['pair'].isin(edgelist)] elif edgelist is not None: raise Exception("nodelist must be a list or None.") @@ -210,7 +210,7 @@ def draw_networkx_arrows( ###### node list argument if isinstance(edgelist, list): # Subset dataframe. - df_edge_arrows = df_edge_arrows.loc[df_edge_arrows['pair'].isin(edgelist)] + df_edge_arrows = edge_chart.data = df_edge_arrows.loc[df_edge_arrows['pair'].isin(edgelist)] elif edgelist is not None: raise Exception("nodelist must be a list or None.") @@ -359,7 +359,7 @@ def draw_networkx_nodes( ###### node list argument if isinstance(nodelist, list): # Subset dataframe. - df_nodes = df_nodes.loc[nodelist] + df_nodes = node_chart.data = df_nodes.loc[nodelist] elif nodelist is not None: raise Exception("nodelist must be a list or None.") @@ -492,7 +492,7 @@ def draw_networkx_labels( ###### node list argument if isinstance(nodelist, list): # Subset dataframe. - df_nodes = df_nodes.loc[nodelist] + df_nodes = node_chart.data = df_nodes.loc[nodelist] elif nodelist is not None: raise Exception("nodelist must be a list or None.")