We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding colour map to a divergent network crashes, but not for the same network if only positive or negative connections are used.
Command: edge_color = edges.edge_colors(et, nt=None, color_by='weight', node_color_by=None)
edge_color = edges.edge_colors(et, nt=None, color_by='weight', node_color_by=None)
Traceback:
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /var/folders/4v/g8pg_7r950bf7vtkg09mpc240000gn/T/ipykernel_9283/651244063.py in <module> ----> 1 edge_color = edges.edge_colors(et, nt=None, color_by='weight', node_color_by=None) ~/miniconda3/envs/analysis/lib/python3.9/site-packages/nxviz/edges.py in edge_colors(et, nt, color_by, node_color_by) 54 ) 55 elif color_by: ---> 56 return encodings.data_color(et[color_by], et[color_by]) 57 return pd.Series(["black"] * len(et), name="color_by") 58 ~/miniconda3/envs/analysis/lib/python3.9/site-packages/nxviz/encodings.py in data_color(data, ref_data) 121 """ 122 cfunc = color_func(ref_data) --> 123 return data.apply(cfunc) 124 125 ~/miniconda3/envs/analysis/lib/python3.9/site-packages/pandas/core/series.py in apply(self, func, convert_dtype, args, **kwargs) 4354 dtype: float64 4355 """ -> 4356 return SeriesApply(self, func, convert_dtype, args, kwargs).apply() 4357 4358 def _reduce( ~/miniconda3/envs/analysis/lib/python3.9/site-packages/pandas/core/apply.py in apply(self) 1034 return self.apply_str() 1035 -> 1036 return self.apply_standard() 1037 1038 def agg(self): ~/miniconda3/envs/analysis/lib/python3.9/site-packages/pandas/core/apply.py in apply_standard(self) 1090 # List[Union[Callable[..., Any], str]]]]]"; expected 1091 # "Callable[[Any], Any]" -> 1092 mapped = lib.map_infer( 1093 values, 1094 f, # type: ignore[arg-type] ~/miniconda3/envs/analysis/lib/python3.9/site-packages/pandas/_libs/lib.pyx in pandas._libs.lib.map_infer() ~/miniconda3/envs/analysis/lib/python3.9/site-packages/nxviz/encodings.py in discrete_color_func(val, cmap, data) 75 """ 76 colors = sorted(data.unique()) ---> 77 return cmap.colors[colors.index(val)] 78 79 AttributeError: 'LinearSegmentedColormap' object has no attribute 'colors'
Continuous connection weights (positive and negative alone) runs as expected.
The text was updated successfully, but these errors were encountered:
I think the problem is that divergent_color_func is defined but never called, so I made a small change that seems to solve the problem here: 4ec28c3
divergent_color_func
Let me know if this is likely the case and I can make a pull request
Sorry, something went wrong.
No branches or pull requests
Description
Adding colour map to a divergent network crashes, but not for the same network if only positive or negative connections are used.
What I Did
Command:
edge_color = edges.edge_colors(et, nt=None, color_by='weight', node_color_by=None)
Traceback:
Continuous connection weights (positive and negative alone) runs as expected.
The text was updated successfully, but these errors were encountered: