tkid <- tkplot(net) # tkid - tkplot, l <- tkplot.getcoords(tkid) # tkplot plot(net, layout=l) 
netm <- get.adjacency(net, attr="weight", sparse=F) colnames(netm) <- V(net)$media rownames(netm) <- V(net)$media palf <- colorRampPalette(c("gold", "dark orange")) heatmap(netm[,17:1], Rowv = NA, Colv = NA, col = palf(100), scale="none", margins=c(10,10) ) 
dd <- degree.distribution(net, cumulative=T, mode="all") plot(dd, pch=19, cex=1, col="orange", xlab="Degree", ylab="Cumulative Frequency") 
graph.incidence . In igraph, dicotyledonous networks have an edge type parameter of 0 for one group of vertices and 1 for another. head(nodes2) head(links2) net2 <- graph.incidence(links2) table(E(net2)$type) plot(net2, vertex.label=NA) 
V(net2)$color <- c("steel blue", "orange")[V(net2)$type+1] V(net2)$shape <- c("square", "circle")[V(net2)$type+1] V(net2)$label <- "" V(net2)$label[V(net2)$type==F] <- nodes2$media[V(net2)$type==F] V(net2)$label.cex=.4 V(net2)$label.font=2 plot(net2, vertex.label.color="white", vertex.size=(2-V(net2)$type)*8) 
plot(net2, vertex.label=NA, vertex.size=7, layout=layout.bipartite) 
plot(net2, vertex.shape="none", vertex.label=nodes2$media, vertex.label.color=V(net2)$color, vertex.label.font=2, vertex.label.cex=.6, edge.color="gray70", edge.width=2) 
png library (if it is not installed, use install.packages("png") ). # install.packages("png") library(png) img.1 <- readPNG("./images/news.png") img.2 <- readPNG("./images/user.png") V(net2)$raster <- list(img.1, img.2)[V(net2)$type+1] plot(net2, vertex.shape="raster", vertex.label=NA, vertex.size=16, vertex.size2=16, edge.width=2) 
l <- layout.auto(net2, ymin=-1.5, ymax=1.5, xmin=-1.5, xmax=1.5) plot(net2, vertex.shape="raster", vertex.label=NA, vertex.size=16, vertex.size2=16, edge.width=2, layout=l) img.3 <- readPNG("./images/puppy.png") rasterImage(img.3, xleft=-1.7, xright=0, ybottom=-1.2, ytop=0) 
# - # par()$usr igraph and statnet generate errors if you load them together. detach(package:png) detach(package:igraph) network package is very similar to igraph , although the syntax differs slightly (a complete set of new parameter names!). This package also uses fewer default settings, obtained by changing the network object, and more explicit parameters in the build function.network format, which is used by the Statnet family of packages (including network , sna , ergm , stergm and others).?edgeset.constructors . As in the igraph example, we will use a list of edges and data blocks with vertex attributes to create a network object. One feature that is worth paying attention to is the ignore.eval parameter. By default, it is set to TRUE , and this setting tells the network object to ignore edge weights. library(network) net3 <- network(links, vertex.attr=nodes, matrix.type="edgelist", loops=F, multiple=F, ignore.eval = F) net3[,] net3 %n% "net.name" <- "Media Network" # net3 %v% "media" # net3 %e% "type" # net3 %v% "col" <- c("gray70", "tomato", "gold")[net3 %v% "media.type"] plot(net3, vertex.cex=(net3 %v% "audience.size")/7, vertex.col="col") 
coord parameter. l <- plot(net3, vertex.cex=(net3 %v% "audience.size")/7, vertex.col="col") plot(net3, vertex.cex=(net3 %v% "audience.size")/7, vertex.col="col", coord=l) 
detach(package:network) network package, execute ?plot.network .Source: https://habr.com/ru/post/268917/
All Articles