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

Allow 'jitter' for position argument in geom_sf #2332

Closed
rlionheart92 opened this issue Nov 9, 2017 · 1 comment
Closed

Allow 'jitter' for position argument in geom_sf #2332

rlionheart92 opened this issue Nov 9, 2017 · 1 comment

Comments

@rlionheart92
Copy link

Would it be possible to find add to allow 'jitter' for the position argument on geom_sf, specifically for
points.

I have been working on a data set, where I am attempting to show the position and quality rating of different medical centres over a geographic map. Some of the centres share the same address, and therefore the points overlap. A slight jitter to the position of the points would be helpful in this case. I could potentially imagine other use cases where this might be of additional use.

When I try using the argument it returns the following error:

map %>% 
+   ggplot() + 
+   geom_sf() +
+   geom_sf(data = ratings, aes(colour = overallRating),
+           position = 'jitter')

#> Error: position_jitter requires the following missing aesthetics: x, y
#> In addition: Warning messages:
#>  1: In min(x, na.rm = na.rm) :
#>  no non-missing arguments to min; returning Inf
#> 2: In max(x, na.rm = na.rm) :
#>   no non-missing arguments to max; returning -Inf
#> 3: In min(diff(sort(x))) : no non-missing arguments to min; returning Inf
#> 4: In min(x, na.rm = na.rm) :
#>   no non-missing arguments to min; returning Inf
#> 5: In max(x, na.rm = na.rm) :
#>   no non-missing arguments to max; returning -Inf
#> 6: In min(diff(sort(x))) : no non-missing arguments to min; returning Inf
@hadley
Copy link
Member

hadley commented Nov 10, 2017

Unfortunately this is out of scope for geom_sf() support. You'll need to manually jitter the points.

@hadley hadley closed this as completed Nov 10, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants