diff --git a/examples/figures/showcase.png b/examples/figures/showcase.png index 77911ad..7950d21 100644 Binary files a/examples/figures/showcase.png and b/examples/figures/showcase.png differ diff --git a/examples/showcase_image.py b/examples/showcase_image.py index ee67468..1063a45 100644 --- a/examples/showcase_image.py +++ b/examples/showcase_image.py @@ -232,7 +232,7 @@ nodecmap='Dark2', nodecolor='yeo7networks', nodealpha = 0.8, - subtitle = 'Highlight a community', + subtitles = 'Highlight a community', highlightnodes={'yeo7networks': 'Cont'}, highlightlevel=0.95, fig=fig, ax=ax, diff --git a/netplotbrain/__version.py b/netplotbrain/__version.py index 7929a80..d3ec452 100644 --- a/netplotbrain/__version.py +++ b/netplotbrain/__version.py @@ -1 +1 @@ -__version__ = "0.2.0-alpha7" +__version__ = "0.2.0" diff --git a/netplotbrain/plot.py b/netplotbrain/plot.py index 6ebe082..d75dd73 100644 --- a/netplotbrain/plot.py +++ b/netplotbrain/plot.py @@ -190,7 +190,7 @@ def plot(nodes=None, fig: Optional[plt.Figure] = None, ax=None, view: str = 'L', hemisphere=hemi_frame, azim=azim[fi], elev=elev[fi], **profile) - + # Template voxels will have origin at 0,0,0 # It is easier to scale the nodes from the image affine # Then to rescale the ax.voxels function diff --git a/netplotbrain/plotting/plot_parcels.py b/netplotbrain/plotting/plot_parcels.py index 840891f..6e8f1b8 100644 --- a/netplotbrain/plotting/plot_parcels.py +++ b/netplotbrain/plotting/plot_parcels.py @@ -59,9 +59,9 @@ def _get_nodes_from_nii(img, nodes=None, voxsize=None, template=None): z_coord = [] for r in rois: allcoords = np.where(imgdata == r) - x_coord.append(np.median(allcoords[0])) - y_coord.append(np.median(allcoords[1])) - z_coord.append(np.median(allcoords[2])) + x_coord.append(np.mean(allcoords[0])) + y_coord.append(np.mean(allcoords[1])) + z_coord.append(np.mean(allcoords[2])) # If nodes is None, define the dataframe if nodes is None: diff --git a/netplotbrain/utils/coloring.py b/netplotbrain/utils/coloring.py index 0138ab1..10bc865 100644 --- a/netplotbrain/utils/coloring.py +++ b/netplotbrain/utils/coloring.py @@ -37,7 +37,7 @@ def _highlight_nodes(nodes, nodecolor, highlightnodes, **kwargs): elif isinstance(highlightnodes, str): if highlightnodes not in nodes: raise ValueError('If highlightnodes is a str it must be a column in nodes') - highlightnodes = nodes[highlightnodes].values() + highlight_idx = nodes[highlightnodes].values else: highlight_idx = np.zeros(len(nodes)) highlight_idx[highlightnodes] = 1 @@ -127,6 +127,7 @@ def _get_colorby_colors(df, colorby, datatype='node', **kwargs): # Get relevant kwargs cmap = kwargs.get(datatype + 'cmap') color_vminvmax = kwargs.get(datatype + 'colorvminvmax') + #TODO: Add flag if colours are in column colortype = _detect_coloring_type(df, colorby) cmap = cm.get_cmap(cmap) if colortype == 'discrete': diff --git a/tests/baseline/test_edges_df.png b/tests/baseline/test_edges_df.png index c6518b2..3d5f31e 100644 Binary files a/tests/baseline/test_edges_df.png and b/tests/baseline/test_edges_df.png differ diff --git a/tests/baseline/test_highlightedges_df.png b/tests/baseline/test_highlightedges_df.png index 6b85513..16a5e8b 100644 Binary files a/tests/baseline/test_highlightedges_df.png and b/tests/baseline/test_highlightedges_df.png differ diff --git a/tests/baseline/test_highlightedges_np.png b/tests/baseline/test_highlightedges_np.png index 1e19e4d..6b5c588 100644 Binary files a/tests/baseline/test_highlightedges_np.png and b/tests/baseline/test_highlightedges_np.png differ diff --git a/tests/baseline/test_printlayout.png b/tests/baseline/test_printlayout.png index 36cd63f..2c44166 100644 Binary files a/tests/baseline/test_printlayout.png and b/tests/baseline/test_printlayout.png differ