Hi,
First of all I don't know whether this is an ggraph or (under the hood a) ggplot2 issue (or a problem simply caused by me), but since I experienced it while learning ggraph I am posting here.
As said, I am playing with ggraph to manually reproduce some graphs made by some functions in a Bioconductor package.
While doing so I experienced something strange: after resetting a ggraph/ggplot2 object by applying the function theme_void, the network as such is still printed (as expected) in the graphics device on my Linux machine, but NOT when I do this on my Windows 10 system (which is rather unexpected...).
Note that I am using the same R setup on both machines.
Any idea what goes wrong on my Windows system?
Thanks!
G
Short, reproducible example:
library(ggraph)
library(igraph)
simple <- make_graph('bull')
# define values for 'edge layer'
#
# done like this now since in BioC package arguments
# are defined based on output upstream function.
edge_layer <- geom_edge_link(alpha=0.8, colour='darkgrey')
# generate plot
p <- ggraph(simple, layout = 'graphopt') + edge_layer +
geom_node_point(size = 5)
print(p)
# looks good!
# now reset theme
p2 <- p + theme_void()
print(p2)
# but this unexpectedly shows only the nodes on Windows??
# ... but (still) looks good on Linux!
# ???
#
# Interestingly, when exporting as PDF on Windows, network is as
# expected (thus contains both nodes AND edges).
ggsave(p2, file="reset.network.pdf")
Output p in graphic device windows system:
Output p2 in graphic device windows system:
(note that p2 looks fine on Linux machine):
## SessionInfo Windows system
> sessionInfo()
R version 4.0.3 Patched (2020-12-21 r79668)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)
Matrix products: default
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] igraph_1.2.6 ggraph_2.0.4 ggplot2_3.3.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 magrittr_2.0.1 MASS_7.3-53 tidyselect_1.1.0
[5] munsell_0.5.0 viridisLite_0.3.0 colorspace_2.0-0 R6_2.5.0
[9] rlang_0.4.9 dplyr_1.0.2 tools_4.0.3 grid_4.0.3
[13] gtable_0.3.0 ggforce_0.3.2 withr_2.3.0 graphlayouts_0.7.1
[17] ellipsis_0.3.1 digest_0.6.27 tibble_3.0.4 lifecycle_0.2.0
[21] crayon_1.3.4 tidygraph_1.2.0 gridExtra_2.3 farver_2.0.3
[25] tweenr_1.0.1 purrr_0.3.4 tidyr_1.1.2 viridis_0.5.1
[29] vctrs_0.3.6 ggrepel_0.9.0 glue_1.4.2 labeling_0.4.2
[33] polyclip_1.10-0 compiler_4.0.3 pillar_1.4.7 generics_0.1.0
[37] scales_1.1.1 pkgconfig_2.0.3
>
Hi, First of all I don't know whether this is an
ggraph
or (under the hood a)ggplot2
issue (or a problem simply caused by me), but since I experienced it while learningggraph
I am posting here.As said, I am playing with
ggraph
to manually reproduce some graphs made by some functions in a Bioconductor package. While doing so I experienced something strange: after resetting aggraph
/ggplot2
object by applying the functiontheme_void
, the network as such is still printed (as expected) in the graphics device on my Linux machine, but NOT when I do this on my Windows 10 system (which is rather unexpected...). Note that I am using the same R setup on both machines. Any idea what goes wrong on my Windows system? Thanks! GShort, reproducible example:
Output
p
in graphic device windows system:Output
p2
in graphic device windows system: (note thatp2
looks fine on Linux machine):