简体   繁体   中英

R: Understanding the ggnetwork package and its usage with ggplot

I am learning to plot network graph using ggplot2, igraph and ggnetwork. I am studying this webpage:

https://cran.r-project.org/web/packages/ggnetwork/vignettes/ggnetwork.html#geom_edges

However, I have some very basic questions in order to understand how the functions work. In the example under the heading 'geom_edges', the code is

ggplot(n, aes(x = x, y = y, xend = xend, yend = yend)) 
    + geom_edges(aes(linetype = type), color = "grey50") 
    + theme_blank()

I do not understand

  • how does it actually use the ggnetwork package in the statement. Is it implicitly? How?
  • what does x = x, y = y, xend = xend, yend = yend mean? What are x, y, xend and yend?
  • how do the parameters x, y, xend, yend relate to the data object n?

Many thanks!

As previous commenters have said, the x , xend , y and yend parameters in the example code, which are used to plot nodes and edges between them, work exactly like ingeom_segment . The ggnetwork builds on ggplot2 , so some knowledge of that package is required to work with it.

What the package brings on top of ggplot2 are functions like geom_edges : see its documentation for the full list of functions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM