Skip to content

Commit 2337e9d

Browse files
committed
fixed diameter plots (post)
1 parent 2d650f0 commit 2337e9d

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

src/post/description/_all_post.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ source("src/post/description/char_sim.R")
2121
source("src/post/description/comp_vs_edges.R")
2222
source("src/post/description/comp_vs_vertices.R")
2323
source("src/post/description/deg_plots.R")
24-
#source("src/post/description/diameters.R")
24+
source("src/post/description/diameters.R")
2525
#source("src/post/description/nei_vs_deg.R")
2626
#source("src/post/description/partial_extr.R")
2727
#source("src/post/description/pref_attach.R")

src/post/description/diameters.R

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ el <- get.edgelist(g.filtr, names=FALSE)
8888
ww <- rep(1, gsize(g.filtr))
8989
#ww <- E(cmp)$weight
9090
lay.filtr <<- qgraph.layout.fruchtermanreingold( # actually not used anymore
91-
edgelist=el,
92-
vcount=gorder(g.filtr),
93-
weight=ww,
94-
area=10*(gorder(g.filtr)^2),repulse.rad=(gorder(g.filtr)^3.0)
91+
edgelist=el,
92+
vcount=gorder(g.filtr),
93+
weight=ww,
94+
area=10*(gorder(g.filtr)^2),repulse.rad=(gorder(g.filtr)^3.0)
9595
)
9696

9797
# get filtered edges
@@ -113,7 +113,6 @@ diam.paths <- lapply(1:nrow(idx), function(r) all_shortest_paths(graph=g.filtr,
113113

114114
# plot diameters
115115
tlog(0,"Plotting diameter paths")
116-
base.file <- get.path.data.graph(mode="scenes", net.type="static", filtered=TRUE, subfold="diameters", pref="graph", suf="_diameter")
117116
for(pp in 1:length(diam.paths))
118117
{ tlog(2,"Processing vertex pair ",pp,"/",length(diam.paths))
119118
if(pp==1)
@@ -123,28 +122,28 @@ for(pp in 1:length(diam.paths))
123122

124123
q <- 1
125124
for(p in s:length(diam.paths[[pp]]))
126-
{ # plot absolutely all diameters on the same graph
125+
{ # draw absolutely all diameters on the same plot
127126
if(p==-1)
128127
{ tlog(4,"Plotting all diameters on the same graph")
129128
paths <- unlist(diam.paths, recursive=FALSE)
130-
graph.file <- paste0(base.file,"s")
131-
tlog(6,"Producing file ",graph.file)
129+
plot.file <- get.path.data.graph(mode="scenes", net.type="static", filtered=TRUE, subfold="diameters", pref="graph", suf="all_diameters")
130+
tlog(6,"Producing file ",plot.file)
132131

133132
}
134-
# plot all diameter variants on the same graph
133+
# draw all diameter variants on the same plot
135134
else if(p==0)
136135
{ tlog(4,"Plotting all diameter variants at once")
137136
paths <- diam.paths[[pp]]
138-
graph.file <- paste0(base.file,"_",pp)
139-
tlog(6,"Producing file ",graph.file)
137+
plot.file <- get.path.data.graph(mode="scenes", net.type="static", filtered=TRUE, subfold=file.path("diameters",paste0("nodepair_",pp)), pref="graph", suf=paste0("diameter_",pp))
138+
tlog(6,"Producing file ",plot.file)
140139
}
141-
# plot each diameter variant separately
140+
# draw each diameter variant separately
142141
else
143142
{ tlog(4,"Plotting diameter variant ",p,"/",length(diam.paths[[pp]]))
144143
if(p==1 || !all(diam.paths[[pp]][[p]]==diam.paths[[pp]][[p-1]]))
145144
{ paths <- diam.paths[[pp]][[p]]
146-
graph.file <- paste0(base.file,"_",pp,"_",q)
147-
tlog(6,"Producing file ",graph.file)
145+
plot.file <- get.path.data.graph(mode="scenes", net.type="static", filtered=TRUE, subfold=file.path("diameters",paste0("nodepair_",pp)), pref="graph", suf=paste0("diameter_",pp,"_",q))
146+
tlog(6,"Producing file ",plot.file)
148147
q <- q + 1
149148
}
150149
else
@@ -172,9 +171,9 @@ for(pp in 1:length(diam.paths))
172171
tlog(6,"Plotting all paths at once for vertex pair #",pp)
173172
for(fformat in PLOT_FORMAT)
174173
{ if(fformat==PLOT_FORMAT_PDF)
175-
pdf(file=paste0(graph.file,PLOT_FORMAT_PDF), bg="white", width=40, height=40)
174+
pdf(file=paste0(plot.file,PLOT_FORMAT_PDF), bg="white", width=40, height=40)
176175
else if(fformat==PLOT_FORMAT_PNG)
177-
png(filename=paste0(graph.file,PLOT_FORMAT_PNG), width=2000, height=2000, units="px", pointsize=20, bg="white")
176+
png(filename=paste0(plot.file,PLOT_FORMAT_PNG), width=2000, height=2000, units="px", pointsize=20, bg="white")
178177
plot(g.filtr2,
179178
layout=LAYOUT[idx.keep,], # lay.filtr
180179
# vertex.size=vsizes[idx.keep], vertex.color=vcols[idx.keep],

0 commit comments

Comments
 (0)