jon*_*jon 7 interaction r graph ggplot2 lattice
我有以下类型的数据(虽然数据点的数量非常大)
# property data
name <- c("A", "B", "C", "D")
diameter <- c(4.3, 8.3,1.2, 3.3)
X <- c( 1, 2, 3, 4)
Y <- c(1, 3, 3, 4)
colr <- c(10, 20, 34, 12)
propdata <- data.frame (name, diameter, X, Y, colr)
# interaction data
name1 <- c("A", "A", "A", "B", "B")
name2 <- c("B", "C", "D", "C", "D")
score <- c(1.1, 2.2, 5.4, 3.1, 2.0)
relation <- data.frame (name1, name2, score)
Run Code Online (Sandbox Code Playgroud)
我想创建一个类似于以下的图形,以便它具有以下属性.
(
1) diameter of circles is governed by propdata$diameter
(2) Position in xy field is governed by cordinates of propdata$X and propdata$y
(3) Fill color of the circle is controlled by propdata$colr
(4) Interaction is governed by relation data.frame, name1
and name2 elements will be connected and weight of the line is govenmened
by relation$score.
Run Code Online (Sandbox Code Playgroud)

是否可以使用现有的R base或任何流行的图形软件制作这样的图形,或者需要更专业的软件.
EDITS:
这就是我使用泡泡图:
p <- ggplot(propdata, aes(X,Y,size = diameter, label=name))
p <- p + geom_point(colour= "red")+geom_text(size=3) # colour = colr does not work
p
Run Code Online (Sandbox Code Playgroud)

这是我快速烹饪的东西qgraph:
library("qgraph")
plot(1,type='n',xlim=c(min(propdata$X)-0.5,
max(propdata$Y)+0.5),ylim=c(min(propdata$Y)-0.5,max(propdata$Y)+0.5),
xlab="",ylab="")
col <- rgb(0,1-propdata$colr/max(propdata$colr),0)
qgraph(relation,plot=FALSE,rescale=FALSE,layout=as.matrix(propdata[c("X","Y")]),
edge.color="darkred",color=col,propdata$colr,directed=FALSE,esize=10,
vsize=propdata$diameter+2,lcolor="white",curve=c(0,0,-0.2,0,0))
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
1009 次 |
| 最近记录: |