Hi
I had a user report this issue lazappi/clustree#36. After looking into it a bit a think it might be a problem with ggraph.
Here is a reprex with an example from one of the vignettes.
library(ggraph)
#> Loading required package: ggplot2
library(tidygraph)
#>
#> Attaching package: 'tidygraph'
#> The following object is masked from 'package:stats':
#>
#> filter
set_graph_style(plot_margin = margin(1,1,1,1))
graph <- as_tbl_graph(highschool)
# Not specifying the layout - defaults to "auto"
plot <- ggraph(graph) +
geom_edge_link(aes(colour = factor(year))) +
geom_node_point()
#> Using `nicely` as default layout
plot

That works fine but if we set options(stringsAsFactors = FALSE) first there is an error when rendering the plot.
options(stringsAsFactors = FALSE)
plot
#> Error in pathAttr(data, length(unique(data$group))): Not compatible with requested type: [type=character; target=integer].
I'm guessing somewhere something that should be a factor isn't (probably related to the edge colour) but I'm not sure where.
sessioninfo::session_info()
#> ─ Session info ──────────────────────────────────────────────────────────
#> setting value
#> version R version 3.6.0 (2019-04-26)
#> os macOS Sierra 10.12.6
#> system x86_64, darwin15.6.0
#> ui X11
#> language (EN)
#> collate en_AU.UTF-8
#> ctype en_AU.UTF-8
#> tz Australia/Melbourne
#> date 2019-08-15
#>
#> ─ Packages ──────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [2] CRAN (R 3.6.0)
#> cli 1.1.0 2019-03-19 [2] CRAN (R 3.6.0)
#> colorspace 1.4-1 2019-03-18 [2] CRAN (R 3.6.0)
#> crayon 1.3.4 2017-09-16 [2] CRAN (R 3.6.0)
#> digest 0.6.20 2019-07-04 [2] CRAN (R 3.6.0)
#> dplyr 0.8.3 2019-07-04 [2] CRAN (R 3.6.0)
#> evaluate 0.14 2019-05-28 [2] CRAN (R 3.6.0)
#> farver 1.1.0 2018-11-20 [2] CRAN (R 3.6.0)
#> ggforce 0.3.0 2019-08-09 [2] CRAN (R 3.6.0)
#> ggplot2 * 3.2.1 2019-08-10 [2] CRAN (R 3.6.0)
#> ggraph * 1.0.2 2018-07-07 [2] CRAN (R 3.6.0)
#> ggrepel 0.8.1 2019-05-07 [2] CRAN (R 3.6.0)
#> glue 1.3.1 2019-03-12 [2] CRAN (R 3.6.0)
#> gridExtra 2.3 2017-09-09 [2] CRAN (R 3.6.0)
#> gtable 0.3.0 2019-03-25 [2] CRAN (R 3.6.0)
#> highr 0.8 2019-03-20 [2] CRAN (R 3.6.0)
#> htmltools 0.3.6 2017-04-28 [2] CRAN (R 3.6.0)
#> igraph 1.2.4.1 2019-04-22 [2] CRAN (R 3.6.0)
#> knitr 1.24 2019-08-08 [2] CRAN (R 3.6.0)
#> labeling 0.3 2014-08-23 [2] CRAN (R 3.6.0)
#> lazyeval 0.2.2 2019-03-15 [2] CRAN (R 3.6.0)
#> magrittr 1.5 2014-11-22 [2] CRAN (R 3.6.0)
#> MASS 7.3-51.4 2019-03-31 [2] CRAN (R 3.6.0)
#> munsell 0.5.0 2018-06-12 [2] CRAN (R 3.6.0)
#> pillar 1.4.2 2019-06-29 [2] CRAN (R 3.6.0)
#> pkgconfig 2.0.2 2018-08-16 [2] CRAN (R 3.6.0)
#> plyr 1.8.4 2016-06-08 [2] CRAN (R 3.6.0)
#> polyclip 1.10-0 2019-03-14 [2] CRAN (R 3.6.0)
#> purrr 0.3.2 2019-03-15 [2] CRAN (R 3.6.0)
#> R6 2.4.0 2019-02-14 [2] CRAN (R 3.6.0)
#> Rcpp 1.0.2 2019-07-25 [2] CRAN (R 3.6.0)
#> rlang 0.4.0.9000 2019-07-09 [1] Github (r-lib/rlang@c375d5b)
#> rmarkdown 1.14 2019-07-12 [2] CRAN (R 3.6.0)
#> scales 1.0.0 2018-08-09 [2] CRAN (R 3.6.0)
#> sessioninfo 1.1.1 2018-11-05 [2] CRAN (R 3.6.0)
#> stringi 1.4.3 2019-03-12 [2] CRAN (R 3.6.0)
#> stringr 1.4.0 2019-02-10 [2] CRAN (R 3.6.0)
#> tibble 2.1.3 2019-06-06 [1] CRAN (R 3.6.0)
#> tidygraph * 1.1.2 2019-02-18 [2] CRAN (R 3.6.0)
#> tidyr 0.8.3 2019-03-01 [2] CRAN (R 3.6.0)
#> tidyselect 0.2.5 2018-10-11 [2] CRAN (R 3.6.0)
#> tweenr 1.0.1 2018-12-14 [2] CRAN (R 3.6.0)
#> viridis 0.5.1 2018-03-29 [2] CRAN (R 3.6.0)
#> viridisLite 0.3.0 2018-02-01 [2] CRAN (R 3.6.0)
#> withr 2.1.2 2018-03-15 [2] CRAN (R 3.6.0)
#> xfun 0.8 2019-06-25 [2] CRAN (R 3.6.0)
#> yaml 2.2.0 2018-07-25 [2] CRAN (R 3.6.0)
#>
#> [1] /Users/luke.zappia/Library/R/3.6-devel/library
#> [2] /Library/Frameworks/R.framework/Versions/3.6/Resources/library
Created on 2019-08-15 by the reprex package (v0.3.0)
Hi
I had a user report this issue lazappi/clustree#36. After looking into it a bit a think it might be a problem with
ggraph.Here is a reprex with an example from one of the vignettes.
That works fine but if we set
options(stringsAsFactors = FALSE)first there is an error when rendering the plot.I'm guessing somewhere something that should be a factor isn't (probably related to the edge colour) but I'm not sure where.
Created on 2019-08-15 by the reprex package (v0.3.0)