-
Notifications
You must be signed in to change notification settings - Fork 105
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
geom_mark_hull error when one group contains two or less points #320
Comments
After playing with the data even more I think I was able to narrow down the problem and reproduce it on dummy data. Whenever a group includes two or less data points the error (Error in anchors[[i]] : subscript out of bounds) occurs. And I think it has something to do with label placement, as without labelling, a hull was drawn around the group with two points. Yet the graph still remains incomplete as is demonstrated with the code below. Is there a way to fix this or work around? I do not need the labels in the plot as a nice legend is produced either way. But I have not found a way to simply switch off the labelling and have all the hulls created.
|
I think this is fixed in the development version. Can I get you to test that out? |
Thanks for the recommendation. I will test it. At the moment I get an error when trying to install the development version using
Something including a lot of I am trying to update R and then I will try again. |
I tried the very same code with the developmental version and the newest R version (4.3.3) and it worked without any problems! Thank you so much! |
Hello,
EDIT: in the first comment there is a better reproducable example.
I am using ggplot2 with the packages ggforce (geom_mark_hull) and ggrepel (geom_text_repel) to plot the results of my NMDS analysis (vegan). I have managed a 1) nice plot with one set of variables, yet 2) choosing another variable to base the hulls on, it was not possible but returned a (for me) cryptic error. I have checked the class of the variables, it's the same (character) and 3) played around with many options of geom_mark_hull, nothing helped. I created a small subset of my data (provided below), still the same error. Also I created 4) mock_data and tried to reproduce the error but I couldn't. Which is good, so the code works really well. But I also couldn't find out what is wrong with my data or what to do to resolve the error.
Running the above piece of code the error appears when I want to see the plot with the last line. The error is this: "Error in anchors[[i]] : subscript out of bounds"
The one thing I found to have a plot created at all (and without any error message) was to set
label = NULL
in the aes of geom_mark_hull. But this resulted in a plot where only the first of three hulls was drawn. If I reversed the order of my groups, all but the first hulls were drawn.Recreating such a plot with made up data worked fine as well. I am very puzzled what this error message means, I tried to make sense of it by looking at source code "mark_hull.R" here on github. But this is beyond my level of understanding and I was not able to find where this error message was pointing to.
I would appreciate any help to figure this out.
The text was updated successfully, but these errors were encountered: