Skip to content
New issue

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

node_group not working in autographr() #11

Closed
jhollway opened this issue Nov 9, 2022 · 13 comments · Fixed by #22
Closed

node_group not working in autographr() #11

jhollway opened this issue Nov 9, 2022 · 13 comments · Fixed by #22
Assignees
Labels
bug Something isn't working

Comments

@jhollway
Copy link
Collaborator

jhollway commented Nov 9, 2022

Gives an anchors[[1]]: subscript out of bounds error.

@jhollway jhollway added the bug Something isn't working label Nov 9, 2022
@jhollway jhollway assigned jhollway and jaeltan and unassigned jhollway Nov 9, 2022
@jaeltan
Copy link
Contributor

jaeltan commented Nov 11, 2022

I'm not getting this error, but the groups weren't plotting correctly so I changed that

@jhollway
Copy link
Collaborator Author

Thanks @jaeltan, it is working better now. Still, the error persists and can be reproduced with:

autographr(ison_marvel_relationships, node_group = "PowerOrigin")

@jaeltan
Copy link
Contributor

jaeltan commented Nov 11, 2022

I just tried this and got a plot without any error https://app.zenhub.com/files/238751844/3d9f3646-ab07-4ccd-9a4f-cca0c4f7a392/download

@jhollway
Copy link
Collaborator Author

Can you try it @henriquesposito to see whether this is a Mac issue?

@henriquesposito
Copy link
Contributor

I get no errors on my side, I get the same plot as Jael...

@jhollway jhollway assigned henriquesposito and unassigned jaeltan Apr 21, 2023
@henriquesposito
Copy link
Contributor

I can reproduce the error and I think it might be related to the release version of {ggplot2} and/or {ggforce}; as well as the number of overlaps for groups in the data. I can remove the error using ggforce::geom_mark_hull(), but the "geom" still does not correctly "hull" over the groups. I can, however, make the groups work with ggforce::geom_mark_ellipse(). I have made the respective changes.

Please let me know what you think @jhollway .

Another alternative could be to require certain package versions in the description file. However, I am not sure how this will affect previous changes in argument names, for example, with the new versions of {ggplot2}.

@jhollway
Copy link
Collaborator Author

I'm travelling again, but can you please show here/on Slack what the differences would be visually between hulls and ellipses? What's at stake in the choice?

@henriquesposito
Copy link
Contributor

henriquesposito commented May 15, 2023

Running autographr(ison_marvel_relationships, node_group = "PowerOrigin") with a (semi)working (no messages or warnings but missing labels) version of the hull returns:

image.png

I have been able to make the function work better with the ellipses (below).

image.png

@jhollway please let me know what you think.

@jhollway
Copy link
Collaborator Author

Honestly, neither really looks all that helpful. Does the node_group = argument expect a character or numeric vector?

@henriquesposito
Copy link
Contributor

I understand, I will go back to it and try to find a better alternative.

"node_group" expects a variable in the data to be declared, it could be character or numeric, and the argument is treated as a factor.

@henriquesposito
Copy link
Contributor

I have been looking more into this issue and the fix might be more complicated then first taught (see https://github.com/thomasp85/ggforce/issues for this and other related issues).

Some alternatives to move forward (ordered by difficulty):

1- We could use a temporary fix for now (e.g. ellipses/polygons) and wait until the respective functions on {ggforce} are updated.

2- We can alter the layout when the 'node_group' argument is declared to improve community visualisation. For instance, we can use network backbones to better place nodes from the same community near(ish) each other (see http://blog.schochastics.net/post/ggraph-tricks-for-common-problems/ and http://blog.schochastics.net/post/introducing-graphlayouts-with-got/) and improve visuals. Though this way we might still have to handle issues with {ggforce} functions and/or perhaps rely on other packages/functions to visualise groups.

3- We can try and create our own custom "hull" function to visualise communities.

@jhollway please let me know what you think. Thank you.

@henriquesposito
Copy link
Contributor

I will suspend this functionality momentarily and go back to it when the issues in ggforce are solved.

@jhollway jhollway transferred this issue from stocnet/migraph Jul 20, 2023
@henriquesposito
Copy link
Contributor

This issue has been fixed by limiting the number of categories group variables can have when plotting with autographr(). This change should avoid that we run into limit issues for ggforce::geom_node_hull().

@jhollway jhollway mentioned this issue Oct 11, 2023
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants