-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
how to repel boxes correctly? using ggrepel:::repel_boxes() #172
Comments
Could I ask if you might be willing to make a reproducible example? |
Thank you for your answer. Sure
Zoom in, origins placed correctly but not the repelled part I would need to know how to tune the arguments of the repel_boxes function to get the circles separated, I tried the force argument from 0.1 to 8000 and it's not working, and even tried other arguments. Please tell me if you need more information. |
Yes, we need more information in order to help you. Specifically, please consider sharing a snippet of code with a reproducible example that we can run on our own machines. |
This a problem I need to separate into parts, so I post the first part (reprex). The questions are:
|
Please consider providing code that someone else can run on their own machine. |
nz and nz_heigth are part of package spData, and the functions are part of the listed packages. |
I had to install these packages from GitHub before I could run the first chunk of code: install.packages("spDataLarge", repos = "https://nowosad.github.io/drat/", type = "source")
devtools::install_github("yutannihilation/ggsflabel") Could you please provide a When I try to run the first chunk of code: ggplot() +
geom_sf(data = nz, aes(color = Name)) +
geom_sf(data = nz_height) +
geom_sf_text_repel(data = nz_height, aes(label = elevation), min.segment.length = 0) +
coord_sf(datum = st_crs(nz_height)) +
theme(
legend.position = "none"
) This is what I get:
The error goes away when I comment out I'm not sure where the error is coming from... maybe from ggrepel, or maybe from ggsflabel? Here's my session info: devtools::session_info()> devtools::session_info() ─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────── setting value version R version 4.0.2 (2020-06-22) os macOS Catalina 10.15.7 system x86_64, darwin17.0 ui RStudio language (EN) collate en_US.UTF-8 ctype en_US.UTF-8 tz America/New_York date 2020-10-24 ─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────── package * version date lib source abind 1.4-5 2016-07-21 [1] CRAN (R 4.0.2) assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.2) backports 1.1.10 2020-09-15 [1] CRAN (R 4.0.2) base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.0.2) blob 1.2.1 2020-01-20 [1] CRAN (R 4.0.2) broom 0.7.0 2020-07-09 [1] CRAN (R 4.0.2) callr 3.5.1 2020-10-13 [1] CRAN (R 4.0.2) cellranger 1.1.0 2016-07-27 [1] CRAN (R 4.0.2) class 7.3-17 2020-04-26 [1] CRAN (R 4.0.2) classInt 0.4-3 2020-04-07 [1] CRAN (R 4.0.2) cli 2.1.0 2020-10-12 [1] CRAN (R 4.0.2) codetools 0.2-16 2018-12-24 [1] CRAN (R 4.0.2) colorspace 1.4-1 2019-03-18 [1] CRAN (R 4.0.2) crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.2) crosstalk 1.1.0.1 2020-03-13 [1] CRAN (R 4.0.2) DBI 1.1.0 2019-12-15 [1] CRAN (R 4.0.2) dbplyr 1.4.4 2020-05-27 [1] CRAN (R 4.0.2) desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.2) devtools 2.3.0 2020-04-10 [1] CRAN (R 4.0.2) dichromat 2.0-0 2013-01-24 [1] CRAN (R 4.0.2) digest 0.6.26 2020-10-17 [1] CRAN (R 4.0.2) dplyr * 1.0.0 2020-05-29 [1] CRAN (R 4.0.2) e1071 1.7-4 2020-10-14 [1] CRAN (R 4.0.2) ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.2) fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.2) farver 2.0.3 2020-01-16 [1] CRAN (R 4.0.2) forcats * 0.5.0 2020-03-01 [1] CRAN (R 4.0.2) fs 1.4.2 2020-06-30 [1] CRAN (R 4.0.2) generics 0.0.2 2018-11-29 [1] CRAN (R 4.0.2) ggplot2 * 3.3.2.9000 2020-07-17 [1] Github (tidyverse/ggplot2@a3019f9) ggrepel * 0.8.2 2020-03-08 [1] CRAN (R 4.0.2) ggsflabel * 0.0.1 2020-10-24 [1] Github (yutannihilation/ggsflabel@a489481) glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2) gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.2) haven 2.3.1 2020-06-01 [1] CRAN (R 4.0.2) hms 0.5.3 2020-01-08 [1] CRAN (R 4.0.2) htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.0.2) htmlwidgets 1.5.1 2019-10-08 [1] CRAN (R 4.0.2) httr 1.4.1 2019-08-05 [1] CRAN (R 4.0.1) jsonlite 1.7.0 2020-06-25 [1] CRAN (R 4.0.2) KernSmooth 2.23-17 2020-04-26 [1] CRAN (R 4.0.2) knitr * 1.29 2020-06-23 [1] CRAN (R 4.0.2) lattice 0.20-41 2020-04-02 [1] CRAN (R 4.0.2) leafem 0.1.3 2020-07-26 [1] CRAN (R 4.0.2) leaflet 2.0.3 2019-11-16 [1] CRAN (R 4.0.2) leafsync 0.1.0 2019-03-05 [1] CRAN (R 4.0.2) lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.2) lubridate 1.7.9 2020-06-08 [1] CRAN (R 4.0.2) lwgeom 0.2-5 2020-06-12 [1] CRAN (R 4.0.2) magrittr 1.5.0.9000 2020-09-11 [1] Github (tidyverse/magrittr@15f6f07) memoise 1.1.0.9000 2020-07-17 [1] Github (r-lib/memoise@4aefd9f) modelr 0.1.8 2020-05-19 [1] CRAN (R 4.0.2) munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.2) packrat 0.5.0 2018-11-14 [1] CRAN (R 4.0.2) pillar 1.4.6 2020-07-10 [1] CRAN (R 4.0.2) pkgbuild 1.1.0 2020-07-13 [1] CRAN (R 4.0.2) pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.2) pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.2) png 0.1-7 2013-12-03 [1] CRAN (R 4.0.2) prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.2) processx 3.4.4 2020-09-03 [1] CRAN (R 4.0.2) ps 1.4.0 2020-10-07 [1] CRAN (R 4.0.2) purrr * 0.3.4 2020-04-17 [1] CRAN (R 4.0.2) R6 2.4.1 2019-11-12 [1] CRAN (R 4.0.2) raster * 3.3-13 2020-07-17 [1] CRAN (R 4.0.2) RColorBrewer 1.1-2 2014-12-07 [1] CRAN (R 4.0.2) Rcpp 1.0.5.1 2020-07-17 [1] Github (RcppCore/Rcpp@85f6b27) readr * 1.3.1 2018-12-21 [1] CRAN (R 4.0.2) readxl 1.3.1 2019-03-13 [1] CRAN (R 4.0.2) remotes 2.1.1 2020-02-15 [1] CRAN (R 4.0.2) reprex 0.3.0 2019-05-16 [1] CRAN (R 4.0.2) rlang 0.4.8 2020-10-08 [1] CRAN (R 4.0.2) rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.0.2) rstudioapi 0.11 2020-02-07 [1] CRAN (R 4.0.2) rvest 0.3.5 2019-11-08 [1] CRAN (R 4.0.1) scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.2) sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.2) sf * 0.9-6 2020-09-13 [1] CRAN (R 4.0.2) sp * 1.4-2 2020-05-20 [1] CRAN (R 4.0.2) spData * 0.3.8 2020-07-03 [1] CRAN (R 4.0.2) spDataLarge * 0.5.0 2020-10-24 [1] local stars 0.4-3 2020-07-08 [1] CRAN (R 4.0.2) stringi 1.4.6 2020-02-17 [1] CRAN (R 4.0.2) stringr * 1.4.0 2019-02-10 [1] CRAN (R 4.0.2) testthat 2.3.2 2020-03-02 [1] CRAN (R 4.0.2) tibble * 3.0.4 2020-10-12 [1] CRAN (R 4.0.2) tidyr * 1.1.0 2020-05-20 [1] CRAN (R 4.0.2) tidyselect 1.1.0 2020-05-11 [1] CRAN (R 4.0.2) tidyverse * 1.3.0 2019-11-21 [1] CRAN (R 4.0.2) tmap * 3.2 2020-09-15 [1] CRAN (R 4.0.2) tmaptools * 3.1 2020-07-01 [1] CRAN (R 4.0.2) units 0.6-7 2020-06-13 [1] CRAN (R 4.0.2) usethis 1.6.1 2020-04-29 [1] CRAN (R 4.0.2) vctrs 0.3.4 2020-08-29 [1] CRAN (R 4.0.2) viridisLite 0.3.0 2018-02-01 [1] CRAN (R 4.0.1) withr 2.3.0 2020-09-22 [1] CRAN (R 4.0.2) xfun 0.15 2020-06-21 [1] CRAN (R 4.0.2) XML 3.99-0.4 2020-07-05 [1] CRAN (R 4.0.2) xml2 1.3.2 2020-04-23 [1] CRAN (R 4.0.2) [1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library |
Here's my session info:
|
I am using ggrepel:::repel_boxes() within this function (copied from another post), but I don't know how to set the parameters correctly, and I haven't detailed documentation for me to understand the function.
The text was updated successfully, but these errors were encountered: