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

Issue with facetted plots #70

Closed
pcroteau opened this issue Mar 7, 2017 · 3 comments
Closed

Issue with facetted plots #70

pcroteau opened this issue Mar 7, 2017 · 3 comments
Labels
bug

Comments

@pcroteau
Copy link

@pcroteau pcroteau commented Mar 7, 2017

First, let me thank you for this awesome package. I use it quite a lot since I found out about it.

I seem however to have stumbled upon a bug that occurs when one wants to label only some points of a given facet of a facetted graph.

Here's some fake data to illustrate the problem:

set.seed(1234)
dtf <- data.frame(y=rnorm(4), x=rnorm(4), g=gl(2,2), lb = letters[1:4], stringsAsFactors = F)

dtf2 <- dtf
dtf2$lb[3] <- ""

dtf3 <- dtf2
dtf3$lb[4] <- ""

Now, the following works well for both geom_text and geom_text_repel:

library(ggrepel)
ggplot(dtf, aes(x,y,label=lb)) + facet_wrap(~g) + geom_point() + geom_text()
ggplot(dtf, aes(x,y,label=lb)) + facet_wrap(~g) + geom_point() + geom_text_repel()

It works well with both dtf and dtf2. Below I report the geom_text_repel version with dtf.
image

However, for dtf3, geom_text work well while I get the following error with geom_text_repel:

Error in repel_boxes(data_points = cbind(x$data$x, x$data$y), point_padding_x = point_padding_x,  : 
  not compatible with requested type
@slowkow
Copy link
Owner

@slowkow slowkow commented Mar 7, 2017

Thanks for reporting this bug with the code snippet and the figure!

I'd be happy to review a pull request that fixes this bug. Otherwise, I'll have to come back to this issue when time allows.

slowkow added a commit that referenced this issue Mar 7, 2017
Addresses issue #70.
@slowkow slowkow removed the help wanted label Mar 7, 2017
@slowkow
Copy link
Owner

@slowkow slowkow commented Mar 7, 2017

@pcroteau The issue should be fixed in 0.6.9

Try re-installing the latest version and please re-open this issue if you run into any problems.

devtools::install_github("slowkow/ggrepel")

Thanks again for reporting this bug!

@slowkow slowkow closed this Mar 7, 2017
@pcroteau
Copy link
Author

@pcroteau pcroteau commented Mar 7, 2017

The fix seems to have do the trick.
Thanks a lot for the quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.