Improved graph plots and code

This commit is contained in:
ackman678
2014-01-13 17:13:45 -05:00
parent f410676469
commit 677d478c4b
33 changed files with 46 additions and 61 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

View File

@@ -105,62 +105,34 @@ ggsave(file=paste("120518_07-degreeDist", format(Sys.time(),"%y%m%d-%H%M%S"), ".
edgelist<-read.delim('/Users/ackman/Data/2photon/120518i/2014-01-03-231550/dCorr.txt')
# d2 <- subset(edgelist,filename!='120518_09.tif')
d2 <- subset(edgelist,filename!='120518_09.tif')
d3 <- subset(d2,filename=='120518_06.tif')
rthresh <- 0.2
fnm <- '120518_07'
fnm2 <- paste(fnm,".tif",sep="")
lo <- 'layout.fruchterman.reingold'
# lo <- 'layout.kamada.kawai'
# lo <- 'layout.lgl'
d3 <- subset(edgelist,filename==fnm2)
d4 <- with(d3,data.frame(node1,node2,rvalue))
edgelist2<-subset(d4,rvalue > 0.1)
edgelist2<-subset(d4,rvalue > rthresh)
g <- graph.data.frame(edgelist2, directed=FALSE)
E(g)$weight <- E(g)$rvalue
E(g)$width <- 1
E(g)[ weight >= 0.3 ]$width <- 3
E(g)[ weight >= 0.5 ]$width <- 5
fastgreedyCom<-fastgreedy.community(g,weights=E(g)$weight)
V(g)$color <- fastgreedyCom$membership+1
quartz();
palette(rainbow(max(V(g)$color),alpha=0.5))
plot(g, layout=layout.fruchterman.reingold, edge.width=E(g)$width, edge.color="black")
palette("default")
title('120518_06, fastgreedy, layout.fruchterman.reingold, default vertex size,alpha0.5')
d3 <- subset(d2,filename=='120518_07.tif')
d4 <- with(d3,data.frame(node1,node2,rvalue))
edgelist2<-subset(d4,rvalue > 0.1)
g <- graph.data.frame(edgelist2, directed=FALSE)
E(g)$weight <- E(g)$rvalue
E(g)$width <- 1
E(g)[ weight >= 0.3 ]$width <- 3
E(g)[ weight >= 0.5 ]$width <- 5
fastgreedyCom<-fastgreedy.community(g,weights=E(g)$weight)
V(g)$color <- fastgreedyCom$membership+1
quartz();
palette(rainbow(max(V(g)$color),alpha=0.5))
plot(g, layout=layout.fruchterman.reingold, edge.width=E(g)$width, edge.color="black")
palette("default")
title('120518_07, fastgreedy, layout.fruchterman.reingold, default vertex size,alpha0.5')
d3 <- subset(d2,filename=='120518_08.tif')
d4 <- with(d3,data.frame(node1,node2,rvalue))
edgelist2<-subset(d4,rvalue > 0.1)
g <- graph.data.frame(edgelist2, directed=FALSE)
fastgreedyCom<-fastgreedy.community(g)
V(g)$color <- fastgreedyCom$membership+1
quartz();
palette(rainbow(max(V(g)$color),alpha=0.5))
plot(g, layout=layout.fruchterman.reingold)
palette("default")
title('120518_08, fastgreedy, layout.fruchterman.reingold, default vertex size,alpha0.5')
V(g)$color <- fastgreedyCom$membership
# quartz();
# palette(rainbow(max(V(g)$color),alpha=0.5))
mypalette <- adjustcolor(brewer.pal(max(V(g)$color),"Set1"),0.6)
palette(mypalette)
plot(g, layout=eval(parse(text=lo)), edge.width=E(g)$width, edge.color="black", vertex.label.color="black")
# palette("default")
title(paste(fnm,', fastgreedy default, ', lo, 'r>', rthresh))
dateStr=format(Sys.time(),"%y%m%d-%H%M%S")
quartz.save(file=paste(dateStr, fnm, ".png",sep=""), type = "png", dpi=150)
quartz.save(file=paste(dateStr, fnm, ".pdf",sep=""), type = "pdf")
@@ -169,22 +141,35 @@ title('120518_08, fastgreedy, layout.fruchterman.reingold, default vertex size,a
edgelist<-read.delim('/Users/ackman/Data/2photon/131208/2014-01-07-003602/dCorr.txt')
d3 <- subset(edgelist,filename=='131208_08.tif')
rthresh <- 0.2
fnm <- '131208_09'
fnm2 <- paste(fnm,".tif",sep="")
lo <- 'layout.fruchterman.reingold'
# lo <- 'layout.kamada.kawai'
# lo <- 'layout.lgl'
d3 <- subset(edgelist,filename==fnm2)
d4 <- with(d3,data.frame(node1,node2,rvalue))
edgelist2<-subset(d4,rvalue > 0.1)
edgelist2<-subset(d4,rvalue > rthresh)
g <- graph.data.frame(edgelist2, directed=FALSE)
fastgreedyCom<-fastgreedy.community(g)
V(g)$color <- fastgreedyCom$membership+1
E(g)$weight <- runif(ecount(g))
E(g)$weight <- E(g)$rvalue
E(g)$width <- 1
# E(g)[ weight >= 0.3 ]$width <- 2
E(g)[ weight >= 0.5 ]$width <- 3
quartz();
palette(rainbow(max(V(g)$color),alpha=0.5))
plot(g, layout=layout.fruchterman.reingold, edge.width=E(g)$width, edge.color="black")
palette("default")
title('131208_08, fastgreedy, layout.fruchterman.reingold, default vertex size,alpha0.5')
E(g)[ weight >= 0.3 ]$width <- 3
E(g)[ weight >= 0.5 ]$width <- 5
fastgreedyCom<-fastgreedy.community(g,weights=E(g)$weight)
V(g)$color <- fastgreedyCom$membership
# quartz();
# palette(rainbow(max(V(g)$color),alpha=0.5))
mypalette <- adjustcolor(brewer.pal(max(V(g)$color),"Set1"),0.6)
palette(mypalette)
plot(g, layout=eval(parse(text=lo)), edge.width=E(g)$width, edge.color="black", vertex.label.color="black")
# palette("default")
title(paste(fnm,', fastgreedy default, ', lo, 'r>', rthresh))
dateStr=format(Sys.time(),"%y%m%d-%H%M%S")
quartz.save(file=paste(dateStr, fnm, ".png",sep=""), type = "png", dpi=150)
quartz.save(file=paste(dateStr, fnm, ".pdf",sep=""), type = "pdf")
g <- graph.ring(10)